Jump to content
honger

Execute script when player is holding breath?

Recommended Posts

I would like to implement a bullet-time (slow-motion) script in my mission, which only triggers when the player looks through the scope/optics and holds his breath. So far I've tried the things I've listed below, but they either didn't work as expected or didn't work at all. In the back of my mind I have a recollection that I saw a campaign or scenario where something similar was implemented, but I can't find anything like that. I would welcome any suggestions or solutions on how to go about this.

  1. Detect "Breath Held" sound through SoundPlayed EH - it kinda works but only when that sound is actually played, in game you can hold your breath without this sound being played if hold breath button is pressed a bunch of times in a row. Also triggered randomly when player was in gunner view and pressed shift to run, that sound also starts.
  2. Checking for KeyDown/MouseButtonDown displayAddEventHandler - doesn't work at all, if key is held EH will trigger many times.

Ideally I'd like to slow down time when player holds breath and his sway is actually reduced, it would not work if player is holding breath but unit has to take breath and sway goes up.

Share this post


Link to post
Share on other sites

You can detect the breath holding with the command inputAction:

inputAction "holdBreath" > 0 // result true means he is holdding his breath by pressing Shift

And the aiming of the player can be detected by the command cameraView:

cameraView == "Gunner" // if true, then it means he is aiming

I also advise you to add other conditions to exclude undesirable situations, for example, when a player drives in a vehicle and presses Shift to accelerate, rather than holding his breath:

isNull objectParent player // true if player is on foot

 

  • Like 3

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

×