View Single Post
  #3  
Old 02-07-2004, 01:55 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Re: Posting Script

Quote:
Originally posted by Value
Here is the script for my bow, control-npc and class. Help me find the problem!!!!!
NPC Code:

//Script From Class hpfunctions
function attackplayers() {
pid = playerid;
pindexes = getnearestplayers(this.attackx,this.attacky,player id!=pid);
dist = 0;
for (i=0; i<arraylen(pindexes); i++) {
with (players[pindexes[i]]) {
dx = playerx + 1.5 - this.attackx;
dy = playery + 2 - this.attacky;
dist = (dx*dx + dy*dy)^0.5;
if (dist<=2)
hurtplayer();
}
if (dist>2)
break;
}
}
function hurtplayer() {
newhp = playerhearts - this.attackpower;
if (newhp<=0) {
newhp = 3;
setani dead,;
} else {
setani hurt,;
}
playerhearts=#v(newhp);
}
//END


playerhearts = #v(newhp); is wrong, no #v() is needed.
Reply With Quote