Author Topic: Trigger that will be activated instantly  (Read 2917 times)

By pressing slot 0 (Left click in mouse) the faster player will stop sprint and setDataBlock to slower player, my problem is that when I pressing left click, the trigger doesn't activate instantly, just only when I stop pressing on the left click in mouse it activate..
Here's the package
Code: [Select]
package Stoprunning
{
function Armor::onTrigger(%data,%player,%slot,%io)
{
if(%slot == 0)
{
        if(!%player.checking)
        if(%io && %data.getName() $= "BlockSoldierArmor")
        %player.setDataBlock(BlockSoldierArmor);
        else if(!%io && %data.getName() $= "BlockSoldierSArmor")
        %player.setDataBlock(BlockSoldierArmor);

        if(%io && %data.getName() $= "PlayerSprintArmor")
        %player.setDataBlock(BlockSoldierArmor);
         else if(!%io && %data.getName() $= "PlayerSprintingArmor")
        %player.setDataBlock(BlockSoldierArmor);
}
Parent::onTrigger(%data,%player,%slot,%io);
}
};

activatePackage(Stoprunning);

Need to know what should I change for let it work..
« Last Edit: July 25, 2015, 04:19:37 PM by BlockAlpha »


I suggest taking a look at using the setMaxSpeed functions added in R1956 if the only reason you're changing datablocks is to change the person's speed.

Right click, which is jet, is slot 4. Left click is 0.

I suggest taking a look at using the setMaxSpeed functions added in R1956 if the only reason you're changing datablocks is to change the person's speed.
No, it's not just that, I want a different animations for the player, I want it to be a different datablock.
by using slot 0, not slot 4. By that the character woun't shoot when sprint. (for the shooter which I'm working on)
« Last Edit: July 24, 2015, 03:07:36 AM by BlockAlpha »

In each of the setDatablocks, you're setting them to the same datablock.
Also, i'm not sure what if(!%player.checking) is doing there, but guessing by your indentation, it shouldn't be.