Energy Recharge button
by DeVry Instructors (#0020) · in General Discussion · 11/06/2008 (5:00 pm) · 2 replies
Hello, my name is Evan and I am trying to create a button that will manually recharge my energy bar. Does anyone have any ideas or code that might work? thanks in advance.
About the author
Torque Owner Gary Preston
%client.player.setRechargeRate( %number );
To stop the recharge, you'd make a similar command to server call 'StopRecharge' and simply call setRechargeRate(0.0); from within it.
It's worth noting that the recharge rate is specified in units/tick, that is, for each tick (there's 32 per second) the engine will increase the players energy by %number of units. How long it will take to go from empty to full thus depends upon the %number and the player's maxEnergy entry in it's current datablock.
So for example, with maxEnergy of 32 and a setRechargeRate(2); it would take 16 ticks to go from empty to full, or 1/2 a second.