R> command when killing monsters

Ricauter

New member
Messages
26
Points
0
default_biggrin.png
 I want to know if it's possible to script that when you kill X mob in Y map, it exexutes Z command, like for example to add +1 to a counter, and when that counter reaches a certain number, then it executes a certain command, or when killing a monster it buffs you, I'd greatly appreciate on some help on how to create a script of this kind
default_biggrin.png


 
default_biggrin.png
 I want to know if it's possible to script that when you kill X mob in Y map, it exexutes Z command, like for example to add +1 to a counter, and when that counter reaches a certain number, then it executes a certain command, or when killing a monster it buffs you, I'd greatly appreciate on some help on how to create a script of this kind
default_biggrin.png
Just a question: what you mean with 'X' >>> number of mobs, or a specifc one??

 
default_biggrin.png
 I want to know if it's possible to script that when you kill X mob in Y map, it exexutes Z command, like for example to add +1 to a counter, and when that counter reaches a certain number, then it executes a certain command, or when killing a monster it buffs you, I'd greatly appreciate on some help on how to create a script of this kind
default_biggrin.png
Just a question: what you mean with 'X' >>> number of mobs, or a specifc one??
a specific one

 
default_biggrin.png
 I want to know if it's possible to script that when you kill X mob in Y map, it exexutes Z command, like for example to add +1 to a counter, and when that counter reaches a certain number, then it executes a certain command, or when killing a monster it buffs you, I'd greatly appreciate on some help on how to create a script of this kind
default_biggrin.png
Just a question: what you mean with 'X' >>> number of mobs, or a specifc one??
a specific one
then do something like this:

Code:
OnNPCKillEvent:if(strcharinfo(3)== 'map'){   if(getmonsterinfo(killedrid,0) == 'monstername'){       sc_start 39, 60,5; //buff 39(id), 60(time), 5 (skill level)
 
Last edited by a moderator:
@@RodRich oh right, and how do I do the counter thing? would it be something like
 
 

OnNPCKillEvent:if(strcharinfo(3)== 'map'){if(getmonsterinfo(killedrid,0) == 'monstername'){ set mymobkills,mymobkills +1;// to count +1 kills }end; if (mymobkills > 99){ set mymobkills,0; //to reset the counter and buff? sc_start 39, 60,5;}end;
right?

and how can I make it execute a roullette? like I want it to give a random drop from an OBB without giving the OBB?

 
@@RodRich oh right, and how do I do the counter thing? would it be something like

OnNPCKillEvent:if(strcharinfo(3)== 'map'){if(getmonsterinfo(killedrid,0) == 'monstername'){ set mymobkills,mymobkills +1;// to count +1 kills }end; if (mymobkills > 99){ set mymobkills,0; //to reset the counter and buff? sc_start 39, 60,5;}end;
right?

and how can I make it execute a roullette? like I want it to give a random drop from an OBB without giving the OBB?
Exaclty!!

about you last question, I'm sorry could you say without abreviation? 'cause my english is not so good!!

 
@@RodRich oh right, and how do I do the counter thing? would it be something like

OnNPCKillEvent:if(strcharinfo(3)== 'map'){if(getmonsterinfo(killedrid,0) == 'monstername'){ set mymobkills,mymobkills +1;// to count +1 kills }end; if (mymobkills > 99){ set mymobkills,0; //to reset the counter and buff? sc_start 39, 60,5;}end;
right?

and how can I make it execute a roullette? like I want it to give a random drop from an OBB without giving the OBB?
Ah ok, that simple either!!

You can do this way:

OnNPCKillEvent:if(strcharinfo(3)== 'map'){if(getmonsterinfo(killedrid,0) == 'monstername'){ set mymobkills,mymobkills +1;// to count +1 kills }} if (mymobkills > 99){ set mymobkills,0; //to reset the counter and buff? sc_start 39, 60,5; getitem,-1,1;}end;
where -1 means: a random item from OBB..

or if you preffer you can also use: -2,-3,-4,-5

Giving an item ID of -2 will produce the effects of Old Violet Box.

Giving an item ID of -3 will produce the effects of Old Card Album.

Giving an item ID of -4 will produce the effects of Gift Box.

Giving an item ID of -5 will produce the effects of Worn Out Scroll, which, in current SVN, drops only Jellopies anyway.

 
Last edited by a moderator:
thanks! but now while testing I ran intro some issues D: I'm trying the code BUT I'm getting this eror on the console:

[Error]: npc_parsesrcfile: Unable to parse, probably a missing TAB in file 'npc/test/test.txt', line '1'. Skipping line... * w1=prontera * w2=Script * w3=FASE1,-1{ * w4=[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/test/test.txt', line '3'. Stopping... * w1=OnNPCKillEvent: * w2= * w3= * w4=
here's how it goes:

prontera Script TEST1,-1{ OnNPCKillEvent: if(strcharinfo(3)== 'prontera'){ if(getmonsterinfo(killerid == 1973) == 'Poring'){ set f1@ks,f1@ks +1;// to count +1 kills announce "PORINGS KILLED +1 ["f1@ks"/5]",3 } if (f1@ks > 5){ set f1@ks,0; //to reset the counter and buff sc_start 10, 240000,10;}end;}}
what did I do wrong?
default_sad.png


 
Last edited by a moderator:
thanks! but now while testing I ran intro some issues D: I'm trying the code BUT I'm getting this eror on the console:

[Error]: npc_parsesrcfile: Unable to parse, probably a missing TAB in file 'npc/test/test.txt', line '1'. Skipping line... * w1=prontera * w2=Script * w3=FASE1,-1{ * w4=[Error]: npc_parsesrcfile: Unknown syntax in file 'npc/test/test.txt', line '3'. Stopping... * w1=OnNPCKillEvent: * w2= * w3= * w4=
here's how it goes:

prontera Script TEST1,-1{ OnNPCKillEvent: if(strcharinfo(3)== 'prontera'){ if(getmonsterinfo(killerid == 1973) == 'Poring'){ set f1@ks,f1@ks +1;// to count +1 kills announce "PORINGS KILLED +1 ["f1@ks"/5]",3 } if (f1@ks > 5){ set f1@ks,0; //to reset the counter and buff sc_start 10, 240000,10;}end;}}
what did I do wrong?
default_sad.png
You should use <tab> instead <space bar> for while that's it! =D

P.s: you don't need to put a map if you don't want!! you can do this way:

Code:
-<tab>script<tab>npcname<tab>-1,{
 
Last edited by a moderator:
I did it like this:

-<tab>Script<tab>test1<tab>-1,{<tab>OnNPCKillEvent:<tab><tab>if(strcharinfo(3)== 'prontera'){<tab><tab><tab>if(getmonsterinfo(killerid,1973) == 'Poring'){<tab><tab><tab>set f1@ks,f1@ks +1;// to count +1 kills<tab><tab><tab>announce "PORINGS KILLED +1 ["f1@ks"/5]",3}<tab>if (f1@ks > 5){<tab><tab>set f1@ks,1; //to reset the counter and buff<tab><tab>sc_start 10, 240000,10;}}end;}
and I'm getting the same errors 
default_sleep.png


 
I did it like this:

-<tab>Script<tab>test1<tab>-1,{<tab>OnNPCKillEvent:<tab><tab>if(strcharinfo(3)== 'prontera'){<tab><tab><tab>if(getmonsterinfo(killerid,1973) == 'Poring'){<tab><tab><tab>set f1@ks,f1@ks +1;// to count +1 kills<tab><tab><tab>announce "PORINGS KILLED +1 ["f1@ks"/5]",3}<tab>if (f1@ks > 5){<tab><tab>set f1@ks,1; //to reset the counter and buff<tab><tab>sc_start 10, 240000,10;}}end;}
and I'm getting the same errors 
default_sleep.png
I guess you're using the <tab> key form you keyboard where you wrote <tab> (you have to)

but this line is wrong:

<tab><tab><tab>announce "PORINGS KILLED +1 ["f1@ks"/5]",3
do this way:

<tab><tab><tab>announce "PORINGS KILLED +1 ["+f1@ks+"/5]",3;


@pS:

Maybe you can't use '@' in midle of a variable, idk, try this way first and tell me!!

 
I guess you're using the <tab> key form you keyboard where you wrote <tab> (you have to)

but this line is wrong:

<tab><tab><tab>announce "PORINGS KILLED +1 ["f1@ks"/5]",3
do this way:

<tab><tab><tab>announce "PORINGS KILLED +1 ["+f1@ks+"/5]",3;
yes xD but I mean the problem is that the console is saying that there's a syntax error on the 1st line, and that it doesn't recognize the OnNPCKillEvent: syntax 
default_sleep.png
 I know it was OnNPCKillEvent, but why doesn't it recognize it as valid?

 
I guess you're using the <tab> key form you keyboard where you wrote <tab> (you have to)

but this line is wrong:

<tab><tab><tab>announce "PORINGS KILLED +1 ["f1@ks"/5]",3
do this way:

<tab><tab><tab>announce "PORINGS KILLED +1 ["+f1@ks+"/5]",3;
yes xD but I mean the problem is that the console is saying that there's a syntax error on the 1st line, and that it doesn't recognize the OnNPCKillEvent: syntax 
default_sleep.png
 I know it was OnNPCKillEvent, but why doesn't it recognize it as valid?
Ah ok, because when you get errer from first line, the npc isn't readed.

I think your error is case sensitive:

-<tab>Script<tab>test1<tab>-1,{
try:

Code:
-<tab>script<tab>test1<tab>-1,{
 
@@RodRich now it went past 1st line but:

[Warning]: script_get_val: cannot access instance variable ''prontera'', defaulting to 0

[Error]: script:op_2: invalid data for operator C_EQ
[Debug]: Data: string value="prontera"
[Debug]: Data: number value=0
[Debug]: Source (NPC): test1 (invisible/not on a map)
 
I'll try on another map and update you on it
default_tongue.png

 
Last edited by a moderator:
nope... still getting:

[Error]: script:op_2: invalid data for operator C_EQ
[Debug]: Data: string value="prontera"
[Debug]: Data: number value=0
[Debug]: Source (NPC): test1 (invisible/not on a map)
 
what can that be?
- script test1 -1,{ OnNPCKillEvent: if(strcharinfo(3)==prontera){ if(getmonsterinfo(killerid,1008)=='Poring'){ set f1ks,f1ks +1;// to count +1 kills; announce "PORINGS KILLED +1 ["+f1ks+"/5]",3; } if (f1ks >= 5){ set f1ks,f1ks=1; //to reset the counter and buff? sc_start 10, 240000,10; }}end;}
edit: but I should tell you, the script loads perfectly, the error appears on the console as soon as I try to execute it, and by that I mean, when I kill a poring in prontera...
 
Last edited by a moderator:
nope... still getting:

[Error]: script:op_2: invalid data for operator C_EQ
[Debug]: Data: string value="prontera"
[Debug]: Data: number value=0
[Debug]: Source (NPC): test1 (invisible/not on a map)
 
what can that be?
- script test1 -1,{ OnNPCKillEvent: if(strcharinfo(3)==prontera){ if(getmonsterinfo(killerid,1008)=='Poring'){ set f1ks,f1ks +1;// to count +1 kills; announce "PORINGS KILLED +1 ["+f1ks+"/5]",3; } if (f1ks >= 5){ set f1ks,f1ks=1; //to reset the counter and buff? sc_start 10, 240000,10; }}end;}
edit: but I should tell you, the script loads perfectly, the error appears on the console as soon as I try to execute it, and by that I mean, when I kill a poring in prontera...
I found some issues, make this way:

Code:
-	script	test1	-1,{	OnNPCKillEvent:                set .@map$,"prontera";		if(strcharinfo(3)== .@map$){			if(getmonsterinfo(killerid,0)=="Poring"){ //u had put 1008, here and have to be '0'			set f1ks,f1ks +1;// to count +1 kills;			announce "PORINGS KILLED +1 ["+f1ks+"/5]",3;			}	if (f1ks >= 5){		set f1ks,0;             //if you put '1' here, the count will start at 2		sc_start 10, 240000,10;		}}end;}
 
Last edited by a moderator:
@@RodRich

I tried this:

- script test1 -1,{ OnNPCKillEvent: set .@map$, "prontera"; if(strcharinfo(3)==.@map$){ if(getmonsterinfo(killerid,1008)==1008){ // It has to be 1008 (poring's ID) else it will give me a: //[Error]: buildin_getmonsterinfo: Wrong Monster ID: 0 //[Error]: script:op_2: invalid data for operator C_EQ //[Debug]: Data: string value="null" //[Debug]: Data: number value=1008 //[Debug]: Source (NPC): test1 (invisible/not on a map) set f1ks,f1ks +1;// to count +1 kills; announce "PORINGS KILLED +1 ["+ f1ks +"/5]",3; } if (f1ks >= 5){ set f1ks,f1ks=0; //to reset the counter and buff sc_start 10, 240000,10; }}end;}
but even with that, it gives me: [Error]: buildin_getmonsterinfo: Wrong Monster ID: 0

 
Back
Top