View Single Post
  #2  
Old 03-17-2010, 12:08 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
I suggest putting it in a DBNPC since you're in a hurry. Doing so might be kinda ugly but eliminates a range of possible errors.

You can define the array of locations like this:
PHP Code:
this.locations = {
  {
"test.nw"3030},
  {
"foo.nw"1040},
}; 
The array indeces range from 0 to array size - 1, so you'd generate a random index like this:
PHP Code:
temp.index int(random(0this.locations.size())); 
This will work regardless of how many locations you've put into the array.

I think warpto() is what you use for NPCs.
PHP Code:
temp.newLocation this.locations[temp.index];
this.warpto(temp.newLocation[0], temp.newLocation[1], temp.newLocation[2]);
echo(
this.name " warped to " temp.newLocation); 
I think the rest of the code you posted should work.

Last edited by DrakilorP2P; 03-17-2010 at 12:11 AM.. Reason: Corrected error.
Reply With Quote