OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Callsign on 22 Feb 2012, 16:16:10

Title: Check if house door is closed
Post by: Callsign on 22 Feb 2012, 16:16:10
How would I check if a house door is closed?

Callsign
Title: Re: Check if house door is closed
Post by: Wolfrug on 22 Mar 2012, 21:16:43
Hi Callsign!

I haven't tested this myself, but the command used would I believe be animationPhase (http://www.ofpec.com/COMREF/index.php?action=details&id=23&game=All). Doors are generally called "dvere1" or then something like "door" or "maindoor". The returned number is between 1 and 0. 1 is open, 0 is closed. So you'd want:

_phase = house1 animationPhase "dvere1";
if (_phase > 0) then {hint "Door is open!"};

Finding the house itself is done via the regular nearObjects/game logic deal I believe, although it was ages ago since I used it :) Also note that animationPhases for static objects don't necessarily update when not in player sight! So it might give wrong readings then.

Wolfrug out.