Fuel consumption
by Ronald J Nelson · in Torque Game Engine · 07/22/2007 (12:51 am) · 6 replies
I am trying to figure out a good way to have my vehicles use fuel. Does anyone have a good formula for this or even better, code?
#2
07/22/2007 (5:31 am)
Then somehow disable the vehicle when it reaches zero.
#3
07/22/2007 (6:48 am)
Well, I know the player has "runEnergyDrain", but I don't know about vehicles. If it does, this might be a good way of accomplishing you goal.
#4
Let me know if you need any help. I have a wheeled vehicle that uses energy and would be happy to show you how it's set up if you don't already know.
07/22/2007 (7:07 am)
That would be a very quick and easy way of doing it Ron, energy. Vehicles do feature energy that is drained when jetting (a turbo boost in a wheeled vehicle). It would be quite trivial to alter the energy system to drain on normal vehicle movement at whatever rate you desire. You'd also have to stop it from regenerating, which is its default behaviour although I believe this can be accomplished with a simple script value. There is a resource for a vehicle energy bar (it's pretty much identical to the player energy bar, altered for vehicles) - so the whole procedure should be quite quick and simple.Let me know if you need any help. I have a wheeled vehicle that uses energy and would be happy to show you how it's set up if you don't already know.
#5
07/22/2007 (4:16 pm)
Well TIm since I have added a severely modified version of the vehicle engine and transmission resource, it isn't that simple. Thats kind of why I am more looking for a good formula.
#6
In OnAdd:
07/22/2007 (4:44 pm)
I set the recharge rate to a negative number. At idle, I set the value to something like -0.01, and to -0.9 when the gas is applied. Experimenting will get the values you like.In OnAdd:
// energy use/gain %obj.setEnergyLevel(%this.MaxEnergy); %obj.setRechargeRate(%this.rechargeRate);
Torque Owner Deepeyed
hope i could help.