OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MANVIN on 07 May 2003, 01:46:49
-
I was fiddling around again with the editor, and had an idea.
What if I wanted to order the AI to commandeer the nearest vehicle?
I went ahead and tried scripting it, and it turned out rather odd, actually.
Here's the script:
tempobj=nearestobject [getpos a,"LAND"]
[a] ordergetin true
a assignasdriver tempobj
a, at this point, is a single AI soldier that is NOT in the player's group. The nearest object is a jeep placed in the editor
This trigger is called by a radio command (Radio Alpha).
According the OFP ComRef file, CfgVehicles, "LAND" is any ground vehicle. When this is tried, it does NOT work..
Now, if you modify the script as follows, it works.
tempobj=nearestobject [getpos a,"jeep"]
[a] ordergetin true
a assignasdriver tempobj
Is it possible to use the Nearestobject command to order units to board the nearest vehicle of ANY type?
(If you want an example mission, I can post it)
-
Okay, I feel stupid replying to my own post BUT....
I found another complication with this idea..
If I use the following script:
tempobj=nearestobject [getpos leader a,"UH60MG"]
units a ordergetin true
"_x assignascargo tempobj" foreach units a
I can get group of soldiers (a), to mount in the cargo of any UH60-MG nearby, piloted or unpiloted.
EXCEPT
If the UH60-MG is over a certain distance away, they won't get in...
I'm assuming 'nearestobject' has a distance limitation, but is there no way to extend it, or get around it somehow? From what I've seen, the distance limit is fairly close. Almost under 50 meters!
-
Nearestobject only recognizes distinct classnames (1.91 can use typeof)
And it only reaches so far (25 or 50 m)
You can have it seek all and such,but could get you anything that way