Jump to content
Sign in to follow this  
HateDread

Executing Code Locally When Player Detected in Radius

Recommended Posts

Hey all,

I'm wondering how I could run some code locally every time a player is detected by any enemies within a certain zone around them (currently achieved by attaching a trigger to the player), with a different set of code when they're not.

Think of it as playing a random playlist of 'Explore' music, and a list of 'Battle' music - the code for battle music would run when the player is detected by any enemies in that zone, otherwise the Explore music would be on.

Also, as another condition - if the enemy is within X, regardless of detection, play the 'Battle' type music, otherwise Explore. Or (and this is getting a bit far-fetched) run a third set of music if this is the case (i.e. 'suspense'/pre-battle music).

I know that sounds a bit odd, but I have no idea how to combine these. It seems the default selectable options of a trigger are not enough.

Any help would be appreciated.

Regards,

- HateDread.

Share this post


Link to post
Share on other sites

In my opinion having the suspense music wouldn't be so good because it would basically tell you if enemies are near. Kinda ruins the surprise, no?

Also, if a unit sees you, but you can't see the unit, combat music will start before seemingly anything has happened.

http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers

check out the fired and firednear eventhandlers.

I can't help you with separate music tracks on different clients but I hope that gets the ball rolling.

Share this post


Link to post
Share on other sites

Cheers Lozz08.

I'll simplify this down to the core script problem:

Run 'Code A' if player detected in radius, with 'Code A-2' run when player is not detected. This must be reusable (the current default triggers for this run only once, even if set to 'repeatedly' - they don't check the 'state' of detection, only activating when it actually occurs. If this weren't the case, I would just use the 'On Act' and 'On Deac.' fields of a trigger).

Would it be possible to do the above, but with only running 'Code A' if the player is detected in the radius AND the enemy is detected by the player.

Does that make more sense?

- HateDread.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×