Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Teamspawns Goto page 1, 2, 3 Next

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Nov 23, 2008 9:02 am Post subject: Teamspawns |

how would i code in two new map entities 1 being Info_team1_spawn and the 2nd being info_team2_spawn. (i would also like to add classes to each team later on using a menu) _________________ QuakeDB - Quake ModDB Group

Back to top |

CocoT Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum |

Posted: Sun Nov 23, 2008 2:25 pm Post subject: |

Respawning is handled by entity() SelectSpawnPoint in client.qc You'd need to create a spawn entity like the ones listed in "QUAKED FUNCTIONS" (look a little further ahead of entity() SelectSpawnPoint) and then make the appropriate changes in entity() SelectSpawnPoint (according to team number, for example). Now, you'll probably still want to keep some form of regular respawn point, though, so that players appear there first, then choose their team, then get respawned to the new spot.
_________________
http://www.planetcocot.net/

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Nov 23, 2008 7:11 pm Post subject: |

exactly what i want to do thanks ill check it out and see what i cant attempt _________________ QuakeDB - Quake ModDB Group

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Mon Nov 24, 2008 6:27 pm Post subject: |

so something like this?

Code:
/*QUAKED Info_allied_spawn (1 0 1) (-16 -16 -24) (16 16 24) potential spawning position for allied players */ void() Info_allied_spawn = {
};
/*QUAKED Info_axis_spawn (1 0 1) (-16 -16 -24) (16 16 24)
potential spawning position for axis players
*/
void() Info_axis_spawn =
{
};

_________________
QuakeDB - Quake ModDB Group

Back to top |

MauveBib Joined: 04 Nov 2004 Posts: 602 |

Posted: Mon Nov 24, 2008 9:37 pm Post subject: |

That will create the entities, yes, but now you need to alter the SelectSpawnPoint function to make the player actually spawn there. _________________ Apathy Now!

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Mon Nov 24, 2008 10:04 pm Post subject: |

so would i edit like this? because.... im not exactly sure what id add... so i tried editing another qc file i found some where to work with this... but i doubt it will... first in client.qc scroll down to where you find void() PutClientInServer =
{
local entity spot;
spot = SelectSpawnPoint ();
self.classname = "player";
and under
self.classname = "player";
add
self.classname = "Allied";
self.classname = "Axis";
So that it looks like this
void() PutClientInServer =
{
local entity spot;
spot = SelectSpawnPoint ();
self.classname = "player";
self.classname = "Allied"; //new team 1
self.classname = "Axis"; //new team 2
self.health = 100;
self.takedamage = DAMAGE_AIM;
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_WALK;
self.show_hostile = 0;
self.max_health = 100;
self.flags = FL_CLIENT;
self.air_finished = time + 12;
after that scroll down to about line 426 and edit like so
}
else if (deathmatch)
{
lastspawn = find(lastspawn, classname, "info_player_allied");
if (lastspawn == world)
if !(Allied)
{
lastspawn = find (lastspawn, classname, "info_player_allied");
if (lastspawn == world)
lastspawn = find (lastspawn, classname, "info_player_allied");
}
else
{
while (lastspawn.team != self.team)
{
lastspawn = find(lastspawn, classname, "info_player_axis");
if (lastspawn == world)
lastspawn = find (lastspawn, classname, "info_player_axis");
}
}
if (lastspawn != world)
return lastspawn;
}
_________________
QuakeDB - Quake ModDB Group

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Tue Nov 25, 2008 12:39 am Post subject: |

Everyone will be classname Axis with that code. You can't set classname 3 times there, it's just going to end up staying as the last one set. Use that menu system you have setup to set peoples class Then you can just have the respawns base off that class. I'd avoid changing classname as other code ties into it. Instead just make a .string class, and search for that when selectspawnpoint is called. (so basically exactly what you have there already, just change the finds to search for class strings instead of classname, and make your menus set .class
_________________
Unit reporting!
http://www.bendarling.net/

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Nov 25, 2008 12:51 am Post subject: |

hmm i want them to be assigned to specific teams though with each their own class... i wish i could get a look a teamfortress's system for it... so i can see how they set up teams with classes. you know what i think im going to read this http://inside3d.com/showtutorial.php?id=140
_________________
QuakeDB - Quake ModDB Group

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Tue Nov 25, 2008 2:21 am Post subject: |

All you need is another menu. You can change your menu to include 2 different types of menus, first team, then class. Then you have all the data you need from the player for where to spawn them. The team fortress code is available, but you don't need to look at something that is so far developed, you just need the bare basics at this stage, and it's better to see why things work the way they do.
That tutorial you linked by Koolio would be a good start, definitely.
_________________
Unit reporting!
http://www.bendarling.net/

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Nov 25, 2008 9:07 am Post subject: |

hmm... iv gotten this far... http://inside3d.com/showtutorial.php?id=143 and it compiles and plays, but when i spawn as either team it aways repspawns me at the info_player_start which is required to play in any map... edit: i also changed it to where it looks for info_player_allied/or axis
_________________
QuakeDB - Quake ModDB Group

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Tue Nov 25, 2008 9:17 am Post subject: |

Need to see your function _________________ Unit reporting! http://www.bendarling.net/

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Nov 25, 2008 9:33 am Post subject: |

i believe this is it.

Code:
if ((deathmatch) && (self.team == TERROR_TEAM)) // <-- changed that { spot = lastspawn; while (1) {
spot = find(spot, classname, "info_player_allied");
if (spot != world)
{
if (spot == lastspawn)
return lastspawn;
pcount = 0;
thing = findradius(spot.origin, 32);
while(thing)
{
if (thing.classname == "player")
pcount = pcount + 1;
thing = thing.chain;
}
if (pcount == 0)
{
lastspawn = spot;
return spot;
}
}
}
}
else if ((deathmatch) && (self.team == COUNTER_TEAM)) // <-- changed that
{
spot = lastspawn;
while (1)
{
spot = find(spot, classname, "info_player_axis");
if (spot != world)
{
if (spot == lastspawn)
return lastspawn;
pcount = 0;
thing = findradius(spot.origin, 32);
while(thing)
{
if (thing.classname == "player")
pcount = pcount + 1;
thing = thing.chain;
}
if (pcount == 0)
{
lastspawn = spot;
return spot;
}
}
}
}
if (serverflags)
{ // return with a rune to start
spot = find (world, classname, "info_player_start2");
if (spot)
return spot;
}
spot = find (world, classname, "info_player_start");
if (!spot)
error ("PutClientInServer: no info_player_start on level");
return spot;
};
/*

_________________
QuakeDB - Quake ModDB Group

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Nov 25, 2008 8:17 pm Post subject: |

sorry for double post, but has anyone seen where i might have screw'd up? or if i even have? according to what iv read each team should spawn at its own spawn point and only spawn at the info_player_start if its on co-op mode when creating a server.
iv been hosting it to test using regular Deathmatch with no other options no ff ect. but aslong as its in deathmatch mode i should spawn to the corresponding player spawn.
_________________
QuakeDB - Quake ModDB Group

Back to top |

r00k Joined: 13 Nov 2004 Posts: 483 |

Posted: Tue Nov 25, 2008 8:28 pm Post subject: |

Code:
entity(string cname) SelectSpawnPoint = { local entity spot, e; local float f; spot = lastspawn;
while (1)
{
spot = find(spot, classname, cname);
f = 0;
if (spot != world)
{
if (spot != self.trigger_field)
{
e = findradius (spot.origin, 32);
while (e)
{
if (e.classname == "player")
{
e = world;
f = 1;
}
else
{
e = e.chain;
}
}
}
else
{
f = 1;
}
if (f == 0)
{
lastspawn = spot;
return (spot);
}
}
}
return (lastspawn);
};

then in PutClientInServer

Code:
if (self.team == TERROR_TEAM) spot = SelectSpawnPoint ("Info_axis_spawn"); else if (self.team == COUNTER_TEAM) spot = SelectSpawnPoint ("Info_allied_spawn");
ect...

Note: You MUST have your spawn points ENTITIES added to the .bsp

Back to top |

Electro Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia |

Posted: Tue Nov 25, 2008 9:48 pm Post subject: |

...and need to make sure you have .team set to either one of those values. _________________ Unit reporting! http://www.bendarling.net/

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT Goto page 1, 2, 3 Next
Page 1 of 3

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group