Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 61 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Different tdm spawns for each team
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 03:46 am
I know that it is impossible, but I was thinking, can this be "cheated" in a sense?My thought is this:

There's only one tdm spawn, and it is inside a trigger_multiple, so when you spawn there, based on what team you are on, it will teleport you to one of the specified places.

Like
Code:

if(other.pers["team"] == "allies")
{
choose randomly between the possible allie-designated script_origins
}
else if(other.pers["team"] == "axis")
{
choose randomly between the possible axis-designated script_origins
}


I know I'll need to edit the basic teleport script but is it possible? And how would I do it?

edited on Feb. 5, 2009 10:49 pm by clanhelio
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 10:09 am
Unfortunately you need to have enough spawns for the number of players your map will support (trying to spawn 20 players at the same point at the same time is not a good idea!)

The thing is that spawnpoints are just used as coordinates for the gametype scripts so you could create a list of coordinates.

Another alternative is to create your own spawnpoints by editing the cod2.def file in the bin folder (not sure if this is the correct way to do it as normally the spawns are defined in the gametype scripts).

If you open the cod2.def file in notepad and add this to the end of the file.
Code:


/*QUAKED mp_tdm_spawn_axis (0.5 0.0 1.0) (-16 -16 0) (16 16 72)
Axis players spawn away from enemies and near their team at one of these positions.*/


/*QUAKED mp_tdm_spawn_allies (0.0 0.5 1.0) (-16 -16 0) (16 16 72)
Allied players spawn away from enemies and near their team at one of these positions.*/


In radiant you will then get a choice of two extra spawns as so:



Then you can modify the spawning in the tdm.gsc file - located in the spawnPlayer() function.

Find this section:
Code:
spawnpointname = "mp_tdm_spawn";
spawnpoints = getentarray(spawnpointname, "classname");
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(spawnpoints);


And change to something like this (untested)
Code:
spawnpointname = "mp_tdm_spawn_" + self.pers["team"];
spawnpoints = getentarray(spawnpointname, "classname");

if(spawnpoints.size > 0) // checks there are some valid spawnpoints
{
   spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(spawnpoints);
}
else // if there aren't, use a normal tdm spawn.
{
   spawnpointname = "mp_tdm_spawn";
   spawnpoints = getentarray(spawnpointname, "classname");
   spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(spawnpoints);
}


let us know how you get on!



edited on Feb. 6, 2009 05:12 am by Pedro699
Share |
Garthogg
General Member
Since: Jan 29, 2008
Posts: 21
Last: Feb 6, 2009
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 08:58 pm
It would be great for zombie mod, to spawn the zombies and the hunters to diferent places.
Well i have a server, so if i add this script, can players spawn on another maps where the editors had used simple tdm_spawn:))?
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 09:12 pm
No, unless the map includes the new spawns then it will fall back to the default mp_tdm_spawn.
Share |
tomalla
General Member
Since: Jan 16, 2007
Posts: 393
Last: Jun 10, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 11:02 pm
Isn't that possible to use Search&Destroy spawnpoints instead? THey already are divided on "axis" and "allies", so where's the problem? Where's the point of creating another set of spawn types?

edited on Feb. 6, 2009 06:03 pm by tomalla
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 11:41 pm
Yep, good plan - you could easily use the sd spawn points.

Only issue is that the place you want the teams to spawn for s&d might not be the same as that for the modified tdm gametype.

If your map is not going to support S&D however then it should be fine.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 7, 2009 06:13 am
So...can I trick the game to think it's a team death match by using sd spawnpoints, because I'm trying to do this with the zombie gametype in mind?
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 7, 2009 08:30 am
And it is possible at all to have one trigger randomly choose a script_origin for you to teleport to?
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Feb. 7, 2009 10:45 am
If you want to use the S&D spawnpoints instead, you need to change the spawnlogic in the gametype to something like:

Code:

if(self.pers["team"] == "allies")
   spawnpointname = "mp_sd_spawn_attacker";
else
   spawnpointname = "mp_sd_spawn_defender";

spawnpoints = getentarray(spawnpointname, "classname");

if(spawnpoints.size > 0) // checks there are some valid spawnpoints
{
   spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(spawnpoints);
}
else // if there aren't, use a normal tdm spawn.
{
   spawnpointname = "mp_tdm_spawn";
   spawnpoints = getentarray(spawnpointname, "classname");
   spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(spawnpoints);
}


If you want to random pick an entity from an array of entity you can do something like this:

Code:

entityArray = getentarray("myEntities","targetname"); // gets array of the 'myEntities' items in map

if(entityArray.size > 0) // check there are entities in the map
{
   randomId = randomint(entityArray.size); // picks number from 0 to (array size - 1)
   
   chosenEntity = entityArray[randomId]; // reassign the chosen entity
   
   iprintln("Chosen an entity. Origin: " + chosenEntity.origin + " Angles: " + chosenEntity.angles); // print out some info
}
else
{
   iprintln("There are no entities available");
}




Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 7, 2009 07:25 pm
It worked pedro, thanks a lot![rocking]

edited on Feb. 7, 2009 02:28 pm by clanhelio
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»