Edit: Appears I'm a couple minutes late..
For arrays inside arrays (multi-dimensional) you need to wrap { }'s around them like so:
PHP Code:
temp.array = {
{"innerarray", "member"},
{"another", "array"}
};
You can then use random, and the size of the array to pick a random array out of it.
PHP Code:
function onCreated() {
temp.examplearray = {
{"a", "b", "c"},
{"d", "e", "f"}
};
temp.randomindex = int(random(0, temp.examplearray.size()));
temp.example = temp.examplearray[temp.randomindex];
}
int(value) - Rounds the number (technically it converts it to an integer, but this is the result) to the number below it. I.e: int(3.8) = 3
random(float min, float max) - Picks a number between the minimum and maximum number, it will/should never equal the max value.
Therefore int(random(0, temp.array.size())) will return a valid index in the array.
To move NPCs you have to use warpto which accepts the same parameters as setlevel2.
warpto(str levelname, float x, float y);
When we put it altogether we get a nice little function like so:
PHP Code:
function warp() {
// Declare Locations Array
temp.locations = {
{"onlinestartlocal.nw", 30, 30},
{"someotherlevel.nw", 30, 30}
};
// Select a location
temp.location = temp.locations[int(random(0, temp.locations.size()))];
// Warpto Location
warpto(temp.location[0], temp.location[1], temp.location[2]);
// Update (Forces NPC to save changes, probably not needed but whatever)
this.trigger("NPCUpdate", "");
}