Stamina and Energy Countdown?
by Jason Lee · in Game Design and Creative Issues · 06/04/2007 (4:05 pm) · 3 replies
So i have these working (sort of) but what i can't figure is why the 2 status bars are counting down, while the health bar is correct. Anyone?


About the author
#2
Based on Numerical health
In Command.cs the energy calculation..
In client.cs the call to get the calc..
So either i have to write into the command function something to switch the numbers or i have to do it in the source.. and it's not pretty either.
06/05/2007 (8:00 pm)
I honestly think it's in code. I do use torsion and have done the breakpoints but they return the inverse values if it doesn't crash the game. I really haven't dug back into the code but i was hoping someone knew is the AFK energy worked in this fashion, since spells still cast even though the bar says 0, yet is full.Based on Numerical health
In Command.cs the energy calculation..
function Player::updateEnergy(%player)
{
// Calculate player energy
if(!%player.getControlObject())
{
%maxEnergy = %player.getDatablock().maxEnergy;
%energyLevel = %player.getEnergyLevel();
%energyPercent = %player.getEnergyPercent();
%curEnergy = %maxEnergy - %energyLevel;
%curEnergy = mceil(%curEnergy);
%curEnergyPercent = getSubStr(%energyPercent, 0, 4);
}In client.cs the call to get the calc..
function clientCmdSetNumericalEnergyGUI(%curEnergy, %curEnrgPercent)
{
// The server has sent us our current energy, display it on the GUI
numericalEnergyGUI.setValue(%curEnergy);So either i have to write into the command function something to switch the numbers or i have to do it in the source.. and it's not pretty either.
#3
But I am pretty familiar with the script side of that stuff, and what I found was that I had to write most of the damage system for my game--Torque doesn't come with much, and what there is doesn't always fit together properly. Like the object name gets passed for the damage amount parameter, that sort of thing. And this sounds like a script issue to me, for what it's worth.
I'd definitely consider posting your issue to the Numerical Health resource thread, because it may be directly related, but frankly I still don't understand the problem that's even happening--not quite. What should be happening, but isn't? Or what is happening that shouldn't?
Once you've defined that, follow the process in Torsion and you'll probably find the problem.
06/06/2007 (3:34 am)
I don't know how Energy is handled in the code--sorry.But I am pretty familiar with the script side of that stuff, and what I found was that I had to write most of the damage system for my game--Torque doesn't come with much, and what there is doesn't always fit together properly. Like the object name gets passed for the damage amount parameter, that sort of thing. And this sounds like a script issue to me, for what it's worth.
I'd definitely consider posting your issue to the Numerical Health resource thread, because it may be directly related, but frankly I still don't understand the problem that's even happening--not quite. What should be happening, but isn't? Or what is happening that shouldn't?
Once you've defined that, follow the process in Torsion and you'll probably find the problem.
Torque Owner Lee Latham
Default Studio Name