Game Development Community

SlowDown Player while in ZoomMode?

by CSMP · in Torque Game Engine · 08/05/2009 (9:25 pm) · 1 replies

I'm using the Specific Weapon Zoom Resource and I've got basic "IronSights" animations per specific weapons.

Now my problem is I need to slow down the character for the specific weapons that go into the "IronSights" animation.

This is what I have so far:
commands.cs (called from the default.bind.cs IF the mounted weapon has a zoom)
function serverCmdCallZoomFunction( %client, %val )
{
   %curPlayer = %client.getControlObject();
   %curWeapon = %curPlayer.getMountedImage($WeaponSlot).item.getName();
   commandToClient(%client,'ZoomInDaBiatch',%val,%curWeapon);
   
   
if ( %val )
{
	
$Zoomed = !$Zoomed;

   if ( $Zoomed )
   {
   $Zoomed = true;
   %client.player.FocusedMovement();
   //echo("\c4FocusedMovement Called");
   }
   else
   {
   $Zoomed = false;
   %client.player.UnFocusedMovement();
   //echo("\c4UnFocusedMovement UNCalled");
   }
}


And this is what I have in the players.cs
function Player::FocusedMovement(%this)
{
//%this.maxForwardSpeed = 4;
//%this.runEnergyDrain = 2.9;
echo("\c4Player FocusedMovement SET");
}

function Player::UnFocusedMovement(%this)
{
//%this.maxForwardSpeed = 9;
//%this.runEnergyDrain = 0.9;
echo("\c4Player NormalMovement SET");
}

Though as you can see the actual code is commented out because it does not work, now I recently remember someone saying that you should not change Datablock values ingame so I believe this was the wrong way to go about anyway.

What would be an alternate way to correctly (multiplay compatible) slow down the character based on my given functions?

#1
08/06/2009 (7:14 am)
You should probably look up "variable player aspects" or "dynamic speed", which will point you to a resource that lets you control individual speeds of players/bots in the game.

The problem is that the datablock will change the speed for everything using that datablock, so what you want to do is network the speed variables so that you can change them on an individual basis to get this accomplished.