• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] Custom Spawnpoints
#1
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
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
  Reply
#2
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
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
  Reply
#3
This is very useful, gonna use it 4 sure Awesome
  Reply
#4
(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
  Reply
#5
(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
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
  Reply
#6
(09-02-2011, 16:50)iBanana Wrote: HAHAHAHAHHA

[Image: laddergoat.jpg?t=1273763815]

Oh iBanana, you so random.
  Reply
#7
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?
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

  Reply
#8
Woops, just realised, thanks. Fixed it.
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
  Reply
#9
What is up with this... I'm kinda new to this and everything fucks me up. Now I have to re-install my modEdit0r
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Black Ops 2 Custom background? jotape99 10 11,609 10-29-2013, 07:22
Last Post: xInfinity.
  Custom xanims DidUknowiPwn 8 6,649 08-28-2013, 08:17
Last Post: RaZ
  Help Make ac130 shoot custom bullets Ra3shed 0 2,552 07-23-2013, 13:02
Last Post: Ra3shed
  [Tutorial] Custom gametype HUD iAegle 17 14,155 07-14-2013, 01:16
Last Post: Nekochan
Video Custom Facepaints? Cuddlyedits 5 4,142 07-01-2013, 14:58
Last Post: iPaddie
  Help dedicated servers and custom dvars mattyman 0 2,339 06-22-2013, 07:33
Last Post: mattyman
Information [Tutorial] Adding DLC Maps as Custom Maps. Nekochan 151 137,417 05-25-2013, 01:05
Last Post: Nero Z zero
  QS Mod by GeKKo v 6.5 with Custom Maps GeKKoFL0X 35 28,633 05-21-2013, 19:30
Last Post: [HARD] Tony.
  [Request] custom gun mod ColorCorrects 2 2,921 05-18-2013, 22:19
Last Post: mitchhacker
  Custom load screen mw3? balakent 4 4,148 05-04-2013, 14:48
Last Post: Nekochan

Forum Jump:


Users browsing this thread: 1 Guest(s)