Capturing fire button within a trigger
by Tom Spilman · in Torque Game Engine · 01/11/2005 (1:20 pm) · 3 replies
I'm a script n00b so bare with me.
I'm trying to capture presses of the fire button while i'm within my special trigger. I've already setup my own trigger which unmounts and remounts the weapon "image" (why is it called an image by the way?) when onEnterTrigger and onLeaveTrigger are fired. Now i'm left confused as to where fire button presses go when nothing is mounted. Knowing the order of function calls when the fire or any input is received would help maybe.
Do i screw with action mappings? Is there a callback to change on the player? Do i create a custom interaction weapon image? Do i hack the weapon to do... if ( within my custom trigger ) { do whatever }? I see alot of ways to do this... what is the Torque way?
I'm trying to capture presses of the fire button while i'm within my special trigger. I've already setup my own trigger which unmounts and remounts the weapon "image" (why is it called an image by the way?) when onEnterTrigger and onLeaveTrigger are fired. Now i'm left confused as to where fire button presses go when nothing is mounted. Knowing the order of function calls when the fire or any input is received would help maybe.
Do i screw with action mappings? Is there a callback to change on the player? Do i create a custom interaction weapon image? Do i hack the weapon to do... if ( within my custom trigger ) { do whatever }? I see alot of ways to do this... what is the Torque way?
About the author
Tom is a programmer and co-owner of Sickhead Games, LLC.
#2
At the moment i see changing moveMap between the enter and leave trigger calls possible, but hacky.
01/11/2005 (1:57 pm)
Thanks for the lead, but now where does that go from there? How does mvTriggerCount0 get converted into a CrossbowImage::onFire() call? I can't seem to find mvTriggerCount0 searching the C++ code or any other mention of it in the script code. At the moment i see changing moveMap between the enter and leave trigger calls possible, but hacky.
#3
So... Is this a crazy approach to this?
01/11/2005 (11:18 pm)
Ok i started down the path of adding a "HandImage" weapon. The fire method would do the appropriate interaction for what it's pointing at. Ran into a little speed bump as i'm not an artist so i'll have to cook me up a programmer art DTS shape for the hand (can't have an ShapeBaseImage without a DTS). Other than that i'll have to figure out how to keep it from being droppable, have no/endless ammo, work out having different animations for different types of interactions, etc.So... Is this a crazy approach to this?
Torque Owner Josiah Wang
[EDIT]
I did a quick check by adding a new line to the fire command, to echo something. I found out that the function only gets called when you press the mouse, but does not get called when you hold it. IE: If I held my mouse for 10 seconds, there would only be one message echoed in the log.
From that, I think you can assume that it'll register even if you have no weapon mounted