Jump to content
Drift_91

hideObjectGlobal not working on certain terrain objects

Recommended Posts

I'm trying to use hideObjectGlobal on certain terrain objects, objects being some bushes, trees and a rusty old fuel truck wreck at the Altis International Airport. I know it's possible because I've done it before. I've been pulling my hair out for the past couple of hours trying to find the thread where I found the solution. I remember it being something to do with the objects being "baked" into the terrain for performance reasons. But I can't remember how to disable this or what exactly this mesh baking process is called in Arma. Anyone know anything about this that can help me?

Share this post


Link to post
Share on other sites

@HazJI'm already doing so. I guess I should have posted the script I'm using.

_ClearArea1A = "clearArea_2","clearArea_3","clearArea_4","clearArea_5","clearArea_6";
_ClearArea1B = "clearArea_1";

if (isServer) then {
{hideObjectGlobal _x;} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1A),[],(getMarkerSize _ClearArea1A)select 0,false];
{hideObjectGlobal _x;} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1B),["HIDE"],(getMarkerSize _ClearArea1B)select 0,false];
};

_markersToDelete2=["clearArea_1","clearArea_2","clearArea_3","clearArea_4","clearArea_5","clearArea_6"];
{deleteMarker _x;} forEach _markersToDelete2;

"clearArea_#" are the names of several markers I've placed down. For some reason certain objects aren't being removed by 2 through 6. I recall there being an issue with certain objects being baked into the terrain's mesh to boost performance and you have to disable that function to remove the objects. I can't for the life of me remember what the command was to turn it off and can't find it in any of my archived missions I remember using it in.

 

Edit:

Script is executed via nul = execVM "markerScripts.sqf"; in init.sqf

Here's the full markerScripts.sqf just in case.
 

Spoiler

_invincibleArea1 = "invincibleArea_1";
_invincibleObjects1 = nearestTerrainObjects [(getMarkerPos _invincibleArea1),[],(getMarkerSize _invincibleArea1)select 0,false];

{_x allowDamage false;} forEach _invincibleobjects1;

_markersToDelete1=["invincibleArea_1"];
{deleteMarker _x;} forEach _markersToDelete1;


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


_ClearArea1A = "clearArea_2","clearArea_3","clearArea_4","clearArea_5","clearArea_6";
_ClearArea1B = "clearArea_1";

if (isServer) then {
{hideObjectGlobal _x;} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1A),[],(getMarkerSize _ClearArea1A)select 0,false];
{hideObjectGlobal _x;} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1B),["HIDE"],(getMarkerSize _ClearArea1B)select 0,false];
};

_markersToDelete2=["clearArea_1","clearArea_2","clearArea_3","clearArea_4","clearArea_5","clearArea_6"];
{deleteMarker _x;} forEach _markersToDelete2;

 

 

Edited by Drift_91

Share this post


Link to post
Share on other sites

@Drift_91 - Which objects aren't hiding and where about are they on the map? Altis/Stratis/etc?

Share this post


Link to post
Share on other sites
22 minutes ago, HazJ said:

@Drift_91 - Which objects aren't hiding and where about are they on the map? Altis/Stratis/etc?

I mistakenly thought that only certain items weren't being removed. The markers aren't removing anything at all actually. "clearArea_1" works fine at removing a knocked over trash bin and some trash piles without touching the 3 barracks buildings in between.

 

I'm trying to remove some bushes, trees, rocks and a rusty fuel truck wreck in the middle of the field at the end of the runways at Altis International Airport. I've got a base set up at the 3 barracks on the North East end of the military base/airport combo. The area I'm trying to clear is the field South East of the road that runs from the 3 barracks South West to the two hangers. Hope that's descriptive enough.

 

Now that I realize it's not just select items not being removed I'm suspecting it's likely that my script isn't correct. Maybe it doesn't like that I'm defining multiple strings or something.

 

Edit:

Here's a screenshot of the area:

Spoiler

12uHu3f.jpg

Once I get it working I'm probably going to add more markers North West of the road to remove the trees and make some sort of heliport or maybe a shoothouse. The whole reason I want to clear all the crap out is to make a shooting range down the South East part.

Edited by Drift_91

Share this post


Link to post
Share on other sites

Ah yes. Look:

_ClearArea1A = "clearArea_2","clearArea_3","clearArea_4","clearArea_5","clearArea_6";
// Should be:
_ClearArea1A = ["clearArea_2", "clearArea_3", "clearArea_4", "clearArea_5", "clearArea_6"];

{hideObjectGlobal _x;} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1A),[],(getMarkerSize _ClearArea1A)select 0,false];
// Should be:
{
	hideObjectGlobal _x;
} forEach nearestTerrainObjects [(getMarkerPos _ClearArea1A select 0), [], (getMarkerSize _ClearArea1A select 0)];
// This will only use the first marker, I would just use one big marker...

Try this:

private _area = "areaMkr";

{
	_x allowDamage false;
	hideObjectGlobal _x;
} forEach nearestTerrainObjects [(getMarkerPos _area), [], 200, false];

deleteMarker _area;

 

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

×