Making a weapon use energy rather than ammo
All of the weapons that are included in the Torque 3D templates are ammunition-based. However, Torque 3D allows a weapon to instead draw from the player's energy pool and fire until that rechargeable pool is depleted. In this recipe, we will learn how to set up a weapon to make use of a player's energy pool.
Getting ready
We will be making TorqueScript changes in a project based on the Torque 3D Full
template using the Empty Terrain
level. If you haven't already, use the Torque Project Manager (Project Manager.exe
) to create a new project from the Full
template. It will be found under the My Projects
directory. Then start up your favorite script editor, such as Torsion, and let's get going!
How to do it...
We are going to modify Datablock
of the Lurker weapon to switch it over to use energy rather than ammunition. We will also need to modify the standard weapon scripts to take energy into account. This is done as follows:
Open the
art/datablocks/weapons...