• 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.
[-] The following 5 users say Thank You to master131 for this post:
  • d0h!, Nekochan, Pozzuh, Romuald27, rotceh_dnih
  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++ programmer. 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
[-] The following 1 user says Thank You to iBanana for this post:
  • Yamato
  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++ programmer. 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 2,640 10-29-2013, 07:22
Last Post: xInfinity.
  Custom xanims DidUknowiPwn 8 1,558 08-28-2013, 08:17
Last Post: RaZ
  Help Make ac130 shoot custom bullets Ra3shed 0 566 07-23-2013, 13:02
Last Post: Ra3shed
  [Tutorial] Custom gametype HUD iAegle 17 4,705 07-14-2013, 01:16
Last Post: Nekochan
Video Custom Facepaints? Cuddlyedits 5 988 07-01-2013, 14:58
Last Post: iPaddie
  Help dedicated servers and custom dvars mattyman 0 614 06-22-2013, 07:33
Last Post: mattyman
Information [Tutorial] Adding DLC Maps as Custom Maps. Nekochan 151 41,923 05-25-2013, 01:05
Last Post: Nero Z zero
  QS Mod by GeKKo v 6.5 with Custom Maps GeKKoFL0X 35 12,814 05-21-2013, 19:30
Last Post: [HARD] Tony.
  [Request] custom gun mod ColorCorrects 2 869 05-18-2013, 22:19
Last Post: mitchhacker
  Custom load screen mw3? balakent 4 1,161 05-04-2013, 14:48
Last Post: Nekochan

Forum Jump:


Users browsing this thread: 1 Guest(s)