Thread Rating:
  • 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 12,524 10-29-2013, 07:22
Last Post: xInfinity.
  Custom xanims DidUknowiPwn 8 7,109 08-28-2013, 08:17
Last Post: RaZ
  Help Make ac130 shoot custom bullets Ra3shed 0 2,747 07-23-2013, 13:02
Last Post: Ra3shed
  [Tutorial] Custom gametype HUD iAegle 17 15,423 07-14-2013, 01:16
Last Post: Nekochan
Video Custom Facepaints? Cuddlyedits 5 4,605 07-01-2013, 14:58
Last Post: iPaddie
  Help dedicated servers and custom dvars mattyman 0 2,537 06-22-2013, 07:33
Last Post: mattyman
Information [Tutorial] Adding DLC Maps as Custom Maps. Nekochan 151 156,825 05-25-2013, 01:05
Last Post: Nero Z zero
  QS Mod by GeKKo v 6.5 with Custom Maps GeKKoFL0X 35 30,848 05-21-2013, 19:30
Last Post: [HARD] Tony.
  [Request] custom gun mod ColorCorrects 2 3,193 05-18-2013, 22:19
Last Post: mitchhacker
  Custom load screen mw3? balakent 4 4,567 05-04-2013, 14:48
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.