Game Development Community

TGEA 1.8x

by SETTIMO EUGEN CRISTIAN · in Torque Game Engine · 11/07/2009 (6:13 pm) · 4 replies

Hi,
I have setup and work with the team implementation resources..

Work fine in tgea 1.8x

I only have little problem..
in game.cs
i have put this for change the skinname of the player for the 2 team...

<code:
function GameConnection::createPlayer(%this, %spawnPoint)
{




if (%this.player > 0) {
// The client should not have a player currently
// assigned. Assigning a new one could result in
// a player ghost.
error( "Attempting to create an angus ghost!" );
}



if($Team1 == %player.team)
{
%player.schedule(50, 'setSkinName', 'red' );
}

if($Team2 == %player.team)
{
%player.schedule(50, 'setSkinName', 'red' );
}


/:code>


Anyone can find one solution for do change skin fast in tgea?

This solution i think cannot work:)

#1
11/07/2009 (8:06 pm)
This is the script:
***************************************************************


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;
%player.setSkinName(blu);

if (%teamid == 2)
%this.team = $Team2;



%player.setSkinName(red);


MessageAll('MsgClientJoinTeam', '\c2%1 fa parte della squadra %2 ',
%this.name,
%this.team.name,
%this.team.teamId,
%this,
%this.sendGuid,
%this.score,
%this.isAiControlled(),
%this.isAdmin,
%this.isSuperAdmin);

%this.spawnPlayer();
}
****************************************************************



After change i get this error..
Unable to find object: '' attempting to call function 'setSkinName'


Where i have do error?

Sorry about my question but i'm noob and i learn day after day..
Is i see this i can think the error is in the name of the object..
In this case the object is the player.. or?

S.O.S!!!!Thank you!!
#2
11/07/2009 (10:10 pm)
Not sure you can use %player without putting it into
function GameConnection::joinTeam(%this, %teamid)
try using %this.setSkinName(red);

Also are you naming your skin files properly?

base.skin.png
red.skin.png
blu.skin.png

I also noticed you used blu, was that a typo for blue or is it actually named blu?
#3
11/08/2009 (9:39 am)
Sure.. i have red base and blu png...
i have put in material.cs of the player the mapto blu red etc..

..now i test using %this.setSkinName(red)..

Thank you..
If all work i post here.

Thank you.
#4
11/08/2009 (9:43 am)
scriptsAndAssets/server/scripts/game.cs (296): Unknown command setSkinName.
Object LocalClientConnection(2395) GameConnection -> NetConnection -> SimGroup -> SimSet -> SimObject
scriptsAndAssets/server/scripts/game.cs (300): Unknown command setSkinName.
Object LocalClientConnection(2395) GameConnection -> NetConnection -> SimGroup -> SimSet -> SimObject

I think this command don't work in tgea 1.8.1
or use diferent or?