Author Topic: Player Energy Problem  (Read 927 times)

I made a player type based off of the Quake player type, and made it so it can only run for a set period of time. The problem is that when it reaches the end of its energy bar, if I try to run, i get a jerky forwards movement as the energy bar reloads it self. I was wondering if I could have the energy bar stop reloading for a certain amount of time. During that time the player would go slower, or just stop in his tries.

Code: [Select]
//quakePlayer.cs

//a new player datablock with quake-like movement



datablock PlayerData(PlayerQuakeArmor : PlayerStandardArmor)
{
   runForce = 1000 * 900;
   runEnergyDrain = 0.2;
   minRunEnergy = 1;
   maxForwardSpeed = 5.5;
   maxBackwardSpeed = 3;
   maxSideSpeed = 2.5;

   maxForwardCrouchSpeed = 3;
   maxBackwardCrouchSpeed = 2;
   maxSideCrouchSpeed = 1;

   jumpForce = 9 * 90; //8.3 * 90;
   jumpEnergyDrain = 20;
   minJumpEnergy = 1;
   jumpDelay = 10;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;

rechargeRate = 0.04;

uiName = "Quake-Like Player";
showEnergyBar = true;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;
};

function PlayerQuakeArmor::onDamage(%client, %obj)
{
commandToClient(%obj.client,'bottomPrint',"\c6Damage Level: \c3" @ %obj.getDamageLevel() @ "%", 3);
parent::onDamage(%client, %obj);
}

The parts I'm talking about are the runEnergy parts and recharge rate.
« Last Edit: June 14, 2010, 02:28:47 PM by RedGajin »

Did you even ask permission to use the Quake-Like Player? If not, then whats the point?

I'm just messing around with the quake-like player script, not releasing it.
« Last Edit: June 16, 2010, 12:56:34 PM by RedGajin »

Did you even ask permission to use the Quake-Like Player? If not, then whats the point?
Badspot made it. It came with the game. Of course he can use it.

Ok i tried getstateRecovery and that doesn't work either.

Code: [Select]
function PlayerQuakeArmor::onnoEnergy(%client, %obj)
{
%obj.getstateRecover
}##
The bracket seems to be the problem. i tried putting ; after it, still the same problem. Any solutions?

Ok i tried getstateRecovery and that doesn't work either.

Code: [Select]
function PlayerQuakeArmor::onnoEnergy(%client, %obj)
{
%obj.getstateRecover
}##
The bracket seems to be the problem. i tried putting ; after it, still the same problem. Any solutions?

Maybe something like this?
Code: [Select]
function PlayerQuakeArmor::onnoEnergy(%client, %obj)
{
%obj.getstateRecover();
}

im guessing getstateRecover is a function, and functions need () and a ;

weather that will actually run and work.. i cant say, but it should compile fine

Yeah, it got rid of the error report, thanks for that, but the player didn't go into recover mode after that.
Code: [Select]
//quakePlayer.cs

//a new player datablock with quake-like movement



datablock PlayerData(PlayerQuakeArmor : PlayerStandardArmor)
{
   runForce = 1000 * 900;
   runEnergyDrain = 0.2;
   minRunEnergy = 1;
   maxForwardSpeed = 5.5;
   maxBackwardSpeed = 3;
   maxSideSpeed = 2.5;

   maxForwardCrouchSpeed = 3;
   maxBackwardCrouchSpeed = 2;
   maxSideCrouchSpeed = 1;

   jumpForce = 9 * 90; //8.3 * 90;
   jumpEnergyDrain = 20;
   minJumpEnergy = 1;
   jumpDelay = 40000;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;

rechargeRate = 0.04;
rechargeDelay = 40000;

uiName = "Quake-Like Player";
showEnergyBar = true;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;
};
function PlayerQuakeArmor::onDamage(%client, %obj)
{
commandToClient(%obj.client,'bottomPrint',"\c6Damage Level: \c3" @ %obj.getDamageLevel() @ "%", 3);
parent::onDamage(%client, %obj);
}
function PlayerQuakeArmor::onnoEnergy(%obj)
{
%obj.getstateRecover();
}

Maybe the onnoEnergy(%obj) isn't a function
Yeah, the onnoEnergy is definitely not a function. I tried %obj.deactivateDirectInput(); and that didn't work. Unless i can't control that from inside a script?
« Last Edit: June 16, 2010, 07:51:30 PM by RedGajin »