Jump to content
Sign in to follow this  
Niktus Acid

Removing nearestTerrainObjects results stored in file

Recommended Posts

Hi!
I want to create a function that allows me to remove trees in entire maps in a balanced way, basically reducing the ammount of trees on heavily crowded forests.
I want to do this as quick as possible, so my take on this was to run a function to iterate over hundred thousands trees, choose randomly 50% of all trees (for example), and store the resulting array in a file, that I could call straight away to remove those objects on mission load.

And when I run my function to delete those objects, I receive " Error Missing ] " at this point: (#)
_remove = [299376: t_piceaabies_3f#.p3d,122775: t_piceaabies_3f.p3d,507279: t_piceaabies_3f.p3d, ... , ... ];

It is asking me to close brackets before .p3d on first element.


I'm grabbing all data with copyToClipboard str 
This problem only happens when I'm trying to store data in an array, but if I run this inside the game, same logic, I can delete everything I want without problem.

Any idea what I'm missing here?

Share this post


Link to post
Share on other sites
_remove = [299376: t_piceaabies_3f#.p3d,122775: t_piceaabies_3f.p3d,507279: t_piceaabies_3f.p3d, ... , ... ];

Things stored in _remove, is not even objects, just illegal data that can't be anything valid in Arma. Note that, things can be gathered via str or other commands are not always possible to convert to the actual data.

Suggest to use procedural way to find trees:

{
	_x hideObjectGlobal (((getPos _x#0) + (getPos _x#1) random 1) < 0.5) ;
} forEach nearestTerrainObjects [[worldSize/2,worldSize/2],["Tree","Bush"],worldSize] ;

(Of course this would need a while to execute)

Share this post


Link to post
Share on other sites

That looks nice PolPox, I'll give it a try. Maybe is the fastest implementation if you don't process everything previously.
Thanks for taking time to check it 🙂


Still I don't understand why results from nearestTerrainObjects cannot be stored and processed with some execVM.
Maybe because those objects doesn't have a class ID? ... dunno

Share this post


Link to post
Share on other sites
31 minutes ago, Niktus Acid said:

Still I don't understand why results from nearestTerrainObjects cannot be stored

It could. Just cannot after you converted into a string via str command.

Share this post


Link to post
Share on other sites

Got your point, and I think that now I understand why a simple text doesnt represents an object that you parsed on the engine where there is an actual reference on what object you are referring to.
Thanks for helping me clear my mind

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  

×