Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Custom Spawnpoints
09-02-2011, 14:08 (This post was last modified: 09-02-2011 23:21 by master131.)
Post: #1
Custom Spawnpoints
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
Related links

[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Find all posts by this user
Add Thank You Quote this message in a reply
[-] The following 5 users say Thank You to master131 for this post:
d0h! (09-02-2011), Pozzuh (09-02-2011), Romuald27 (09-02-2011), rotceh_dnih (09-02-2011), SailorMoon (09-02-2011)
09-02-2011, 14:23
Post: #2
RE: Custom Spawnpoints
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

Steam: jaydi2112
[Image: userbar7q.gif]
[Image: 45296.png]
[Image: 3OM7E.gif]
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
09-02-2011, 16:38
Post: #3
RE: Custom Spawnpoints
This is very useful, gonna use it 4 sure Awesome

[Image: k5sVYyb.gif]
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
09-02-2011, 16:50
Post: #4
RE: Custom Spawnpoints
(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
Related links

Find all posts by this user
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to iBanana for this post:
Yamato (09-25-2011)
09-02-2011, 17:20
Post: #5
RE: Custom Spawnpoints
(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

Steam: jaydi2112
[Image: userbar7q.gif]
[Image: 45296.png]
[Image: 3OM7E.gif]
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
09-02-2011, 17:56
Post: #6
RE: Custom Spawnpoints
(09-02-2011 16:50)iBanana Wrote:  HAHAHAHAHHA

[Image: laddergoat.jpg?t=1273763815]

Oh iBanana, you so random.
Find all posts by this user
Add Thank You Quote this message in a reply
09-02-2011, 19:06
Post: #7
RE: Custom Spawnpoints
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
Find all posts by this user
Add Thank You Quote this message in a reply
09-02-2011, 23:22
Post: #8
RE: Custom Spawnpoints
Woops, just realised, thanks. Fixed it.
Related links

[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Find all posts by this user
Add Thank You Quote this message in a reply
09-24-2011, 10:30
Post: #9
RE: Custom Spawnpoints
What is up with this... I'm kinda new to this and everything fucks me up. Now I have to re-install my modEdit0r
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Custom Controllable sentry tonymamoni1 0 314 09-22-2012 02:15
Last Post: tonymamoni1

Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Media Embeding by Simple Audio Video Embeder