OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: xCIA_BlackThorn on 19 May 2005, 21:51:14

Title: Chopper detecting smoke...
Post by: xCIA_BlackThorn on 19 May 2005, 21:51:14
Now I know this has been answerd before, but I just cant seem to find it.

Yes, I would like my chopper to patrol an area 'looking' and waiting for me to throw the smoke so he can land.

Any ideas..?

Thanks.
Title: Re:Chopper detecting smoke...
Post by: macguba on 19 May 2005, 23:10:50
Add an eventHandler "fired" to the player.
Title: Re:Chopper detecting smoke...
Post by: bedges on 19 May 2005, 23:11:44
an event handler is what you need, along with a trigger over the area you want the chopper to 'see' your smoke in...

first the eventhandler -

put this in the init line of the loon you want to be throwing the smoke:

Code: [Select]
this AddEventHandler ["fired",{_this exec "onfiring.sqs"}]

then open up notepad and copy/paste the following:

Code: [Select]
;detect if smoke is thrown

?not in_area:exit

_how = _this select 2
_what = _this select 4

?_how=="throw" and _what=="smokeshell":goto "helicopter"

exit


#helicopter

hint "Chopper's on its way"

;additional code here...

exit


save that as "onfiring.sqs" - thanks to Gizmo and SFG for their input ;)

you'll notice the 'in_area' at the top. that's a global variable, which we need for the trigger.

create the trigger, big enough to cover the area which your chopper will be searching. make it trigger on west present (or alternatively group it to the loon to be throwing the smoke), and in the 'on activation' field, paste the following:

Code: [Select]
in_area = true
in the 'on deactivation' field, paste this:

Code: [Select]
in_area = false
now you have an evac area sensitive to smoke shells.

missionette attached.
Title: Re:Chopper detecting smoke...
Post by: xCIA_BlackThorn on 20 May 2005, 02:03:01
Wow, Thanks for the fast respawn. And it works well. Thanks Guys.