Game Development Community

Alternative Fire Modes

by Stuart Campbell · in Torque Game Engine · 07/29/2002 (11:30 pm) · 7 replies

Hi there,

Im am totally lost as to how to add multiple weapon fire modes. (e.g. mode1 (leftclick) single-shot, mode2 (rightclick) three-round-burst). Could someone please explain to me how i would go about adding this or give a general explaination on how the engine and scripts are communicating in order to change the "states" found in the weapon definitions.

Thanks,
Stuart Campbell

#1
07/29/2002 (11:48 pm)
This is difficult to do. From what I can tell the only way is with a hack of two images...one for each fire mode.

-Tim aka Spock
#2
07/30/2002 (12:44 am)
Actually, i dont think this is THAT hard. I was playing with the triggers the other day.

Gimme some time later tonight and I'll post a little how-to if I get time.

The trouble is that you need to make sure that the mouse buttons are triggering the correct trigger states.

You want mouse button 1 to trigger state 0 (normal fire) then write a function so that button 2 triggers state 1, add a handler function in the OnTrigger handler that switches weapon states if trigger 1 pressed.

I think crime force actually did this for 3 round burst of its MP5.

Phil.
#3
07/30/2002 (4:39 am)
Surely some code (so there is an altfire setting) and a rewrite of the state machine, so the weapon has 2 different firing modes?

Doesn't seem too complex... Or just call me dumb :)
#4
07/30/2002 (4:53 am)
I haven't actually looked at it. I was basing my statement on what Tim Gift had said in a private associate thread.

-Tim aka Spock
#5
07/31/2002 (1:55 am)
Im not the most proficient C coder out there so i wouldnt really know where to start modifying the state engine.

Im guessing noone has discovered a convienient way to do this with scripts?
#6
07/31/2002 (5:08 am)
Triggers can be done in script.
#7
08/02/2002 (6:03 pm)
Heh,
Well it wasnt hard at all after all =)..
However, in my modification of the triggers i need to be able to eject a casing object from the weapon manually (i.e NOT from the state machine)... does anyone know how this can be done?

-Thanks Once Again