Create a file, let's call it _cspawn.gsc.
Now, add this code:
Of course, you replace (123, 456, 789) with your own co-ordinates of course. To add more spawn points simply add the array index by 1 and add more co-ordinates. In the example, it would only work for Array but to add more maps, just add this:
Then, using a file such as _rank.gsc which is called by default by the game, you add this line into _rank.gsc's init function:
level thread maps\mp\whatever\_cspawn::init();
That will load all your custom spawn points into the game.
And that's it!
Now, add this code:
Code:
init()
{
level.cspawn["mp_array"] = [];
level.cspawn["mp_array"][0] = (123, 456, 789);
level.cspawn["mp_array"][1] = (123, 456, 789);
level.cspawn["mp_array"][2] = (123, 456, 789);
level.mName = getDvar("mapname");
level thread hookOnPlayerConnect(); //Make sure to keep this line
}
hookOnPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread hookOnPlayerSpawned();
}
}
hookOnPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
wait 0.1;
self setOrigin(level.cspawn[level.mName][randomInt(level.cspawn[level.mName].size)]);
}
}
Of course, you replace (123, 456, 789) with your own co-ordinates of course. To add more spawn points simply add the array index by 1 and add more co-ordinates. In the example, it would only work for Array but to add more maps, just add this:
Code:
level.cspawn["mp_mapnamehere"] = [];
level.cspawn["mp_mapnamehere"][0] = (123, 456, 789);
//etc.
Then, using a file such as _rank.gsc which is called by default by the game, you add this line into _rank.gsc's init function:
level thread maps\mp\whatever\_cspawn::init();
That will load all your custom spawn points into the game.
And that's it!
A casual conversation between barata and I about Nukem.