Version 1.1 Released: Units stop popping up and down after they no longer know about enemies.
When placing units in static defensive positions (on roofs, behind walls, behind windows, etc.), I want the units to react more dynamically under fire, and duck down to cover, then pop up to return fire, then duck back down to cover again. So I wrote this very simple script (its used in both my Arma 3 missions Property of Mabunga and Leper Island). The script is called by a Fired Near event handler (so they react to fire). Here's a short demonstration:
Note: Zenophon kindly incorporated this script in his Zenophon's Infantry Occupy House Script (his script is essential for your urban combat needs...very smart placement of units in/on buildings).
To execute this script, put the following line in the unit's init. Note the second parameter tells the script what stances you want the script to toggle between. Use ["Middle","Down"] for a guy in a crouch position behind a low wall. He will alternate from crouch to prone. Use ["Up","Down"] or ["Up","Middle"] for a guy behind taller cover that will shoot from standing position, then crouch or go prone to hide.
this addeventhandler ["FiredNear",{ [_this select 0, ["Middle","Down"]] execVM "JBOY\JBOY_UpDown.sqf";}];
Create a file called JBOY_UpDown.sqf in your mission directory, and put this simple code in it:
Hope you find this useful. Johnnyboy out.
Credits:
4-325Ranger for reporting issue where guys bob up and down after no longer in danger. Thanks dude!