Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
HeraclesJones

Trigger on Player Run

Recommended Posts

Hi,

Does anyone know if it's possible to fire a trigger if a player runs (as opposed to, of course, walking). I'm trying to add a little suspense to an undercover mission, and want to make it so if the player (independant) runs, use setFriend to make them hostile to the occupying forces that they're walking amongst.

So in psuedocode, [on player run] then [trigger setFriend function]

Thanks in advance if you have any info on this.

Share this post


Link to post
Share on other sites

Hey,

If you are able to find out what animations are used for running you can certainly detect when the animations are played.

Obviously, Clayman's animation viewer will give you the precise animations, but going from here https://community.bistudio.com/wiki/ArmA2:_Moves to post an example, there is the 'amovpercmrunsraswrfldf' animation defined as 'running', so I'll go for that.

I guess there's two ways you can do this, one I'm certain of will work, and one that I haven't tried but may be better code.

there is the one that I haven't tried, that is using the eventhandler 'AnimStateChanged', then use the code _this execVM "AnimChecker.sqf"

Inside of that file, using an if() check, to check if (_this select 1) == "amovpercmrunsraswrfldf", if so then use setFriend/setCaptive, whatever you use to make the enemies hostile to you.

The other way, is by running waitUntil in a script...I'll write this one out.

[] spawn {
waitUntil {animationState player == "amovpercmrunsraswrfldf"};
(side player) setFriend [EAST,0];
};

I guess the second one is easiest, anyway it depends on what running animation is used, and remember that the running animation with pistols and rifles are different from eachother so you may have to use || aka 'OR'.

Just see which one you use, I recommend the second one, placed in init.sqf or so.

Kind regards,

Sanchez

Share this post


Link to post
Share on other sites

just use the speed command.

speed player > 6; 

might have to play with that value because i'm not sure what the walk speed in arma 2 is anymore.

Share this post


Link to post
Share on other sites

Checking the anim state seemed to be an elegant solution, but there was something strange happening when I tried it, which I blame on my lax coding skills.

In case anyone is interested, I ended up using the speed solution, as -

- create trigger, set activation to INDEPENDENT (my player character is GUE named p1)

- CONDITION is

(speed p1) >= 8;

- ON ACT. is

Resistance setFriend [East, 0]; East setFriend [Resistance, 0];

...and viola! Instant Assassin's Creed.

Thanks everyone for your help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×