Weapon Switching
by Dre Aldridge · in Torque 3D Beginner · 05/02/2011 (12:50 pm) · 3 replies
Looking at the weapon switching in the FPS Example, I wanted to know what files control that?
About the author
Currently working on college.
by Dre Aldridge · in Torque 3D Beginner · 05/02/2011 (12:50 pm) · 3 replies
Currently working on college.
Associate Michael Hall
Distracted...
- Weapon namespace/class methods are found in weapon.cs.
- Keybinds for number keys and weapon cycling are found in default.bind.cs.
- A weapon script, if one exists, would generally override the generic onFire method used in weapon.cs.
- Weapon datablock files contain relavant datablocks: ammo, item, fx, image, etc.
- Inventory management is handled through the methods found in weapons.cs, inventory.cs, and item.cs.
The old-school weapon per keybind quick access is as simple as adding/creating the keybind in default.bind.cs. The weapon cycling (by mouse-wheel or the Q key) requires an array be setup listing the desired order to cycle. This is easily managed by using function WeaponOrder() (found in weapon.cs). Give it a weapon name and order number (starting with 0) and it indexes the weapon order for each weapon you call it for so that weapons are always cycled in the same order.