Inside3D!
     

Teamspawns
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
ceriux



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

PostPosted: Sun Nov 23, 2008 9:02 am    Post subject: Teamspawns Reply with quote

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
View user's profile Send private message Yahoo Messenger
CocoT



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

PostPosted: Sun Nov 23, 2008 2:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
ceriux



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

PostPosted: Sun Nov 23, 2008 7:11 pm    Post subject: Reply with quote

exactly what i want to do Very Happy thanks ill check it out and see what i cant attempt Very Happy
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
ceriux



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

PostPosted: Mon Nov 24, 2008 6:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Mon Nov 24, 2008 9:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
ceriux



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

PostPosted: Mon Nov 24, 2008 10:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
Electro



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

PostPosted: Tue Nov 25, 2008 12:39 am    Post subject: Reply with quote

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 Wink
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 Smile
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ceriux



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

PostPosted: Tue Nov 25, 2008 12:51 am    Post subject: Reply with quote

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 Smile i think im going to read this Very Happy

http://inside3d.com/showtutorial.php?id=140
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Electro



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

PostPosted: Tue Nov 25, 2008 2:21 am    Post subject: Reply with quote

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

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. Smile
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ceriux



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

PostPosted: Tue Nov 25, 2008 9:07 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
Electro



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

PostPosted: Tue Nov 25, 2008 9:17 am    Post subject: Reply with quote

Need to see your function Wink
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ceriux



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

PostPosted: Tue Nov 25, 2008 9:33 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
ceriux



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

PostPosted: Tue Nov 25, 2008 8:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Tue Nov 25, 2008 8:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Electro



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

PostPosted: Tue Nov 25, 2008 9:48 pm    Post subject: Reply with quote

...and need to make sure you have .team set to either one of those values.
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    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