Author Topic: Holding right click on a weapon  (Read 1460 times)

I know it uses the onTrigger function but I forgot how it is done, and there is no reference anywhere that I can find.

Code: [Select]
function armor::onTrigger(%this,%obj,%slot,%val)
{
if(%slot == 4 && isObject(%obj.client))
{
if(!%val && %obj.shieldMode)
{
%obj.shieldMode = 0;
}
else
{
if(!%obj.shieldMode)
{
%obj.shieldMode = 1;
}
}
}
parent::onTrigger(%this,%obj,%slot,%val);
}

some code from a shield weapon I was making


Alright, I am having trouble, my weapon fires once, but I want it to fire while being held down.


Code: [Select]
function armor::onTrigger(%this,%obj,%slot,%val)
{
if(%slot == 4 && isObject(%obj.client))
{
if(!%val && %obj.swordSwing)
{
%obj.swordSwing = 0;
}
else
{
if(!%obj.swordSwing)
{
%obj.swordSwing = 1;
%obj.setImageTrigger(1,1);
}
}
}
parent::onTrigger(%this,%obj,%slot,%val);
}
clearly I need something more advanced than setImageTrigger, but this is kinda new to me
« Last Edit: July 10, 2013, 07:27:37 PM by Aware »

you could probably make a schedule loop that does imageTrigger and loops and when you release the trigger it cancels the schedule

you could probably make a schedule loop that does imageTrigger and loops and when you release the trigger it cancels the schedule
I'm not familiar with schedule loops