OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: kubi on 13 Sep 2006, 10:26:26
-
Hi,
I'd like to find out if a position is in the middle of a forest (not trees, but undestructible forest) or not.
I tried to modify Cleanrock's InForest.sqf, because it reacts to trees not just forest objects. But I failed.
COMREF says for "nearestObject Pos" that "Pos may be [x, y ,z, "type"] or [object, "type"] or even [x, y, z]".
But it just do not work for forests:
- without "type" if finds the nearest forest triangle, but it returns "12345: objectname"
It would be OK without the object ID, but I can't cut it from the beginning of the string.
- with "type"="Forest" or "les ctverec pruchozi_t1" or anything else only NULL is returned.
Any idea how to detect if a position in a forest, but avoid other trees?
BR,
Kubi
-
Search this and the BIS forums. This idea has been discussed to death.
-
Hmmm, if nothing else work... use the nasty way
Cover the forest with triggers.
In you init.sqs
Inforest = false
In every trigger :
Side : Your side
Repeatable
(maybe use a timeout of 1 sec)
Condition : player in thislist
On activation : Inforest = true
On deactivation : Inforest = false
I know it's not the best way but it will work. & you can make one trigger & copy & paste him.
But it all depends on
- how many forests need to be detected on the island
- What's the shape of it, is it easy to cover it with triggers?
You can really place lots of triggers like that, I have i mission with approx 150 repeatable triggers and no lag at all.
-
What for you want to detect if unit is in the forest ? Detect if he's hiding ?
There's an idea (by flea). Try for example
i=0;while{i<10}do{"mi17" createvehicle getpos player;i=i+1;}
As you may see - no chopeers are damaged, they are placed near by - where it's possible. So you can make invisible box-checker and check if it can be spawned at the unit position. If it's spawned far enough - unit is in the forest (or in the town - you can check it with nearestbuilding). Got it ?
-
I made a function that tests if a defined area is over a forest (you can change the area size to make sure a chopper has enough clearance. I made an entire script pack for landing choppers anywhere. It checks for forestes, trees, buildings, water, other vehicles (obstacles in general) and ground slope. I started working on it just before OFPEC crashed. It is now all working very nicely. I just have to make a better readme and do some touch ups to the demo mission (like make sure it is addon free). I will try to submit it tomorrow.
Search this and the BIS forums. This idea has been discussed to death.
Yes, but now it has been solved!!
Here it is: