OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: modderman on 26 May 2005, 00:15:06

Title: OFP Proximity stuff
Post by: modderman on 26 May 2005, 00:15:06
I was wondering what i would put in a trigger so that only land vehicles activated, and if there was a way for air vehicles to only activate it.
I was also having trouble with the nearestobj command...
how would i make it so that it detects planes.....
and can i use the nearestobj for, say a distance of 400?

_obj = nearestobject [player, "plane"] ????

Im looking to make a script, where if any plane gets with in like 400m of my plane, it activates somthing.....
Title: Re:OFP Proximity stuff
Post by: Planck on 26 May 2005, 00:17:16
I think the nearestobject command only works to a maximum of 50 metres.


Planck
Title: Re:OFP Proximity stuff
Post by: macguba on 26 May 2005, 00:18:33
I believe nearestObject only works out to about 50m.

For triggers to be activated by land you need something like

Condition:   this and (thislist countType "land" > 0)

Syntax VERY not guaranteed.
Title: Re:OFP Proximity stuff
Post by: h- on 26 May 2005, 09:45:01
That is correct, nearestObject has a range of 50 meters...
You can write script that makes multiple nearestObject searches so that you can cover a much larger area though...
You can actually search through a whole island with nearestObject, it just takes time and a lot of resources...

As for maccas syntax, almost:
this && "Air" countType thisList > 0
Title: Re:OFP Proximity stuff
Post by: Grendel on 26 May 2005, 18:41:02
I made a trigger for this in my SimFlak AI script...

If I remember correctly it needed Vit's APC pack to run the mission, but if all you need is the trigger you could yank it out pretty easily...

Heres my SimFlak AI script:

http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=16660;start=30  (http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=16660;start=30)

-Grendel
Title: Re:OFP Proximity stuff
Post by: MachoMan on 27 May 2005, 08:58:39
Yep, just use a trigger, you can move it around with the unit using setPos/getPos.
Title: Re:OFP Proximity stuff
Post by: Lean Bear on 27 May 2005, 09:12:40
Whilst on the topic of nearestObject and typeOf: is there a way to find the "type" of things like rocks and trees? So, you could do, say:

_rock = nearestObject [player, "rock"] ?
Title: Re:OFP Proximity stuff
Post by: MachoMan on 27 May 2005, 13:39:23
I dont think so, it has to be an object in CfgVehicles as far as I know, but u can always try it using the hint command.
Title: Re:OFP Proximity stuff
Post by: Lean Bear on 27 May 2005, 14:37:02
Yeah, I tried that already. It just came up with a long load string and that's about it.

So I wouldn't be able to select the nearest rock? Perhaps through a different command?
Title: Re:OFP Proximity stuff
Post by: h- on 27 May 2005, 14:59:20
Here's a thread about detecting those non-configged objects (trees,bushes and rocks are not even mentioned in the game's config...)
http://www.ofpec.com/yabbse/index.php?board=8;action=display;threadid=22708

There's also a link to a workaround for this problem, which is using the objects height value to determine what kind of object it is...
Despite of my 'ballsy' statement of "few lines ougta do it" it's not like that at all probably... ::)
All depends on how many different sizes of rocks there are in OFP...

(edit: added some crap)
Title: Re:OFP Proximity stuff
Post by: Lean Bear on 27 May 2005, 15:02:36
Cool, thanks a lot :)

edit

btw Did you ever manage to do it?