Game Development Community

Alt trigger // State action

by Matthew Jones · in Torque Game Engine · 01/02/2003 (12:07 pm) · 8 replies

I have the alt fire(mouse2) that I am trying to use for a weapon. I have everything in place but I think I am calling the wrong "STATE" in the weapons script. Or I am missing somthing in my altfire setup. How do I go about setting up the "alt fire" for a weapon?
I have the function in the default.bind.cs:
//---------------------------------------------------
// Mouse Trigger
//---------------------------------------------------

function mouseFire(%val)
{
   $mvTriggerCount0++;
}
// this is the altTrigger or mouse2 I think?
function altTrigger(%val)
{
   $mvTriggerCount1++;
}

Then in my weapon file I added a state after fire and set all the other states up one number.
// Fire the weapon. Calls the fire script which does 
   // the actual work.
      stateName[3]                     = "Fire";
      stateTransitionOnTimeout[3]      = "Ready";
      stateTimeoutValue[3]             = 0.3;
      stateFire[3]                     = true;
    //stateRecoil[3]                   = LightRecoil;
      stateAllowImageChange[3]         = false;
      stateSequence[3]                 = "little";
      stateScript[3]                   = "onFire";
      
   // This is an addition to the state script's for 
   // an alternate fire
       stateName[4]                     = "????????";
       stateTransitionOnTimeout[4]      = "Ready";
       stateTimeoutValue[4]             = 0.3;
       stateFire[4]                     = true;
    // stateRecoil[4]                   = LightRecoil;
       stateAllowImageChange[4]         = false;
       stateSequence[4]                 = "big";
       stateScript[4]                   = "?????????";
// reload setup
       stateName[5]                     = "Reload";
ect..........
The question marke in the state 4 show what I am looking for as far as names.
Thanks
Matt

#1
01/02/2003 (12:09 pm)
You should be able to name them whatever you want, as long as you're consistent. The names aren't hardcoded, AFAIK.
#2
01/02/2003 (1:48 pm)
Well I wouldn't thimk the state name is but what about the state script. Do I use "altTrigger". I tried it it didn't seem to work. Maybe I am doing somthing else wrong further on up.

Thanks James
Matt
#3
01/02/2003 (2:06 pm)
If i remember correctly, the trigger0 trigger the image0 and the trigger1 trigger the image1.
#4
01/02/2003 (5:09 pm)
So furhter up in my weapons script where the datablock is added I need to make a second image of my weapon (ie weaponimage1). I still am not sure what the state script's name should be.
One thing that would help is if somebody could tell me where the "onFire" in the regular fire script stems from. I know that there is an on fire function in the default script but I have not yet put that in and the animation still plays. Any Ideas?
Thanks
Matt
#5
01/02/2003 (6:13 pm)
Why can't we just use the same image has the one there and get it to just fire the normal projectile for now?

I think you would made another OnFire and call it OnFire2 and make it use the other image etc?

Also with the OnTriggerDown (which is like in the number 2 sector), maybe have one below called OnAltTriggerDown?

would that work at all?

And just to make sure have you uncommeted the bit under the Alttrigger, in defualt.bind.cs?
#6
01/02/2003 (9:53 pm)
Well I am not sure if all that would work. In fact that about how I origanally set it up but it didn't work.

I would just like a clue as to what "onFire" references. Outside the OptionsDlg.cs (i think its called) I can't find it anywhere. Only mousefire. I'll keep plugin away it will come to light sooner or later.
Thanks
Matt
#7
01/02/2003 (10:31 pm)
I hope so.
#8
01/04/2003 (8:04 am)
POST
I found this post discussing the subject but I haven't been able to get it to work yet.
Matt