Teams Implementation
by Xavier "eXoDuS" Amado · 03/07/2002 (3:30 pm) · 140 comments
Well, in this tutorial I'll help you implement teams in your game, I've seen some bad implementations of this, I'm not telling that mine is the best but it's not bad for sure :)
Part 1: Adding basic team support
Ok the first and most important part of making teams is setting each player a team variable which stores which team he is in. At first i thought doing this by adding the variable to the player class (lots of ppl thought the same thing) but I found out that the player class is deleted when you die and is then re-created. So I looked for something relating to the player that isn't deleted, well you might have guessed it, the GameConnection class that is.
So what i did was add a joinTeam function to my GameConnection. To do this open up Game.cs located in fps/server/scripts/game.cs and scroll to the end of the file, there add this function:
Ok I'll explain all this stuff, the first two lines checks to see if the team number is valid. I know this is a bad way of checking that but it's easy to understand and code for new people reading this, a better way would be to have a global define setting the number of teams and using that instead, sorry here. The two following lines check to see if you already are in that team, if you already are is in that team it returns false. You can use this feature to check the status of joinTeam function, if it returns false you could spawn a gui saying there was an error or something like that. The following line calls the function leaveTeam (of the GameConnection class too) which takes the player out of the team he is in, deletes the player object and resets the player's score. In the following if block we are creating the team variable inside the GameConnection class and setting it to the corresponding Team ScriptObject (I'll explain script objects later), again, this is a bad way of doing this too, but it's easy. The next block of code sends a message to all clients saying that the player joined team X and it also passes some variables we will need to catch on later.
Finally the last line spawns the new player.
Ok now let's complete this and define the leaveTeam function. After the joinTeam function you just added add this code:
Now lets define the ScriptObject for each team. ScriptObjects are like structures of data, you can have many variables inside a ScriptObject, for example name and numplayers. So if you create a ScriptObject called Team1 with those 2 members, you can access them using a syntax similar to: $Team1.name and $Team1.numPlayers.
So on the top of the game.cs file, choose a nice camping site and place your team scriptobjects there with this code:
Well here the first line resets the score, the following block sends a leave team message to all clients and the last line deletes the player object if it exists.
Ok, now we need to actually call the joinTeam function from somewhere. We will do this from a gui which lets you choose between teams. Ok so now create the gui as you wish or you can use mine which is as follows:
Ok, save that code in a new file with the name TeamSelectDlg.gui (under the directory fps/client/ui/TeamSelectDlg.gui)
Please notice that the buttons call a jointeam function passing a value, but this is not the joinTeam function we defined in game.cs, instead this function is defined in the corresponding TeamSelectDlg.cs file (under fps/client/scripts/TeamSelectDlg.cs).
And this function is like this:
Now open up commands.cs (fps/server/scripts/commands.cs) and add this function to the end of the file:
Since the GameConnection::joinTeam() function is server side and the gui is client side, we need to call this function which actually calls the server side command JoinTeam which finally calls the server side function joinTeam.
Well, before our gui works we need to add the two files to the execute list of the client side init.cs file (fps/client/init.cs)
You should see a list of exec("xxx.gui"); lines. There you will need to add two new executes:
Finally for this part, we need to bind a key to the dialog. So open up default.bind.cs and add this line to the end:
Add the same line to config.cs just in case, im not sure if it's needed tho.
Now we will want our player to start as an Observer by default, not in any team, so open up game.cs again and find the function GameConnection::onClientEnterGame()
and replace it with this one:
Ok, two things changed in this function, first there's a line which sets the player team to 0, this is because i called observer team, 0.
Then the function call to spawn a player was replaced with the observer spawn. This are 3 lines, the first one sets the camera transform matrix to the matrix returned by the pickObserverPoint() function (we will define this one later on). The second line sets the camera velocity to zero on the 3 axis's and the last line sets the controlObject to the camera (so you can move around with the camera).
Ok, now if you scroll down a bit in this file you'll find the pickSpawnPoint() function, what i did is copy this same function and modify it a bit, so after the pickSpawnPoint function ends add this new function:
Notice that this new function looks for a group called ObserverDropPoints instead of PlayerDropPoints. Ok so what's left is adding this new group for spawning the cameras. Open up the mission file you want to test this on (actually you should add this to every mis file of your game) and add the following:
This example has only 1 spawnsphere object, but you can add as many as you want, it will randomly choose one. Notice that the spawnsphere's must be beetween the SimGroup opening brace ( { ) and the end closing brace ( }; ). You can just copy the code I pasted above in your mission file and then move it with the in-game editor to the position you want it to be. I wont cover this on this tutorial tho, sorry.
Ok that's all concerning part 1 of this tutorial, you can try it now. You should enter the game being an observer, when you press the "m" key a popup will appear asking you what team you want to join to and then you should respawn but now being in that team. You wont notice any changes yet tho.
Part 2: Adding Team Spawn Points
Ok, what's a team support without being able to spawn team members at different locations? Well, that's what we are going to do now, and it's pretty simple. If you open your mission file you'll see that there's a SimGroup called PlayerDropPoints, and inside it you may have one or more spawnspheres which are chosen at random by the function pickSpawnPoint in the game.cs file (fps/server/scripts/game.cs). Well let's modify the mission file, rename the PlayerDropPoints SimGroup so that it's called something team related, for example I'm using for this example RedTeamDropPoints. Now copy the whole SimGroup "RedTeamDropPoints" and paste it after the existing one, now rename the second copy to BlueTeamDropPoints. You should end with something like this:
In the example code I'm only using one spawnsphere per SimGroup, you can add as many as you want. You might also want to change the position of the spawnspheres, do this changing the coordinates in the code above or by entering the game using the in-game editor and moving the SpawnSpheres around.
Let's implement the code that will read through the SpawnPoints. Open up game.cs and in the GameConnection::spawnPlayer() function add %this between the parentheses of the first line, the whole function should then look like this:
Well what's that for? I made that change cause you'll have to access the GameConnection in the pickSpawnPoint function to get the team the player is in, so I just passed the %this variable which points to GameConnection, to the pickSpawnPoint function. Another way of doing this could be to include the pickSpawnPoint function in the GameConnection class, but I prefered to pass it as argument.
Well now scroll down in game.cs and look for the pickSpawnPoint function, should be almost at the end of the file. Now change that function to look like this (just replace the old one with this one):
The most important change in this function is the first line, instead of looking for PlayerDropPoints group it will now look for RedTeamDropPoints or BlueTeamDropPoints, depending on the client's team. I also changed the two error lines to report what team is missing spawn points instead of just saying there are no spawn points.
Well that's all, easy part huh? Enjoy your new team spawn points.
I'll be posting a ScoreBoard later, it should have been here as Part #3 but got delayed, and delayed, etc so i decided to release what i had! have fun!
Thanks to Phil for "Beta" testing the tutorial :)
Part 1: Adding basic team support
Ok the first and most important part of making teams is setting each player a team variable which stores which team he is in. At first i thought doing this by adding the variable to the player class (lots of ppl thought the same thing) but I found out that the player class is deleted when you die and is then re-created. So I looked for something relating to the player that isn't deleted, well you might have guessed it, the GameConnection class that is.
So what i did was add a joinTeam function to my GameConnection. To do this open up Game.cs located in fps/server/scripts/game.cs and scroll to the end of the file, there add this function:
function GameConnection::joinTeam(%this, %teamid)
{
//We only have 2 teams so if team is greater than 2 or less than 0 its invalid.
if (%teamid > 2 || %teamid < 0)
return false;
//If we already are on that team return.
if (%teamid == %this.team.teamId)
return false;
%this.leaveTeam();
if (%teamid == 1)
%this.team = $Team1;
if (%teamid == 2)
%this.team = $Team2;
MessageAll('MsgClientJoinTeam', '\c2%1 joined the %2 side',
%this.name,
%this.team.name,
%this.team.teamId,
%this,
%this.sendGuid,
%this.score,
%this.isAiControlled(),
%this.isAdmin,
%this.isSuperAdmin);
%this.spawnPlayer();}Ok I'll explain all this stuff, the first two lines checks to see if the team number is valid. I know this is a bad way of checking that but it's easy to understand and code for new people reading this, a better way would be to have a global define setting the number of teams and using that instead, sorry here. The two following lines check to see if you already are in that team, if you already are is in that team it returns false. You can use this feature to check the status of joinTeam function, if it returns false you could spawn a gui saying there was an error or something like that. The following line calls the function leaveTeam (of the GameConnection class too) which takes the player out of the team he is in, deletes the player object and resets the player's score. In the following if block we are creating the team variable inside the GameConnection class and setting it to the corresponding Team ScriptObject (I'll explain script objects later), again, this is a bad way of doing this too, but it's easy. The next block of code sends a message to all clients saying that the player joined team X and it also passes some variables we will need to catch on later.
Finally the last line spawns the new player.
Ok now let's complete this and define the leaveTeam function. After the joinTeam function you just added add this code:
function GameConnection::leaveTeam(%client, %teamnumber)
{
%this.score = 0;
messageAll('MsgClientLeaveTeam', '\c2%1 left the %2 team.',
%client.name,
%client.team.name,
%client);
if (%client.player)
%client.player.delete();
}Now lets define the ScriptObject for each team. ScriptObjects are like structures of data, you can have many variables inside a ScriptObject, for example name and numplayers. So if you create a ScriptObject called Team1 with those 2 members, you can access them using a syntax similar to: $Team1.name and $Team1.numPlayers.
So on the top of the game.cs file, choose a nice camping site and place your team scriptobjects there with this code:
$Team1 = new ScriptObject()
{
teamId = 1;
name = Red;
score = 0;
numPlayers = 0;
};
$Team2 = new ScriptObject()
{
teamId = 2;
name = Blue;
score = 0;
numPlayers = 0;
};Well here the first line resets the score, the following block sends a leave team message to all clients and the last line deletes the player object if it exists.
Ok, now we need to actually call the joinTeam function from somewhere. We will do this from a gui which lets you choose between teams. Ok so now create the gui as you wish or you can use mine which is as follows:
//--- OBJECT WRITE BEGIN ---
new GameTSCtrl(TeamSelectDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "159 155";
extent = "321 170";
minExtent = "8 8";
visible = "1";
helpTag = "0";
maxLength = "255";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(TeamSelectDlg);";
new GuiTextCtrl() {
profile = "GuiBigTextProfile";
horizSizing = "center";
vertSizing = "relative";
position = "32 30";
extent = "257 40";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "Choose your team";
maxLength = "255";
};
new GuiButtonCtrl(RedTeam) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 130";
extent = "140 30";
minExtent = "8 8";
visible = "1";
command = "jointeam(1);";
helpTag = "0";
text = "Red Team";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiButtonCtrl(BlueTeam) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "170 130";
extent = "140 30";
minExtent = "8 8";
visible = "1";
command = "jointeam(2);";
helpTag = "0";
text = "Blue Team";
groupNum = "-1";
buttonType = "PushButton";
};
};
};
//--- OBJECT WRITE END ---Ok, save that code in a new file with the name TeamSelectDlg.gui (under the directory fps/client/ui/TeamSelectDlg.gui)
Please notice that the buttons call a jointeam function passing a value, but this is not the joinTeam function we defined in game.cs, instead this function is defined in the corresponding TeamSelectDlg.cs file (under fps/client/scripts/TeamSelectDlg.cs).
And this function is like this:
function jointeam(%teamid)
{
commandtoserver('JoinTeam', %teamid);
Canvas.popDialog(TeamSelectDlg); //Hide the dialog once selection was made
}Now open up commands.cs (fps/server/scripts/commands.cs) and add this function to the end of the file:
function serverCmdJoinTeam(%client, %teamid)
{
%client.joinTeam(%teamid);
}Since the GameConnection::joinTeam() function is server side and the gui is client side, we need to call this function which actually calls the server side command JoinTeam which finally calls the server side function joinTeam.
Well, before our gui works we need to add the two files to the execute list of the client side init.cs file (fps/client/init.cs)
You should see a list of exec("xxx.gui"); lines. There you will need to add two new executes:
exec("./scripts/TeamSelectDlg.cs");
exec("./ui/TeamSelectDlg.gui");Finally for this part, we need to bind a key to the dialog. So open up default.bind.cs and add this line to the end:
moveMap.bindCmd(keyboard, "m", "Canvas.pushDialog(TeamSelectDlg);", "");
Add the same line to config.cs just in case, im not sure if it's needed tho.
Now we will want our player to start as an Observer by default, not in any team, so open up game.cs again and find the function GameConnection::onClientEnterGame()
and replace it with this one:
function GameConnection::onClientEnterGame(%this)
{
commandToClient(%this, 'SyncClock', $Sim::Time - $Game::StartTime);
// Create a new camera object.
%this.camera = new Camera() {
dataBlock = Observer;
};
MissionCleanup.add( %this.camera );
%this.camera.scopeToClient(%this);
// Setup game parameters, the onConnect method currently starts
// everyone with a 0 score.
%this.score = 0;
%this.team = 0; //default team is 0 (observer)
//Spawn a camera by default on a observer point
%this.camera.setTransform(pickObserverPoint(%this));
%this.camera.setVelocity("0 0 0");
%this.setControlObject(%this.camera);
}Ok, two things changed in this function, first there's a line which sets the player team to 0, this is because i called observer team, 0.
Then the function call to spawn a player was replaced with the observer spawn. This are 3 lines, the first one sets the camera transform matrix to the matrix returned by the pickObserverPoint() function (we will define this one later on). The second line sets the camera velocity to zero on the 3 axis's and the last line sets the controlObject to the camera (so you can move around with the camera).
Ok, now if you scroll down a bit in this file you'll find the pickSpawnPoint() function, what i did is copy this same function and modify it a bit, so after the pickSpawnPoint function ends add this new function:
function pickObserverPoint(%client)
{
%groupName = "MissionGroup/ObserverDropPoints";
%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 observer spawn points found in " @ %groupName);
}
else
error("Missing observer 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";
}Notice that this new function looks for a group called ObserverDropPoints instead of PlayerDropPoints. Ok so what's left is adding this new group for spawning the cameras. Open up the mission file you want to test this on (actually you should add this to every mis file of your game) and add the following:
new SimGroup(ObserverDropPoints) {
new SpawnSphere() {
position = "109.514 -180.815 202.815";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
radius = "10";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
locked = "false";
lockCount = "0";
homingCount = "0";
};
};This example has only 1 spawnsphere object, but you can add as many as you want, it will randomly choose one. Notice that the spawnsphere's must be beetween the SimGroup opening brace ( { ) and the end closing brace ( }; ). You can just copy the code I pasted above in your mission file and then move it with the in-game editor to the position you want it to be. I wont cover this on this tutorial tho, sorry.
Ok that's all concerning part 1 of this tutorial, you can try it now. You should enter the game being an observer, when you press the "m" key a popup will appear asking you what team you want to join to and then you should respawn but now being in that team. You wont notice any changes yet tho.
Part 2: Adding Team Spawn Points
Ok, what's a team support without being able to spawn team members at different locations? Well, that's what we are going to do now, and it's pretty simple. If you open your mission file you'll see that there's a SimGroup called PlayerDropPoints, and inside it you may have one or more spawnspheres which are chosen at random by the function pickSpawnPoint in the game.cs file (fps/server/scripts/game.cs). Well let's modify the mission file, rename the PlayerDropPoints SimGroup so that it's called something team related, for example I'm using for this example RedTeamDropPoints. Now copy the whole SimGroup "RedTeamDropPoints" and paste it after the existing one, now rename the second copy to BlueTeamDropPoints. You should end with something like this:
new SimGroup(RedTeamDropPoints) {
new SpawnSphere() {
position = "80.0366 -215.868 183.615";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
radius = "10";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
locked = "false";
lockCount = "0";
homingCount = "0";
};
};
new SimGroup(BlueTeamDropPoints) {
new SpawnSphere() {
position = "80.0366 -215.868 183.615";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
radius = "10";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
locked = "false";
lockCount = "0";
homingCount = "0";
};
};In the example code I'm only using one spawnsphere per SimGroup, you can add as many as you want. You might also want to change the position of the spawnspheres, do this changing the coordinates in the code above or by entering the game using the in-game editor and moving the SpawnSpheres around.
Let's implement the code that will read through the SpawnPoints. Open up game.cs and in the GameConnection::spawnPlayer() function add %this between the parentheses of the first line, the whole function should then look like this:
function GameConnection::spawnPlayer(%this)
{
// Combination create player and drop him somewhere
%spawnPoint = pickSpawnPoint(%this); //This line changed
%this.createPlayer(%spawnPoint);
}Well what's that for? I made that change cause you'll have to access the GameConnection in the pickSpawnPoint function to get the team the player is in, so I just passed the %this variable which points to GameConnection, to the pickSpawnPoint function. Another way of doing this could be to include the pickSpawnPoint function in the GameConnection class, but I prefered to pass it as argument.
Well now scroll down in game.cs and look for the pickSpawnPoint function, should be almost at the end of the file. Now change that function to look like this (just replace the old one with this one):
function pickSpawnPoint(%client)
{
%groupName = "MissionGroup/" @ %client.team.name @ "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.name @ " team spawn points found in " @ %groupName);
}
else
error("Missing " @ %client.team.name @ " 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";
}The most important change in this function is the first line, instead of looking for PlayerDropPoints group it will now look for RedTeamDropPoints or BlueTeamDropPoints, depending on the client's team. I also changed the two error lines to report what team is missing spawn points instead of just saying there are no spawn points.
Well that's all, easy part huh? Enjoy your new team spawn points.
I'll be posting a ScoreBoard later, it should have been here as Part #3 but got delayed, and delayed, etc so i decided to release what i had! have fun!
Thanks to Phil for "Beta" testing the tutorial :)
#122
Are you using a script IDE like Torsion? I strongly recommend it, it shortens solving these kinds of issues dramatically.
07/20/2008 (12:42 pm)
Do you have the Choose a Team dialog popping up?Are you using a script IDE like Torsion? I strongly recommend it, it shortens solving these kinds of issues dramatically.
#123
07/20/2008 (12:53 pm)
Yes, i use torsion.. and the choose team dialog apear but when i select the camera go to visitor mode.."spawn"
#124
I'm not being asinine--it's impossible to speculate as to exactly what's happening in your setup. But Torsion will let you step through and find the problem lickety split.
07/20/2008 (6:44 pm)
Have you tried putting a break point in for when the button is pushed to see what it's doing?I'm not being asinine--it's impossible to speculate as to exactly what's happening in your setup. But Torsion will let you step through and find the problem lickety split.
#125
For example: When i select "Red Team" or "Blue Team" and i click on with mouse..
The camera go in visitor mode "visitor player"..
I know my wnglish is very poor ..
But i'm at the start line with project using/tge/tgea/torsion and i like very much when
user want to help "this noob user = me":)
Lee i apreciated about you want to help me..!
Please continue ! I Need Help!..
In the docs i have not found nothing about team implementation in tgea ..
I know tgea is only advanced version of tge and work with many parts or tge script..
For this i tested this... and i have only this problem..
S:O:S.. Please.. Me need help!
07/21/2008 (12:28 pm)
Can be problem in mission file about anything mistake in?For example: When i select "Red Team" or "Blue Team" and i click on with mouse..
The camera go in visitor mode "visitor player"..
I know my wnglish is very poor ..
But i'm at the start line with project using/tge/tgea/torsion and i like very much when
user want to help "this noob user = me":)
Lee i apreciated about you want to help me..!
Please continue ! I Need Help!..
In the docs i have not found nothing about team implementation in tgea ..
I know tgea is only advanced version of tge and work with many parts or tge script..
For this i tested this... and i have only this problem..
S:O:S.. Please.. Me need help!
#126
Not all work fine..
I have only one problem "how to put about player cannot do friendly fire?"
Thank you.
THis is 100% good code for using with TGEA Team Implementation..
Thank to the creator..
07/22/2008 (5:33 am)
Tested code in TGEA works fine not problem with it..Not all work fine..
I have only one problem "how to put about player cannot do friendly fire?"
Thank you.
THis is 100% good code for using with TGEA Team Implementation..
Thank to the creator..
#127
07/22/2008 (10:12 am)
You'll put a check in your projectile::oncollision code.
#128
07/30/2008 (1:02 pm)
How could I auto assign someone to a team when they join?
#129
in game.cs change function GameConnection::onClientEnterGame(%this) to the below code
in game.cs change function GameConnection::onClientLeaveGame(%this) to the below code
in game.cs change function GameConnection::joinTeam(%this, %teamid) to the below code
in game.cs change function GameConnection::leaveTeam(%client, %teamnumber) to the below code
08/01/2008 (5:36 pm)
I think I figured out how to auto assign teams when players joins. I am not sure if this works entirely, and I have not tried having having people join my server. However this is a start, and hopefully someone can let me know how to improve or fix it. The code is executed server side.in game.cs change function GameConnection::onClientEnterGame(%this) to the below code
function GameConnection::onClientEnterGame(%this)
{
commandToClient(%this, 'SyncClock', $Sim::Time - $Game::StartTime);
// Create a new camera object.
%this.camera = new Camera() {
dataBlock = Observer;
};
MissionCleanup.add( %this.camera );
%this.camera.scopeToClient(%this);
// Setup game parameters, the onConnect method currently starts
// everyone with a 0 score.
%this.score = 0;
// Check it team 1 has more players than team 2, if yes assign to team 2, if no assign to team 1
if($team1.numplayers > $team2.numplayers)
{
%this.joinTeam(2);
}
else
{
%this.joinTeam(1);
}
}in game.cs change function GameConnection::onClientLeaveGame(%this) to the below code
function GameConnection::onClientLeaveGame(%this)
{
if (isObject(%this.camera))
%this.camera.delete();
if (isObject(%this.player))
{
if(%this.team.teamid = 1)
{
$team1.numplayers = $team1.numplayers - 1;
}
else
{
$team2.numplayers = $team2.numplayers - 1;
}
%this.player.delete();
}
}in game.cs change function GameConnection::joinTeam(%this, %teamid) to the below code
function GameConnection::joinTeam(%this, %teamid)
{
//We only have 2 teams so if team is greater than 2 or less than 0 its invalid.
if (%teamid > 2 || %teamid < 0)
return false;
//If we already are on that team return.
if (%teamid == %this.team.teamId)
return false;
%this.leaveTeam();
if (%teamid == 1)
{
%this.team = $Team1;
$team1.numplayers = $team1.numplayers + 1;
}
if (%teamid == 2)
{
%this.team = $Team2;
$team2.numplayers = $team2.numplayers + 1;
}
MessageAll('MsgClientJoinTeam', '\c2%1 joined the %2 side',
%this.name,
%this.team.name,
%this.team.teamId,
%this,
%this.sendGuid,
%this.score,
%this.isAiControlled(),
%this.isAdmin,
%this.isSuperAdmin);
%this.spawnPlayer();
}in game.cs change function GameConnection::leaveTeam(%client, %teamnumber) to the below code
function GameConnection::leaveTeam(%client, %teamnumber)
{
%this.score = 0;
messageAll('MsgClientLeaveTeam', '\c2%1 left the %2 team.',
%client.name,
%client.team.name,
%client);
if (%client.player)
{
%client.player.delete();
}
if(%client.team.teamid = 1)
{
$team1.numplayers = $team1.numplayers - 1;
}
else
{
$team2.numplayers = $team2.numplayers - 1;
}
}
#130
if work you have one favour for me.. "design.. php scripting..." all u want.. :)
Ty bro.. i test it now..
!!!!!!!!!!!!!!!!!!!!!!!!!!!
08/02/2008 (5:07 am)
wooow.. super i test it now:!if work you have one favour for me.. "design.. php scripting..." all u want.. :)
Ty bro.. i test it now..
!!!!!!!!!!!!!!!!!!!!!!!!!!!
#131
10/12/2008 (2:08 am)
This removes deathmatch completely or did I misread the code?
#132
Also is there any way to put the spawns in the mission editor or is that done by hand? (TGEA 1.7)
Oh and speaking of I can confirm this works on TGEA1.7
10/12/2008 (2:49 am)
Implemented the code, it works... However my player falls right through the map on team select and I have tried to raise the spawn spheres to the highest level with no avail.. Any ideas?Also is there any way to put the spawns in the mission editor or is that done by hand? (TGEA 1.7)
Oh and speaking of I can confirm this works on TGEA1.7
#133
Falling through the map is a collision issue, nothing to do with this.
And the playerdroppoint/spawnsphere should already be in there.
10/12/2008 (12:26 pm)
@Jace: No, it doesn't remove anything, but you will need to do some considerable (but easy) work to support both modes if you want to be able to switch.Falling through the map is a collision issue, nothing to do with this.
And the playerdroppoint/spawnsphere should already be in there.
#134
Multiple Player Class Selection
Complete the teams resource then add my resource to it.
10/23/2008 (10:33 am)
btw I made a resource a long time ago that adds classes to this resource. So you get two teams each with different classes/models/weapons that you can add yourself.Multiple Player Class Selection
Complete the teams resource then add my resource to it.
#135
Works like a charm with TGE 1.5.2
03/10/2009 (3:30 pm)
Thank you kindly for this resource eXoDuS!Works like a charm with TGE 1.5.2
#136
11/07/2009 (2:50 pm)
Vote Exodus for GG Scripters President ! !!!:)
#137
When i can i must buy T3D..
or if GG decide to give to all user who have TGE and TGEA license Free Upgrade / for T3d :) is good idea:) !:)
11/07/2009 (2:53 pm)
Exodus many of your resources is super for many new user of this forum and this game engine lol :) "this game engine ":) tge tgea t3d :):) is many engine :)When i can i must buy T3D..
or if GG decide to give to all user who have TGE and TGEA license Free Upgrade / for T3d :) is good idea:) !:)
#138
11/07/2009 (4:08 pm)
I'm glad you are finding them still useful after 7 years of being written :)
#139
Tl;dr Anyway to disable the M keyboard shortcut while alive?
05/27/2010 (9:28 am)
New to torque here, and scripting. Got this implemented just fine, i am just curious if there is a way where while you are alive you cannot use the "M" keyboard shortcut to respawn? Say you are in danger of dieing, you can just press M and respawn at full hp/ammo. Tl;dr Anyway to disable the M keyboard shortcut while alive?
#140
05/27/2010 (12:19 pm)
Corey, this version is old and may contain a few bugs. Check out this version which has been converted for T3D usage. This has more then a few bug fixes in it and a teams scoreboard. It also has a 10 second timer delay on the respawn and kills the player effectively lowering thier score.www.torquepowered.com/community/resources/view/19447 There are couple of issues with removing the M function. You will be unable to switch teams and if you get stuck, will be unable to "respawn"
Torque Owner SETTIMO EUGEN CRISTIAN
Set Dev Studio
I have inserted all but when i go in game "my player apear is visitor" and i cannot join in the mission.."
I have inserted SpawSphere named BlueTeamDropPoint and one for red team..
But this not act nothing..
I must precise i'm new in scripting and tge/tgea..
I need help from anyone..
Thank you.