Page 1 of 1

Scripting spawn points

Posted: June 29th, 2011, 9:53 am
by Moustache
For my mod I am trying to script extra spawn points. Because some times people spawn in to each other. I know how to script spawn points but I don't know how to add them to the rest of the tdm spawn points so they can be used by the original script.

If anyone needs more info ask it here :)
I hope someone can help me.

Re: Scripting spawn points

Posted: June 29th, 2011, 1:16 pm
by IzNoGoD
Try to look through the original cod spawnpoint functions that are loaded at the gamestart:

Code: Select all

 
        spawnpointname = "mp_tdm_spawn";
        spawnpoints = getentarray(spawnpointname, "classname");
This means, that if you would like extra spawnpoints, you would need to either modifiy all the gscs or be able to change the classname of stuff spawned from script. Only the modifying of gscs is possible :) have fun with your new hobby

Re: Scripting spawn points

Posted: June 29th, 2011, 2:43 pm
by Moustache
What should I modify about the scripts then?
Isn't it just possible to edit the spawn logic and add the spawn in it?

Re: Scripting spawn points

Posted: June 29th, 2011, 4:06 pm
by F |Madness| U
I think what KS said should work, I think if you move the player to a certain position as soon as they spawn, they shouldn't see the original position on their screen.

Re: Scripting spawn points

Posted: June 29th, 2011, 5:33 pm
by Moustache
@KillerSam
Thank you :)
I already know how to script those fake spawn point, but not how to script real spawn point. But it isn't possible so I will try a few things and if I still can't fix it I will ask it here.
F |Madness| U wrote:I think what KS said should work, I think if you move the player to a certain position as soon as they spawn, they shouldn't see the original position on their screen.
No they will see that.

Re: Scripting spawn points

Posted: June 29th, 2011, 6:58 pm
by F |Madness| U
If your doing a mod just add in a tiny white flash when they spawn, that way they won't see the original spawnloc.

Re: Scripting spawn points

Posted: July 3rd, 2011, 9:42 pm
by Rezil
You can spawn entities using spawn() but I believe actual mp spawn points cannot be spawned.

Re: Scripting spawn points

Posted: July 4th, 2011, 9:13 am
by Drofder2004
Rezil wrote:You can spawn entities using spawn() but I believe actual mp spawn points cannot be spawned.
Spawnpoints in mapping are just placeholder entities, the problem is that they are initiated before the game starts, so adding to them MUST be done prior to the initiated spawns, but I do not believe it is impossible to add spawns.

Gonna go test a quick theory.

Re: Scripting spawn points

Posted: July 4th, 2011, 10:01 am
by Drofder2004
You do not NEED any spawnpoints...
You just need to override the spawnpoint callback with your own thread.

Code: Select all

level.onSpawnPlayer = ::newSpawn;

Code: Select all

newSpawn()
{
        locs = customSpawnLogic();
        self spawn( locs[0], locs[1] );
}
 
customSpawnLogic()
{
        locs = [];
        locs[0] = (randomintrange(0, 100),randomintrange(0, 100),randomintrange(0, 100));
        locs[1] = (randomintrange(0, 100),randomintrange(0, 100),randomintrange(0, 100));
        return locs;
}
The 'custom spawn logic' is just an example to show that spawn points do not need to be predefined.
You could easily create an array of many, many spawnpoints and then create a logic to choose which spawn is required.

Re: Scripting spawn points

Posted: July 4th, 2011, 3:56 pm
by Moustache
Drofder2004 wrote:You do not NEED any spawnpoints...
You just need to override the spawnpoint callback with your own thread.

Code: Select all

level.onSpawnPlayer = ::newSpawn;

Code: Select all

newSpawn()
{
        locs = customSpawnLogic();
        self spawn( locs[0], locs[1] );
}
 
customSpawnLogic()
{
        locs = [];
        locs[0] = (randomintrange(0, 100),randomintrange(0, 100),randomintrange(0, 100));
        locs[1] = (randomintrange(0, 100),randomintrange(0, 100),randomintrange(0, 100));
        return locs;
}
The 'custom spawn logic' is just an example to show that spawn points do not need to be predefined.
You could easily create an array of many, many spawnpoints and then create a logic to choose which spawn is required.
Yea I already had something like that. But then used as external spawn points and not for replacing all spawns. But that is indeed a smart thing to do :) Thanks you for your help, I am going to try it.