Can someone test this for me?
by Michael Cozzolino · in Torque Game Engine · 06/27/2002 (9:57 am) · 5 replies
********Disregard this post. I found a solution*******
******************************************************
I am using Exodus's Team implementation with adding a seperate button for going into observer mode. I'm trying to have it when a player enters a game that they joint team 1 if the number of player on team 1 is < or = team 2's number of players. Else joint team 2. I think it is working but I don't have the resources to get some players in to test this.
Here is the code. Only if you have implemented the tutorial will you be able to help me.
All you have to do is comment out your
function GameConnection::onClientEnterGame
and put mine in and test. This will be really appreciated.
Thanks
In game.cs:
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));
if($Team1.numPlayers <= $Team2.numPlayers) {
%this.spawnPlayer();
%this.joinTeam(1);
}
else{
%this.spawnPlayer();
%this.joinTeam(2);
}
//%this.camera.setVelocity("0 0 0");
//%this.setControlObject(%this.camera);
}
******************************************************
I am using Exodus's Team implementation with adding a seperate button for going into observer mode. I'm trying to have it when a player enters a game that they joint team 1 if the number of player on team 1 is < or = team 2's number of players. Else joint team 2. I think it is working but I don't have the resources to get some players in to test this.
Here is the code. Only if you have implemented the tutorial will you be able to help me.
All you have to do is comment out your
function GameConnection::onClientEnterGame
and put mine in and test. This will be really appreciated.
Thanks
In game.cs:
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));
if($Team1.numPlayers <= $Team2.numPlayers) {
%this.spawnPlayer();
%this.joinTeam(1);
}
else{
%this.spawnPlayer();
%this.joinTeam(2);
}
//%this.camera.setVelocity("0 0 0");
//%this.setControlObject(%this.camera);
}
About the author
Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489
#2
06/27/2002 (11:23 am)
Thanks for the heads up.
#3
06/27/2002 (12:09 pm)
Let me know if it works for you.
#4
06/27/2002 (12:39 pm)
I didn't try it because I realized a really easy solution. I just set the value of team 1 numofplayers to 5 and then loaded up and I spawned on team 2 and went back and did the opposite and spawned on team 1. (Duh) So stupid I am sometimes :-) I have to go to work soon I may try this out tomorrow and I will let you know.
#5
06/27/2002 (1:04 pm)
Ah I see! Yes that is an easier way!
Torque Owner Mike Stoddart