Jump to content
jakeplissken

How to search and replace walls that do not have a type.

Recommended Posts

I found this code on the forums and I modified it a bit. I can search and replace all of the walls around the airbase on the Reshmaan map. This replaces them with walls that are indestructible. This could even be used to remove trees and replace them with something else.

 

{
        _dir= getDir _x;
        _pos = getPosASL _x;
        _x hideObjectGlobal TRUE;
        _new = createVehicle ["Land_ConcreteWall_03_m_6m_F", ASLToAGL _pos,[],0,"can_collide"];
        _new setDir _dir;
        [_new,true] call BIS_fnc_replaceWithSimpleObject;
		sleep 0.06;
} foreach (nearestTerrainObjects [[4266.57,18052.3,0],[],1200] select {getModelInfo _x #0 in ["wall_indcnc_4.p3d","zed_civil.p3d"]});

This is not even that intensive despite a large radius, I am using a sleep statement to give it some time to run, and it runs quite fast. The only hard part is finding wall segments that fit exactly, the previous walls have no type. Typeof CursorObject returns "". This should be very useful. It is cool that you can select by modelinfo value.

  • Thanks 1

Share this post


Link to post
Share on other sites

Similar to what I was trying to do, but didn't get to finishing yet.  This is probably what I need.

 

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

×