View Single Post
  #2  
Old 04-13-2003, 02:59 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
well, if you do a for loop to index all the npcs, it will include all the npcs. ( I dont know what you mean, 'max' ).

This is an example, of using a for loop with npcs[index]

NPC Code:

//#CLIENTSIDE
if (created) {
speed = 1;
timeout = .05;
}
if (timeout){
for (i=0;i<npcscount;i++){
dx = npcs[i].x - playerx;
dy = npcs[i].y - playery;
dist = (dx*dx+dy*dy);
newx = (dx/dist)*speed;
newy = (dy/dist)*speed;
npcs[i].x += newx;
npcs[i].y += newy;
}
timeout = .05;
}




Thats just an example of how to use it. (npcs move away from player)

help at all?
__________________
Former Global Scripting Team Member


Reply With Quote