R> command when killing monsters

@@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
The zero doesn't mean the monster ID, that's aboout the killedrid opition, then that should be 0!!

try this way instead:

Code:
if(getmonsterinfo(killerid,0)==getmonsterinfo(1008,0)){
 
Last edited by a moderator:
by all the gods in heaven... doing this:

- script test1 -1,{ OnNPCKillEvent: set .@map$, "prontera"; if(strcharinfo(3)==.@map$){ if(getmonsterinfo(killerid,1008)==getmonsterinfo(0,1008){ // aparently that las { doesn't have a closure... 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;}
it has an error when reloading again...

[Error]: script error in file 'npc/test/test1.txt' line 5 column 60
    parse_simpleexpr: unmatched ')'
     2:         OnNPCKillEvent:
     3:                 set .@map$, "prontera";
     4:                 if(strcharinfo(3)==.@map$){
*    5:                         if(getmonsterinfo(killerid,1008)==getmonsterinfo(0,1008){
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
     6:                         set f1ks,f1ks +1;// to count +1 kills;
     7:                         announce "PORINGS KILLED +1 ["+ f1ks +"/5]",3;
     8:                         }
 
@@Ricauter

That's because you didn't closed the "()"

copy and paste :

Code:
-	script	test1	-1,{	OnNPCKillEvent:		set .@map$, "prontera";		if(strcharinfo(3)==.@map$){			if(getmonsterinfo(killedrid,0)==getmonsterinfo(1008,0)){ // PLEASE THIS WAY IS THE RIGHT WAY DON'T CHANGE AGAIN '-'			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;}
 
Last edited by a moderator:
oh... I feel stupid now but it works now, and I LOVE YOU FOR THAT
Hahah, no problem!!
default_wink.png


Hey, I've just saw this line, it can bring you problem:

set f1ks,f1ks=0;
test in your npc, if this doesn't give error, just forgot... but If does, do this way:

Code:
set f1ks,0;
 
was testing around, there was a mistake on the script, actually:

if(getmonsterinfo(killedrid,0)==getmonsterinfo(1008,0))
doesn't work at all, so any monster you'd kill would increase the counter, the real script is like this:

if(killedrid==1002) // and replace the 1002 for any monster ID
that way, only the monster ID you choose would increase the counter.

 
was testing around, there was a mistake on the script, actually:

if(getmonsterinfo(killedrid,0)==getmonsterinfo(1008,0))
doesn't work at all, so any monster you'd kill would increase the counter, the real script is like this:

if(killedrid==1002) // and replace the 1002 for any monster ID
that way, only the monster ID you choose would increase the counter.
That's true, I hadn't thought this way!! that's better than before. But I don't know why, the other one isn't working. It should work in both ways!!

The first one checks the monster name's, and the second one checks the monster ID's

But..
default_heh.gif
 

 
Back
Top