Game Development Community

Making new action maps not working

by Stephen · in Torque Game Engine Advanced · 03/14/2009 (2:30 am) · 6 replies

I'm trying to create 2 modes of combat for my project. Mode 1, players can only use guns (first person view only); Mode 2, players can only use melee weapons (third person view only).

Now in default.bind.cs, I have made this function,
function CombatMode(%val)
{
   echo("Combat Mode Activing...");
   commandToServer('CombatMode');
}

moveMap.bind( keyboard, tab, CombatMode );
In commands.cs (server)
function serverCmdCombatMode(%client)
{
   moveMap.pop();
   combatMap.push();  
   
   ServerConnection.setFirstPerson(false);
}

Now they works fine but when testing that out in multiplayer that only works on the server. So then I changed the script in commands.cs to read
function serverCmdCombatMode(%client)
{
   //moveMap.pop();
   //combatMap.push();  
  
   //ServerConnection.setFirstPerson(false);
   
   commandToClient(%client, 'ChangeToCombat');
}
Then made a new function on the client like this.
function ChangeToCombat()
{
   echo("Combat Mode... Actived!");
   moveMap.pop();
   combatMap.push();
}
Then I test that out and get this in the console
clientCmdChangeToCombat: Unknown command.

Also what can I do to make the clients view change as well.

#1
03/14/2009 (3:33 am)
Thanks to HenryT on IRC for helping me to get this working.
#2
03/14/2009 (7:03 am)
@Tek0 - when you find the answer to your problem, post the solution in your thread, it'll help others who stumble into the same problem.
#3
03/14/2009 (12:10 pm)
Default.bind.cs (client)
function SwitchKeyBind(%val)
{
   if (%val) 
      commandToServer('SwitchKeyBind');
}
moveMap.bind( keyboard, tab, SwitchKeyBind );
commands.cs (server)
function serverCmdSwitchKeyBind(%client)
{ 
   commandToClient(%client, 'SwitchKeyBind');
}
clients.cs (client)
function clientCmdSwitchKeyBind()
{
   moveMap.pop();
   newMap.push();
}

This is what I did to change to the new key binds.
#4
09/02/2009 (6:54 pm)
For those working with T3D, I was trying to add a new key to the mapping and found I also needed to add the new key to scripts\client\config.cs
#5
09/02/2009 (7:38 pm)
Technically config.cs should be deleted when you make such changes. It will automatically be regenerated for you.
#6
09/02/2009 (8:31 pm)
When I was working on this, it was with TGEA 1.8.1.