Author Topic: Shooting the left-handed gun with a right click  (Read 829 times)

(I'm inexperienced with Torque, or with any language in that case.)

Okay so in reply to this topic, I attempted to create an akimbo weapon in which the player holds the SMG in the right hand (normal) and fires using the left mouse button (normal) but Kaje's Double Barrel Shotgun in the left hand using the right mouse button to fire normally (load -> shoot -> repeat).
 I tried to accomplish this via this strategy:

Code: [Select]
package AkimboSMGLupara
{
   function Armor::onTrigger(%this, %player, %slot, %val)
   {
   %obj.setImageTrigger(1,1);
   }
};   
ActivatePackage(AkimboSMGLupara);

This doesn't work. I tried the approach by ripping code and combining it to produce armor::onTrigger, typical for secondary fire weapons, and "obj.setImageTrigger" from Guns_Akimbo. What am I doing wrong? Or is it that what I'm trying to do is completely wrong?

The left-handed DB Shotgun image is mounted correctly and everything.
The gun's .cs is provided as an attachment.
Thank you.

On the client, use $mvTrigger1 = bool;
On the server, use player.setImageTrigger( 1, bool );

What you're doing wrong is:

  • Unconditionally starting the left trigger.
  • Using %obj in one place and %player in another.

You also need to parent the function

You also need to parent the function

I'm guessing that means changing

That second line of code doesn't look right though ^

I hate syntax.


EDIT: nvm I'm dumb I'm looking into this when I get home
« Last Edit: February 22, 2013, 11:35:47 AM by AromaniaFTW »

No it means putting parent::onTrigger(%this, %player, %slot, %val); in your function

No it means putting parent::onTrigger(%this, %player, %slot, %val); in your function
That makes more sense, but just a quick logical explanation: how does that line of code make it so it's armor that is triggered?

That makes more sense, but just a quick logical explanation: how does that line of code make it so it's armor that is triggered?
It doesn't

That makes more sense, but just a quick logical explanation: how does that line of code make it so it's armor that is triggered?
that line of code makes it so you're not completely overriding the function