OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: filth on 01 Apr 2008, 22:57:39

Title: flare trap - height to set flares in mp...
Post by: filth on 01 Apr 2008, 22:57:39
dear helpful ofpec peeps,
i have a problem with a flare trap in mp.

this is my trigger activation line:

flare1 = "flareyellow" createvehicle [getpos trap1 select 0, getpos trap1 select 1,200]

i set my trap so that the flare goes off at an altitude of 200m. when i test this on my own, the flares don't hit the ground. but when we play it on a mp server, the flares hit the ground, causing a grenade sound, which with multiple flare traps is a nightmare.

why is there a difference when i test it on my own and when it gets played in mp? and...

what height should i set the flares to, to ensure they don't hit the ground? obviously i'm trying to keep the effect of the flare, so setting the height to 1000m wouldn't be a good thing. i'm trying to find a height that is a good compromise.

or can i disable the nade sound as they hit? ie. will they always make that sound in mp or can i switch it off?

cheers,
filth.
Title: Re: flare trap - height to set flares in mp...
Post by: Mr.Peanut on 10 Apr 2008, 18:09:41
Hmm.  I always remember flares making that nade sound.  What you will want to do is add a script to each flare you create that will delete it at a certain height.


height is height above ground to delete,
delta is the pause in seconds between height checks
timeout is a fail-safe for the the script to end after so many seconds

Code: [Select]
myflare = "flareyellow" createvehicle [getpos trap1 select 0, getpos trap1 select 1,200]
[myflare, height, delta, timeout] call "flareheight.sqs"

flareheight.sqs
Code: [Select]
_flare = _this select 0
_height = _this select 1
_delta = _this select 2
_timeout = _this select 3
_timeout = time + _timeout
if (not local _flare) then {exit}

#loop
~_deltat
if ((getPos _flare) select 2 <= height or time >= _timeout or not alive _flare) then {deleteVehicle _flare; exit}
goto "loop"

Code not tested.  You should be able to call each with the same name and it should not matter. Might have missed a parenthesis or two.

Title: Re: flare trap - height to set flares in mp...
Post by: schuler on 10 Apr 2008, 18:40:11
hey -nut thanks for the reply,,,,,,  hope it works ,,, sp = mp ,,,, toughie  ;)
former staff ,,,, my butt  :scratch:
 cheers schuler
Title: Re: flare trap - height to set flares in mp...
Post by: filth on 13 Apr 2008, 19:29:16
sorted.  :cool2:

i just changed the height to 150m and i get a perfect flare without touching the ground.

thx nutbag!

 :good: