View Single Post
  #9  
Old 11-03-2001, 07:27 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
NPC Code:
if (playerenters) {
for (command1; flag; command2) {
Stuff;
}
}


If you run that in a script, command1 will be run, then while flag is true, stuff and command2 will be run. It would be the same as
NPC Code:
if (playerenters( {
command1;
while (flag) {
Stuff;
command2;
}
}


An example for moving a NPC:
NPC Code:
if (whatever) {
setcharani walk,;
for (this.destx = x+5; x<this.destx; x+= 0.5) {
sleep 0.05;
}
setcharani idle,;
}


Or killing all the policemen:
NPC Code:
if (weaponfired) {
for (i=0; i<playerscount; i++) {
if (strequals(#g(i),Police)) hitplayer i,40,x,y;
}
}

Reply With Quote