OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: NightJay0044 on 10 Mar 2010, 03:49:46

Title: Enable/disable alarm system
Post by: NightJay0044 on 10 Mar 2010, 03:49:46
How do you enable/disable alarm system depending on if the player is spotted before the alarm is set off?

Meaning, if the player is spotted before he disables the alarm, forces will be alerted, but if he can disable the alarm system before he is spotted, the forces won't be alerted.

How do i accomplish this?

also I would like to do this, via addaction command.

what is the proper code/syntax whichevver it is, i'm not much of a scripter, so unknown how.

Thanks.  
Title: Re: Enable/disable alarm system
Post by: Mandoble on 10 Mar 2010, 13:01:24
1 - Add some object somewhere to contain the action to disable the alarm, name it alarm_device.
2 - In the init.sqf add
Code: [Select]
if (isNil "nj_alarm_enabled") then
{
   nj_alarm_enabled = true;
   alarm_device addAction ["disable alarm", "nj_disable_alarm.sqf"];
};
3 - Add a trigger covering the detection area and group it with the player. Activation: vehicle, "DETECTED BY OPFOR". In the Condition put
Code: [Select]
this && nj_alarm_enabled, in the trigger effects, select the alarm sound.
4 - Create a script named nj_disable_alarm.sqf
Code: [Select]
nj_alarm_enabled = false;
titleText["ALARM DISABLED", "PLAIN"];
Title: Re: Enable/disable alarm system
Post by: NightJay0044 on 11 Mar 2010, 03:09:27
Thansk mando, what is the addaction syntax code? A lot of things changed with Arma2..