I still cannot get it to send triggeraction to the control-NPC :/
NPC Code:
if (actionswordhit && !strtofloat(#p(1))==playerid) {
setarray this.attack,5;
setstring client.lastattacker,#p(2);
setstring client.lastexp,#p(3);
this.attack[0] = int(strtofloat(#p(0))%255);
this.attack[1] = int(strtofloat(#s(client.def))%255);
this.attack[2] = abs(this.attack[0]-this.attack[1]);
this.attack[3] = abs(int(random((this.attack[2]/15),this.attack[2])));
this.attack[4] = int(random(0,2));
if (!this.attack[4]==1) {
showimg 1,@FixedSys@MISS,playerx,playery+2;
showimg 2,@FixedSys@MISS,playerx+.1,playery+2+.1;
changeimgcolors 2,0,0,0,0;
//changeimgcolors 1,1,.34,.34,1;
changeimgvis 1,2;
changeimgvis 2,1;
sleep .25;
hideimg 1;
hideimg 2;
} else {
setani hurt,;
hurt 0;
showimg 1,@FixedSys@#v(this.attack[3]),playerx,playery+2;
showimg 2,@FixedSys@#v(this.attack[3]),playerx+.1,playery+2+.1;
changeimgcolors 2,0,0,0,0;
//changeimgcolors 1,1,.34,.34,1;
changeimgvis 1,2;
changeimgvis 2,1;
setstring client.player_hp,#v(strtofloat(#s(client.player_hp ))-this.attack[3]);
if (strtofloat(#s(client.player_hp))<=0) {
this.expinc = strtofloat(#s(client.player_exp))/8+int(random(4,10));
triggeraction 0,0,servercheck,#v(this.expinc),#s(client.lastatta cker);
setstring client.player_hp,0;
setplayerprop #c,Dead!;
sleep .1;
playerhearts = 0;
} else {
playerhearts = 3;
}
sleep .25;
hideimg 1;
hideimg 2;
}
}
That is the entire section which basically controls player damage. I'm pretty sure its not as clean as what it could or should be, but complain about something else :/