
07-28-2012, 12:32 AM
|
|
Soul Reaper
|
 |
Join Date: Jul 2012
Location: Brunswick
Posts: 34
|
|
Quote:
Originally Posted by ffcmike
An easier more efficient approach would be to create a multi-dimensional array of warp coordinates:
PHP Code:
function onCreated(){
//x, y
this.warplocations = {
{5, 10},
{5, 20},
{5, 30},
{5, 40},
{15, 10},
{15, 20},
{15, 30},
{15, 40},
};
this.warpamount = this.warplocations.size();
}
And then increment an array index variable each time a player enters:
PHP Code:
function onPlayerEnters(){
player.x = this.warplocations[this.warpindex][0];
player.y = this.warplocations[this.warpindex][1];
//Use % to reset a value back to 0 if it overlaps specified value
this.warpindex = (this.warpindex + 1) % this.warpamount;
}
|
Thanks So Much! This Will Help Me A Lot In My Event(s)!  Also do u have a kickall script? if i may ask? |
|
|
|