Jump to content
Sign in to follow this  
KingN

How to know if unit/object is in forest?

Recommended Posts

Is there any way to get the game know if an object or unit is in forest?

At least the ambient sound knows where you are and plays an ambient sound according to it so the game somehow detects it but I can't find a way.:( Tried to search but couldn't find any simple command for it.

I've thought of a workaround by counting the amount of trees around the object with nearobjects command but the trees don't have a type name so even making the game recognize the trees gets hard. So, is there a way to return the model name of the object? I could make a sort of database to an .sqf and call the model names from there and make the game know if it is a tree.

The tree object list is:

plants2_Tree\t_acer2s.p3d

plants2_Tree\t_alnus2s.p3d

plants2_Tree\t_betula1f.p3d

plants2_Tree\t_betula2f.p3d

plants2_Tree\t_betula2s.p3d

plants2_Tree\t_betula2w.p3d

plants2_Tree\t_carpinus2s.p3d

plants2_Tree\t_fagus2f.p3d

plants2_Tree\t_fagus2s.p3d

plants2_Tree\t_fagus2W.p3d

plants2_Tree\t_fraxinus2s.p3d

plants2_Tree\t_fraxinus2W.p3d

plants2_Tree\t_larix3f.p3d

plants2_Tree\t_larix3s.p3d

plants2_Tree\t_malus1s.p3d

plants2_Tree\t_picea1s.p3d

plants2_Tree\t_picea2s.p3d

plants2_Tree\t_picea3f.p3d

plants2_Tree\t_pinusN1s.p3d

plants2_Tree\t_pinusN2s.p3d

plants2_Tree\t_pinusS2f.p3d

plants2_Tree\t_populus3s.p3d

plants2_Tree\t_pyrus2s.p3d

plants2_Tree\t_quercus2f.p3d

plants2_Tree\t_quercus3s.p3d

plants2_Tree\t_salix2s.p3d

plants2_Tree\t_sorbus2s.p3d

plants2_Tree\t_stub_picea.p3d

This simple issue is getting very hard for me so could somebody help me with this? :rolleyes:

Share this post


Link to post
Share on other sites

Why don't you place triggers in different forests that when it is activated by player, it plays ambient sound? Much easier than scripts IMO

Share this post


Link to post
Share on other sites
Why don't you place triggers in different forests that when it is activated by player, it plays ambient sound? Much easier than scripts IMO

I'm making a dynamic campaign with the campaign area covering all island so it would be a bit time consuming to go through all the forests.:p Anyway, this script isn't about adding ambient sounds, just referred to it just pointing out that the game somehow knows when player is in a forest. But thanks for the reply.

Share this post


Link to post
Share on other sites

Try the surfaceType command. Terrain surfaces in ArmA1 were done in 40m squares, but I suspect ArmA 2 is more precise (possibly per pixel of the sat/layer mask).

Share this post


Link to post
Share on other sites
Try the surfaceType command. Terrain surfaces in ArmA1 were done in 40m squares, but I suspect ArmA 2 is more precise (possibly per pixel of the sat/layer mask).

Thanks a lot ceeeb, got it working! The resolution is indeed quite high, about 5m squares or so.

Did a quick study on how the surfacetype command works with radio trigger with this in "on acivation"

hint format ["%1",surfaceType [getpos player select 0, getpos player select 1]]

The command returns either "#CRForest1" or "#CRForest2" when I'm in forest. Problem solved. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×