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«First 1 2 Next»
#21
06/02/2011 (5:54 pm)
yeah just put them in the simgroups
#22
06/02/2011 (6:56 pm)
Okay i did that, so I just am completely lost as to why its not working. Now i know this resource was made for 1.0. Could that be the problem?
#23
06/02/2011 (9:42 pm)
let me load it into a fresh build of 1.1


edit

okay

are you using Torision?

if you are put a break point at the following section
function pickSpawnPoint(%client)   
{   
   echo("CLIENT= " @ %client);   
   echo("CLIENT.team= " @ %client.team);   
   echo("CLIENT.team.teamname= " @ %client.team.teamname);   
   echo(%client.dump());   
      
      
   %groupName = "MissionGroup/" @ %client.team.teamname @ "TeamDropPoints";   
   %group = nameToID(%groupName);   
  
   if (%group != -1) {   
      %count = %group.getCount();   
      if (%count != 0) {   
         %index = getRandom(%count-1);   
         %spawn = %group.getObject(%index);   
         return %spawn.getTransform();   
      }   
      else  
         error("No " @ %client.team.teamname @ " team spawn points found in " @ %groupName);   
   }   
   else  
      error("Missing " @ %client.team.teamname @ " team spawn points group " @ %groupName);   
  
   // Could be no spawn points, in which case we'll stick the   
   // player at the center of the world.   
   return "0 0 300 1 0 0 0";   
}

and step through this section of code
see if you hit those errors
#24
06/02/2011 (10:28 pm)
I actually just bought Torsion today, thinking that it would be useful. im very glad i did. Il try that later today, it's 12:30 for me. Ill let you know how it turns out. Thanks for the help.
#25
06/03/2011 (5:47 am)
Okay i, a little lost as to how to use Torsion. So two questions, how do i add a break point? and two, where can i find some good torsion docs?
#26
06/03/2011 (6:39 am)
Torsion is alot like VC++, just with less features

You can Left Click in the small area to the left next to the Line
you want to put a break point...

This places a [ Red ] o (dot) on that line
At the bottom of the Screen is the Output area and a Tab for showing
currently set Break points.

As for Torsion Docs, no idea. Its pretty much like using MSVC
so I had no problems with working it out.

If your Output screen is not on the bottom, at the top
Select View->Show Output Pane

Once breakpoints setup, At the top, select Debug->Start
OR just hit (F5) to do from Keystroke
#27
06/03/2011 (7:46 am)
Okay i put in the break point, and it said that there are script errors and it wont play.
#28
06/03/2011 (8:09 am)
The output in the Log file (console.log) should give you
the line number and a section of that code from the file
that has the script error.

Look at that file and find the typo / error :)
Fix the problem then try again ..

Also the same output to the Log file is in the bottom window of torsion
And you can see the file showing where the error is...
#29
06/03/2011 (4:21 pm)
Well, there is nothing in the output window of torsion. But when i go into the console it gives this error.

Attempting to create a player for a client that already has one!
scripts/server/gameCore.cs (711): Unknown command getTransform.
Oject LocalClientConnection(4182) LocalClientConnection -> GameConnection -> GameConnection -> NetConnection -> SinGroup -> SimSet -> SimObject
#30
06/03/2011 (5:03 pm)
Sounds like you have changed the Spawn process incorrectly and
havent removed another call to spawn a player :)

Probably left one or more of the original calls in there in the
original scripts.

You have to step thru the code from where it first makes the call to
spawn a player and work from that point in both directions...

The best starting point is from that file GameCore when it prints
that error..
#31
06/03/2011 (5:09 pm)
That point in the code (Default Code)

function GameCore::spawnPlayer(%game, %client, %spawnPoint, %noControl)
{
   //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::spawnPlayer");

   if (isObject(%client.player))
   {
      // The client should not already have a player. Assigning
      // a new one could result in an uncontrolled player object.
      error("Attempting to create a player for a client that already has one!");
   }

is called from here Originally:
function GameCore::preparePlayer(%game, %client)
{
   //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::preparePlayer");

   // Find a spawn point for the player
   // This function currently relies on some helper functions defined in
   // core/scripts/spawn.cs. For custom spawn behaviors one can either
   // override the properties on the SpawnSphere's or directly override the
   // functions themselves.
   %playerSpawnPoint = pickPlayerSpawnPoint($Game::DefaultPlayerSpawnGroups);
   // Spawn a camera for this client using the found %spawnPoint
   //%client.spawnPlayer(%playerSpawnPoint);
   %game.spawnPlayer(%client, %playerSpawnPoint);

I'll let ya take it from there...

as you can see, some of the work has to be done by hand
or least can be quicker that way..
#32
06/05/2011 (5:22 pm)
But i havent changed anything in the game core. The reference im trying to implement does not touch the gamecore.
#33
06/05/2011 (7:10 pm)
If you track back from there using the Break Points and call stack
you should be able to find where you have a duplicate player object
creation.

Cant really tell ya much more without seeing the actually code.
As you have done some changes, you have to find where the issue is.
The above is the Default scripts and call order.
#34
06/05/2011 (9:13 pm)
Well I'm using the resource that was given on the link. I was using my modified version, but then admitted defeat and just went the stock resource.

And unless the resource has some errors in it then idk why its messing up. Ill look through it some more of course.



#35
08/30/2011 (3:23 pm)
I recently made a new branch of my project to work from and merged in the changes from my old branch, and I'm having the same issue (getTransform is throwing "unknown command" and it's spawning an extra player). I wasn't able to get to it last night after doing the merge, but after I tinker with it tonight and fix it I'll post back here.
#36
08/30/2011 (9:29 pm)
Update: So debugging the issue, it seems to be that some of the calls to GameConnection related functions are going to the GameConnection functions defined by the resource in scripts/server/game.cs. However some of the functions in there from the resource are calling functions (specifically spawnPlayer) that are also defined in gameCore.cs. So it goes into GameConnection::joinPlayerClass and calls %this.spawnPlayer(), which in the default resource should call the function that the resource defines. Instead, it calls the one in the GameCore package.

My hacky solution for now is to just comment out the GameConnection::spawnPlayer function. I haven't exactly spent a lot of time looking at how the game packages work (and I don't need the functionality right now) so I'll probably not be fixing it in a proper way in the near future.

TL;DR: Hacky fix is to comment out GameConnection::spawnPlayer in gameCore.cs so that the resource's spawnPlayer will be called.
Page«First 1 2 Next»