Author Topic: How do I make something trigger with right click?  (Read 870 times)

I've looked in the flak cannon, throwing knife, and old school rifle, but I'm not sure what exactly causes something to happen with the RMB. Can I get some help?

Armor::onTrigger(%this, %obj, %triggerNum, %val) is the function these weapons are using to extend right click's functionality. It's called for several different things like left clicking, right clicking, jumping, crouching, some others I'm probably forgetting, or releasing any of those buttons as well

%this is the player datablock
%obj is the player object
%triggerNum is the type of trigger (right click is 4 so you'll want to make sure %triggerNum == 4)
%val returns true if trigger is being pressed, false if being released

Example (not tested):
Code: [Select]
function Armor::onTrigger(%data, %player, %triggerNum, %val)
{
Parent::onTrigger(%data, %player, %triggerNum, %val);

if(%triggerNum == 4 && %val && %player.getMountedImage(0) == nameToID("YourWeaponImage"))
{
                   // do stuff
}
}