ItsMods
[Release] Custom Spawnpoints - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: [Release] Custom Spawnpoints (/Thread-Release-Custom-Spawnpoints.html)



Custom Spawnpoints - master131 - 09-02-2011

Create a file, let's call it _cspawn.gsc.

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! Superman


RE: Custom Spawnpoints - Nekochan - 09-02-2011

code from aiw2.0
Quote:createSpawnpoint( classname, origin, yaw )
{
spawnpoint = spawn( "script_origin", origin );
spawnpoint.angles = (0,yaw,0);

if ( !isdefined( level.extraspawnpoints ) )
level.extraspawnpoints = [];
if ( !isdefined( level.extraspawnpoints[classname] ) )
level.extraspawnpoints[classname] = [];
level.extraspawnpoints[classname][ level.extraspawnpoints[classname].size ] = spawnpoint;
}
works in BO too


RE: Custom Spawnpoints - JariZ - 09-02-2011

This is very useful, gonna use it 4 sure Awesome


RE: Custom Spawnpoints - iBanana - 09-02-2011

(09-02-2011, 14:23)Se7en Wrote: code from aiw2.0
Quote:createSpawnpoint( classname, origin, yaw )
{
spawnpoint = spawn( "script_origin", origin );
spawnpoint.angles = (0,yaw,0);

if ( !isdefined( level.extraspawnpoints ) )
level.extraspawnpoints = [];
if ( !isdefined( level.extraspawnpoints[classname] ) )
level.extraspawnpoints[classname] = [];
level.extraspawnpoints[classname][ level.extraspawnpoints[classname].size ] = spawnpoint;
}
works in BO too

HAHAHAHAHHA


RE: Custom Spawnpoints - Nekochan - 09-02-2011

(09-02-2011, 16:50)iBanana Wrote:
(09-02-2011, 14:23)Se7en Wrote: code from aiw2.0
Quote:createSpawnpoint( classname, origin, yaw )
{
spawnpoint = spawn( "script_origin", origin );
spawnpoint.angles = (0,yaw,0);

if ( !isdefined( level.extraspawnpoints ) )
level.extraspawnpoints = [];
if ( !isdefined( level.extraspawnpoints[classname] ) )
level.extraspawnpoints[classname] = [];
level.extraspawnpoints[classname][ level.extraspawnpoints[classname].size ] = spawnpoint;
}
works in BO too

HAHAHAHAHHA

.......... xD


RE: Custom Spawnpoints - Rendflex - 09-02-2011

(09-02-2011, 16:50)iBanana Wrote: HAHAHAHAHHA

[Image: laddergoat.jpg?t=1273763815]

Oh iBanana, you so random.



RE: Custom Spawnpoints - iAegle - 09-02-2011

Code:
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);

I think you mean this? Wouldn't it be better to just spawn reall spawnpoints?


RE: Custom Spawnpoints - master131 - 09-02-2011

Woops, just realised, thanks. Fixed it.


RE: Custom Spawnpoints - dafiz - 09-24-2011

What is up with this... I'm kinda new to this and everything fucks me up. Now I have to re-install my modEdit0r