OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 2stonedPsi on 17 Oct 2003, 21:07:47

Title: Alarm script
Post by: 2stonedPsi on 17 Oct 2003, 21:07:47
hi, my first post :)

i need a alarm script that works. alarmtime = 20 secs. plz its for my new map, and the stupid alarm never ends  :-[

no triggers a SCRIPT plz  ::)

thx

Psi
Title: Re:Alarm script
Post by: KTottE on 17 Oct 2003, 21:12:03
Right, paste this into a file and save it as alarmScript.sqs

Code: [Select]
_object = _this select 0
_duration = _this select 1
_sound = _this select 2

_object say _sound
@(_time >= _duration)
deleteVehicle _object
exit

Now place an object on the map (can be anything, just name it)

And when you want to start your alarm, you use:

[objectname,20,"Alarm"] exec "alarmScript.sqs"

objectname is the name of the object where the alarm will originate, 20 is the time in seconds it will last, and "Alarm" is the sound you want to use, alarm in this case.

Viel glück :)

EDIT

Changed a bug in the script, now it shoul work.
Title: Re:Alarm script
Post by: McHale on 17 Oct 2003, 23:04:01
Is there anyway to get the alarm to loop a few times? Because that script only plays the sound once...
Title: Re:Alarm script
Post by: Killswitch on 18 Oct 2003, 00:16:28
Yep. Try something like this:
Code: [Select]
_object = _this select 0
_duration = _this select 1
_sound = _this select 2

#loop
_object say _sound
// The "Alarm" sound is about 10 secs
~10
?!(_time >= _duration): goto "loop"

deleteVehicle _object

exit