Game Development Community

Team Spawn Locations

by Joshua Shoemaker · in Torque 3D Professional · 05/30/2011 (5:38 pm) · 36 replies

Hello all,

I was wanting to know how I might be able to create different spawn locations in a level for different teams?

I used this resource to make a team selection feature.

http://www.garagegames.com/community/resources/view/18383

I have six different teams instead of two. I am usure as to how i would make a specific team spawn at a specific point, or points. It says at the end of the resource to just make a few drop points named "so and so" and put a few spawn spheres on "so and so".

How do i assign different drop points to different teams and player classes?
Page «Previous 1 2
#1
05/30/2011 (6:02 pm)
Without even looking at that link, here's a few ideas.

T3D automatically looks for default spawngroups (simGoup/Sets) in which to choose nodes.

$Game::defaultPlayerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints";

You could make multiple simSets with different names and have them chosen in the gametype preparePlayer function.

//example

   if(%team == 1)
      %playerSpawnPoint = PickPlayerSpawnPoint($Game::Team1SpawnGroups);
   if(%team == 2)
      %playerSpawnPoint = PickPlayerSpawnPoint($Game::Team2SpawnGroups);

   %game.spawnPlayer(%client, %playerSpawnPoint);
   %game.loadOut(%client.player);

--------

You could create an arrayObject with all of the spawnSpheres in a particular simGroup and then randomize them for the spawnPoint, then delete the arrayObject index to prevent conflicts/multiple uses.

--------

You could name the spawnSpheres individual and have the corresponding team and player spawn there.


... I've used all of those methods.
#2
05/30/2011 (8:43 pm)
@joshua,

it you want more than 2 teams there are a few places in that resources you need to change to allow more than two teams. If you have done that and just need to set up spawn points. Then all you have to do is create additional simgroups with the additional team names. for instance in that resource you have red and blue teams

so your have RedTeamDroppoint and blueTeamDroppoints in keeping with that example lets say our additional teams are named Yellow Green and Brown so you would create a YellowTeamDropPOint, GreenTeamDroppoints, and BrownTeamDropPoints SimGroups as per the resource. then in those simGroups you place spawnmarkers you want those teams to spawn at.


hope that helps
#3
05/30/2011 (9:52 pm)
@Donald, that is what I tried, however, the player just spawns at the same place everytime. At the Default Player Spawn. Which i cannot delete. (thankyou for your help)
#4
05/30/2011 (10:21 pm)
@joshua can you get the player to spawn at proper spawns when just using 2 teams?
#5
05/30/2011 (11:13 pm)
i didnt test the script with two teams. But i am very certain i have the teams set up properly. All the other functions seem to work properly.

this is what im doing, tell me if im wrong. I go onto the level, create a folder and name it has RedTeamDropPoints and make a spawn sphere, and put it in the folder. ("Red" is just an example name, not the one i actually used) Then i do that with the other teams.
#6
05/31/2011 (6:30 am)
if you are using different names did you change the script to look for the name you have changed?

#7
05/31/2011 (10:34 am)
Yes i changed the names in the script.

Now when i start game the player is already spawned. I dont know if is he is already on a team or what, but i know he's no supposed too. So i think i messed up the observer drop points too.

Sorry for the trouble, im just lost.
#8
05/31/2011 (7:11 pm)
okay, did you get the base team resource working properly before modifying the teamnames?
#9
05/31/2011 (8:25 pm)
I just went straight to modifying it.

I thought i understood it enough to get it to work. Before i completely start over, what areas in the script control the spawning (in case i missed any) because.

Not to sound stubborn or like i know what im doing (obviously i don't) but im sure that the teams are set up properly. The reason i think this, is because when i open up the GUI chracter select screen by pressing "m" and then select to choose a team, i die and it says that the visitor has switched to the blah blah side. It wouldnt do that if if it didnt switch teams and they werent set up properly, right?

If so then ill just go ahead and try the original resource.
#10
06/01/2011 (11:36 am)
actually you can get that message and the team not switch.


#11
06/01/2011 (1:58 pm)
Well that sucks. My animator just got done with some animations so im gonna put my custom characters into the script to see for sure it the teams are set up properly or not. SO i know if that is my problem.

But looking at Steve's example

if(%team == 1)
%playerSpawnPoint = PickPlayerSpawnPoint($Game::Team1SpawnGroups);
if(%team == 2)
%playerSpawnPoint = PickPlayerSpawnPoint($Game::Team2SpawnGroups);

%game.spawnPlayer(%client, %playerSpawnPoint);
%game.loadOut(%client.player);



how would i set this up to work with the resource. Like i would go into gameDM.cs create a new function like



function DeathMatchGame : : preparePlayer (%whatgoeshere, %whatgoeshere)
{

if(%team == 1)
%playerSpawnPoint = PickPlayerSpawnPoint($Game::Team1SpawnGroups);
if(%team == 2)
%playerSpawnPoint = PickPlayerSpawnPoint($Game::Team2SpawnGroups);

%game.spawnPlayer(%client, %playerSpawnPoint);
%game.loadOut(%client.player);
}


is that the basic setup. (Except for the (%..., %.....) i have no clue what would go there. )

Would that be able to work, if my teams are set up properly of course? (sorry i wont be so suborn once i implement my custom characters)
#12
06/01/2011 (8:44 pm)
Was finally able to make sure that i messed the teams up. So im gonna start over with just using the stock resource for now.


EDIT: Still no luck with the spawns. The only thin i changed about the script this time were the player shapes. O had to change them to the stock T3D 1.1 shapes.
#13
06/01/2011 (11:20 pm)
so, with the stock resource you can get teams to work?

#14
06/02/2011 (11:47 am)
No, it still does the same thing. IDK what it could be now?
#15
06/02/2011 (12:42 pm)
okay here is something to try, spawn your player, then in console see what team that player is on.

usually I type in the id of the player like this <Id>.team.teamid

see if anything is being populated in the team or teamid
#16
06/02/2011 (1:07 pm)
I've not followed the teams Resource, opted instead for a custom solution. I don't really remember why, but for some reason instead of spawning the player from preparePlayer() I did the team selection, and then called spawnPlayer() after a onPlayerJoinTeam() callback.

Definitely go through and track the passing of your team parameter. Echo it out to the console at all stages so you can verify that your code is reading the right name once you start reading the spawn marker groups.
#17
06/02/2011 (3:33 pm)
@donald, the console is showing that i am switching teams. So i guess there isnt a problem with the teams.

@michael, ill try to do so. I look through the code so much trying to see the problem anyway.
#18
06/02/2011 (4:25 pm)
@Joshua, so your player.teamid.team is changing? thats good. then the issue is with the spawners,

make sure you have a simgroup named RedTeamDropPoints and BlueTeamDropPoints make sure capitalization is same as whats in your code.
#19
06/02/2011 (4:58 pm)
The sim groups are named accordingly, but stil it is messed up.

Is there any thing i need to do to the spawn points, or do i just put them in the simgroup?
#20
06/02/2011 (5:45 pm)
Quote:
Is there any thing i need to do to the spawn points, or do i just put them in the simgroup?
Unless you've significantly modified the code, spawn points/markers always go inside a SimGroup.
Page «Previous 1 2