attachrid killedrid & killerrid assigning temp character variable

Zirius

New member
Messages
261
Points
0
Hello! I am trying to code a PVP script and wants to make use of streak counting. Basically, the streak is incremented when you kill a char, and resets to 0 when you got killed. So if I understand correctly, the code should *basically* follows:
 

OnPCDieEvent: attachrid killedrid; set @char,0; <~~~~ (1) attachrid killerrid; set @char,@char+1; <~~~~ (2)end; 
(1) Does "attachrid killedrid;" means, any character variable declaration will go to the character of killed char?
(2) Does "attachrid killerrid;" means, any character variable declaration will go to the killer?
 
Because I tried to do the above but I am having undesirable result.

 
use onpcdie to set @char,0; and use onpckillevent to increase @char count

 
yup

this one, when the character died, the streak is reset

as long as the player die, for what ever reason, the streak is reset

- script kjdhfkjdshf -1,{OnPCKillEvent: if ( killedrid == getcharid(3) ) end; @streak++; dispbottom "you killed "+ rid2name( killedrid ) +". streak count "+ @streak; end;OnPCDieEvent: @streak = 0; dispbottom "your current streak count "+ @streak; end;}..

.

this one, when the character die from player's hand, the streak is reset

die from other means such as suicide, killed by non-human players doesn't count

Code:
-	script	skdfjhskdf	-1,{OnPCKillEvent:	if ( killedrid != getcharid(3) ) {		@streak++;		dispbottom "you killed "+ rid2name( killedrid ) +". streak count "+ @streak;	}	attachrid killedrid;	@streak = 0;	dispbottom "your current streak count "+ @streak;	end;}
 
Last edited by a moderator:
LOL. I needed to remove the "attachrid xxx" in my script, don't know how they works, but without them the undesirable results had been removed.

 
Back
Top