OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GavinP on 11 Jun 2006, 19:19:00

Title: Detect units in radius of Mapclick
Post by: GavinP on 11 Jun 2006, 19:19:00
Hi, not sure whether this belongs here, or advanced, but hopefully I'll get an answer either way! 8)

Is it possible to detect units within a given radius of a mapclick, and add them to a list, in the same way units within a trigger are part of a list?

What I'm doing is making a simple air support script, which works fine at the moment with invisible targets etc. However, I want the plane to be able to also spot targets within a given radius of their 'target' which they can call the player and request go/no go attacks.

I'm looking for the simplest route, which must be MP compatible (Should there be two ways of doing this!)

Cheers guys,

Title: Re: Detect units in radius of Mapclick
Post by: GavinP on 12 Jun 2006, 11:39:03
13 views and no answer. I'm getting the impression that this isn't going to be possible. :(

Looking at it another way, is it possible to create a trigger during 'run time'?
Title: Re: Detect units in radius of Mapclick
Post by: bedges on 12 Jun 2006, 18:41:57
off the top of my head, easiest way would be to create your trigger, give it a name, and during runtime, move it to the coordinates given by the mapclick.

whether or not that method is MP compatible is another matter. test it and see.
Title: Re: Detect units in radius of Mapclick
Post by: Homefry on 12 Jun 2006, 18:54:10
13 views and no answer. I'm getting the impression that this isn't going to be possible. :(

Looking at it another way, is it possible to create a trigger during 'run time'?

I don't believe you can create triggers throught scripting commands.  Furthermore, I don't believe you can edit trigger properties through scripting.
Title: Re: Detect units in radius of Mapclick
Post by: bedges on 12 Jun 2006, 20:41:35
Quote
...I don't believe you can edit trigger properties through scripting...

Code: [Select]
trigger_name setpos some_place
deletvehicle trigger_name

that's about the extent of it as far as i know.
Title: Re: Detect units in radius of Mapclick
Post by: GavinP on 12 Jun 2006, 20:53:31
 8)

Cheers guys, the trigger idea worked. I'd never noticed the name box before on the trigger!

Anyway, the trigger is working perfectly now, so all I need is to work with the list returned now. Not done much with arrays, so this should be an interesting learning curve.

Scripting is one hell of an addictive thing. I find myself way out of my league very quickly! Its guys like you that deserve all the credit.