Making weapon using Energy
by JD · in General Discussion · 05/15/2007 (10:23 am) · 8 replies
I need help coding a weapon to suck energy rather than ammo...
Great help and much appreciation :-)
Great help and much appreciation :-)
About the author
Check out my website: http://lethonline.com/ *a home for all gamers!*
#2
You could be this in your weapons dataBlock:
05/16/2007 (6:03 am)
Thanks to Ron Nelson for help on energy draining.You could be this in your weapons dataBlock:
energyDrain = 10;Then at the top of your weapons onFire function you can put this:
//Don't fire if we don't have the energy
if (%obj.getEnergyLevel() < %this.energyDrain)
return;
%obj.setEnergyLevel(%obj.getEnergyLevel() - %this.energyDrain);Hope this helps.
#3
05/16/2007 (7:07 am)
The weapon image datablock has specific settings for using energyusesEnergy = true;
minEnergy = 10;
EnergyUsage = 8;There is also a method of setting the drain in the image state if you want to drain energy at a specific state.stateEnergyDrain[0] = 3.0;
#4
05/16/2007 (3:39 pm)
But don't I have to somehow remove the Ammo Datablock? Or do I just remove it cold turkey, nothing in place of it?
#5
05/16/2007 (3:53 pm)
That depends on how you've written the weapon scripting. You can either remove the ammo item datablock, or there should be an obj.decInventory() call in onFire() that you can remove.
#6
05/16/2007 (4:24 pm)
So remove the ammo datablock as well as the decrement inventory function...?
#7
Laser gun sucks up 5 energy per burst. You fire laser gun, the inventory which is the "capacitor" is reduced 5 energy. I dont see a diference in how its drained.
05/16/2007 (4:31 pm)
Is the energy the ammo? cause then you just have the inventory amount be the energy level, and when you fire, X energy is depleted from the inventory.Laser gun sucks up 5 energy per burst. You fire laser gun, the inventory which is the "capacitor" is reduced 5 energy. I dont see a diference in how its drained.
#8
check it, I removed ammo datablock and couldn't fire shit. So then I made it so it doesn't decrement. Sound good?
05/19/2007 (5:14 am)
*confused*check it, I removed ammo datablock and couldn't fire shit. So then I made it so it doesn't decrement. Sound good?
Torque Owner Shane09