Game Development Community

Team Based Games / Multiple Player Classes

by Dashiva · in Torque 3D Beginner · 10/21/2012 (6:24 pm) · 8 replies

So I'm to the point where I need to start coding something in Torque. Most of the default things in the FPS tutorial work for my use case. However the first thing I need to implement is teams with different player classes. Each of the two teams needs to have 4 different player classes each with a different weapons loadout. I assume I'll just have to figure out a way to cycle between player datablocks, or make them choose-able from a menu.

My question is, are there any resources that would have something like this in them?

#1
10/21/2012 (9:34 pm)
Yes, there are several Resource that do that. They generally create a chain of player datablocks selectable from a GUI. Here is a simple one... even though it could be done a bit more elegantly.
#2
10/21/2012 (9:41 pm)
Here's two more resources that might be helpful to you, and the 2nd one would help make the resource Michael posted more elegant.

Teams, Classes, and Scoreboard:
www.garagegames.com/community/resources/view/19447

3D Character Selection Screen:
www.garagegames.com/community/resources/view/21182
#3
10/21/2012 (9:56 pm)
Ahh thanks, that's what I was looking for. Just couldn't seem to find it.
#4
10/21/2012 (10:40 pm)
Also, I need to have something where I will be able to revive a dead player, like with medic shock paddles. Are there any resources for that?
#5
10/22/2012 (1:36 pm)
Hmm I've looked for that one as well but haven't really seen it before. I'm not the best at scripting but I think a possible method would be to create the item and make its range however far you want the player to be saveable from and fire a projectile. Make a check to see if the projectile has hit a dead player object. If it does hit one then get the name of the player whose body this is and delete the dead body and spawn the player again. Again I'm not very capable at scripting but this is the method I would try.
#6
10/26/2012 (10:29 am)
@Krystian: You could just do a containerRaycast and avoid the projectile all together. A simple bit here:

function doRevive(%sender) {
   %range = 5; //set to whatever here...
   %pos = %sender.getEyePoint();
   %vec = %sender.getEyeVector();
   %targetpos = vectoradd(%pos, vectorscale(%vec, %range));
   %obj = containerraycast(%pos, %targetpos, $TypeMasks::PlayerObjectType, %sender);
   %target = getword(%obj, 0);
   //test here
   if(isObject(%target) && %target.getState() $= "dead") {
      //revive me!
   }
   else {
      //do nothing!
   }
}

Pretty simple and basic, hope it helps!
#7
10/26/2012 (12:21 pm)
That's interesting. Now, this is a more complex question. Would there be a way to convert projectile weapons like machine guns to use raycast/hitscan instead of firing projectiles and still benefit from the network heuristics?
#8
11/07/2012 (8:42 pm)
Not quite sure... Not that I'd want to do that anyways, I still benefit from Projectile::onCollision. My point here was just that you can avoid using up some datablocks by means of easier function calls that were meant to be used by situations like these ;)