Author Topic: Playertype - crouching abilities  (Read 6294 times)

Well done! thank you guys., it works, but in the other hand, it still do the the sounds and effects of the gun when it fired
Does it possible to do that the gun won't do the effects and sounds when the player is crouching?
Not unless you go through and modify each weapon's states.
Or you could just make them put away their weapon when they crouch and make them unable to take out a weapon when they're crouching.

Not unless you go through and modify each weapon's states.
Or you could just make them put away their weapon when they crouch and make them unable to take out a weapon when they're crouching.
How can I do that? and when you're saying that they will put away their weapon when their crouch, is the weapon disappearing from his hands while crouching?

How can I do that? and when you're saying that they will put away their weapon when their crouch, is the weapon disappearing from his hands while crouching?
Yes.

To do this you'd have to package armor::onTrigger, check if the third variable is 3 and the fourth variable is 1, and take away their weapon with %player.unMountImage(0); (I think that's it). Then you'd have to package serverCmdUse and return it if they're crouching.

A nother question: Does it possible to add sounds while the playertype is crouching?
And how does it work?

The key for the third variable in ::onTrigger is as follows.

//=============
//0 = Activate
//2 = Jump
//3 = Crouch
//4 = Jet
//=============

You can try packaging the ::onTrigger check for the third variable, aka crouching, then use play3D on the player. Or do you mean playing a specific sound for something like footsteps while crouching?

You can try packaging the ::onTrigger check for the third variable, aka crouching, then use play3D on the player. Or do you mean playing a specific sound for something like footsteps while crouching?
yes, something like when he's running while crouch he will do sounds of  breathing hard
« Last Edit: October 21, 2014, 12:00:40 PM by BlockAlpha »

Then use the ::onTrigger to call a scheduled function on the player and have that function loop for each breath, then cancel the schedule if he's not crouching.

I want to make the crawling to be faster than the walking and it will do 'sprint' animation, so I've done that.
 so is there a way to make the sprint to be limited? with a bar?

You can make it use the jet energy while crouching.

Just a tip, you can also just mount the weapon image to slot 1 instead of 0 when crouching. Then it'll look like they're holding the weapon, but be unable to fire it.

Code: [Select]
package noShootCrouch {
    function Armor::onTrigger(%db, %this, %slot, %pos) {
        if(%slot == 3 && isObject(%this.getMountedImage(%pos?1:0))) {
            %this.mountImage(%this.getMountedImage(%pos?1:0), %pos?0:1);
            %this.unMountImage(%pos?1:0);
        }
        parent::onTrigger(%db, %this, %slot, %pos);
    }
};
activatePackage(noShootCrouch);

It's worth noting that this code won't work with akimbo guns because it already has a gun in slot 1. You could theoretically expand the script to move slot 1 into slot 2.

Then again, now that I think about it if they were to just press q twice it'd mount the weapon in slot 0 again, and even leave the one in slot 1 to boot. You could be holding 2 weapons at once. So it'd require a little more protecting, you'd probably be better off with another method. I just figured I'd add another possibility.
« Last Edit: October 27, 2014, 01:45:13 AM by $trinick »

Quote
package noShootCrouch {
    function Armor::onTrigger(%db, %this, %slot, %pos) {
        if(%slot == 3 && isObject(%this.getMountedImage(%pos?0:2))) {
            %this.mountImage(%this.getMountedImage(%pos?0:2), %pos*2);
            %this.unMountImage(%pos?0:2);
        }
        parent::onTrigger(%db, %this, %slot, %pos);
    }
};
activatePackage(noShootCrouch);
Try this. I really don't know why it wouldn't be working so I tried making it swap between slot 0 and 2 instead of 0 and 1.


Just a tip, you can also just mount the weapon image to slot 1 instead of 0 when crouching. Then it'll look like they're holding the weapon, but be unable to fire it.

It's worth noting that this code won't work with akimbo guns because it already has a gun in slot 1. You could theoretically expand the script to move slot 1 into slot 2.

What should I do for making also the guns akibo to work well after crouching? (Becouse you replaced slot 1 to 2)
Can you help me again?

It very well might work if you just only swap 0 to 2 though because that'll be enough to make the player think it has no weapon equipped and be unable to fire even though the second gun is still in slot 1.