OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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.....
-
I think the nearestobject command only works to a maximum of 50 metres.
Planck
-
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.
-
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
-
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
-
Yep, just use a trigger, you can move it around with the unit using setPos/getPos.
-
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"] ?
-
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.
-
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?
-
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)
-
Cool, thanks a lot :)
edit
btw Did you ever manage to do it?