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", 30, 30},
{"foo.nw", 10, 40},
};
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(0, this.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.