Home   Help Search Login Register  

Author Topic: Detecting if a position in forest  (Read 1067 times)

0 Members and 1 Guest are viewing this topic.

Offline kubi

  • Members
  • *
Detecting if a position in forest
« 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

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Detecting if a position in forest
« Reply #1 on: 13 Sep 2006, 16:15:29 »
Search this and the BIS forums. This idea has been discussed to death.
urp!

Offline Blanco

  • Former Staff
  • ****
Re: Detecting if a position in forest
« Reply #2 on: 17 Sep 2006, 03:06:17 »
Hmmm, if nothing else work... use the nasty way

Cover the forest with triggers.

In you init.sqs
Quote
Inforest = false

In every trigger :

Quote
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.






« Last Edit: 18 Sep 2006, 07:04:49 by Blanco »
Search or search or search before you ask.

Offline bdfy85

  • Contributing Member
  • **
Re: Detecting if a position in forest
« Reply #3 on: 17 Sep 2006, 14:15:18 »
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 ?
Liberation Mod scripts&balance

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Detecting if a position in forest
« Reply #4 on: 23 Sep 2006, 11:47:46 »
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.

Quote
Search this and the BIS forums. This idea has been discussed to death.
Yes, but now it has been solved!!

Here it is:
« Last Edit: 24 Sep 2006, 01:39:26 by Raptorsaurus »