Scripting spawn points

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Post Reply
Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Scripting spawn points

Post by Moustache » June 29th, 2011, 9:53 am

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.

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Scripting spawn points

Post by IzNoGoD » June 29th, 2011, 1:16 pm

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
LMGTFY!

Its not a glitch... Its the future!

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Scripting spawn points

Post by Moustache » June 29th, 2011, 2:43 pm

What should I modify about the scripts then?
Isn't it just possible to edit the spawn logic and add the spawn in it?

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Scripting spawn points

Post by F |Madness| U » June 29th, 2011, 4:06 pm

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.
-

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Scripting spawn points

Post by Moustache » June 29th, 2011, 5:33 pm

@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.

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Scripting spawn points

Post by F |Madness| U » June 29th, 2011, 6:58 pm

If your doing a mod just add in a tiny white flash when they spawn, that way they won't see the original spawnloc.
-

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Scripting spawn points

Post by Rezil » July 3rd, 2011, 9:42 pm

You can spawn entities using spawn() but I believe actual mp spawn points cannot be spawned.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Scripting spawn points

Post by Drofder2004 » July 4th, 2011, 9:13 am

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Scripting spawn points

Post by Drofder2004 » July 4th, 2011, 10:01 am

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Scripting spawn points

Post by Moustache » July 4th, 2011, 3:56 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests