Jump to content

LoseBummer

Member
  • Content Count

    48
  • Joined

  • Last visited

  • Medals

Posts posted by LoseBummer


  1. Same concept to fix walls and fences, searchs for terrain objects and replace it with the intact one.

    One issue to overcome is placing a pillar in the gaps, in fences too.

    EDIT: not working right. Tried to offset per model xyz but the offset its in relation of the xyz of the map coordinates and not between objects.

     

    gamelogic>init

    null = ["MARKERNAME"] ExecVM "wff.sqf";
    

    wff.sqf

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    medianera = [["CITY_8MD_F","Land_City_8m_F"],
    			 ["CITY2_8MD_F","Land_City2_8m_F"],
    			 ["CITY2_PILLARD_F","Land_City_4m_F"],
    			 ["INDFNC_3_D_F","Land_IndFnc_3_F"],
    			 ["INDFNC_3_HOLE_F","Land_IndFnc_3_F"],
    			 ["MIL_WIREDFENCED_F","Land_Mil_WiredFence_F"],
    			 ["NET_FENCED_8M_F","Land_Net_Fence_8m_F"],
    			 ["NEW_WIREDFENCE_10M_DAM_F","Land_New_WiredFence_10m_F"],
    			 ["STONE_8MD_F","Land_Stone_8m_F"],
    			 ["WALL_INDCNC_4_D_F","Land_Wall_IndCnc_4_F"],
    			 ["WIRED_FENCE_4MD_F","Land_Wired_Fence_4m_F"],
    			 ["WIRED_FENCE_8MD_F","Land_Wired_Fence_8m_F"]
    			];
    for "_i" from 0 to(count medianera-1) do {
    	_Current = (medianera select _i) select 0;
        _Replacement = (medianera select _i) select 1;
        {
    		if ((toUpper(str _x) find _Current) >= 0) then {
            hideObjectGlobal  _x;
            _myReplacement = createVehicle [_Replacement, getPosATL _x, [], 0, "CAN_COLLIDE"];
            _myReplacement setDir (getdir _x);
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal true;
    		};
        } forEach nearestTerrainObjects [markerpos _marker, ["WALL", "FENCE"], _markerSize];
    };
    
    • Like 1

  2. Yeah, I´m working in a template in this sector to build a compound.

    Link part mission;

     

    With a previous version o the script with command nearestobject what i do is search for the object (that version can´t find map objects). Searchs Off or ON lamps and change it for the counterpart.

    Radio Alpha is ON, Radio Bravo is Off. (In my case I manually find the off lamps and create one by one a on version above hidding the old one)

     

    Triyng to adapt with the neastestTerrainObject goes above my little knowlegde. With your script i can find it but not create the new object.


  3. Nice! Thanks Kylania. With Wreck, Toilet and Garbage in my case is enough.

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    {
    	if ((toUpper(str _x) find "WRECK") >= 0) then {
    		hideObjectGlobal  _x;
    	};
    } foreach (nearestTerrainObjects [markerpos _marker, ["HIDE"], _markerSize]);
    {
    	if ((toUpper(str _x) find "GARBAGE") >= 0) then {
    		hideObjectGlobal  _x;
    	};
    } foreach (nearestTerrainObjects [markerpos _marker, ["HIDE"], _markerSize]);
    {
    	if ((toUpper(str _x) find "TOILET") >= 0) then {
    		hideObjectGlobal  _x;
    	};
    } foreach (nearestTerrainObjects [markerpos _marker, ["HIDE"], _markerSize]);
    

  4. Ah! in case that the p3d is rotated, the original script from Brun has a parameter build in. Great script.

     

    in that case i think it would be;

    Replace rotation for the desire degree.

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    Buildings = [["CLASSNAME","p3d",ROTATION],
                   ["CLASSNAME","EMPTY TO DELETE"]
                   ];
    for "_i" from 0 to(count Buildings-1) do {
    	_Current = (Buildings select _i) select 0;
        _Replacement = (Buildings select _i) select 1;
        _DirectionOffset = (Buildings select _i) select 2;
        {
            hideObjectGlobal  _x;
            _myReplacement = createSimpleObject [_Replacement,getPosATL _x];
            _myReplacement setDir (getdir _x) + _DirectionOffset;
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal false;
        } forEach nearestObjects [markerpos _marker, [_Current],_markerSize];
    };
    

  5. [FIX version in the post #3. thanks to Kylania]

     

    Looking for a way to remove objectmaps like junk, garbage and scrap cars within a range I come across with nearestTerrainObjects. The types name "hide" appears to be the one. There are different ones.

     

    I´ve been searching this for a while now, thanks to the help of R3vo and das attorney i adapt a script from Brun (link to the reference post). 

     

    Gamelogic>init

    null = ["MARKERNAME"] execVM "SCRIPTNAME.sqf";

    The radious is taken from the size of area marker.

     

    Script.sqf

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    {
        hideObjectGlobal  _x;
    } foreach (nearestTerrainObjects [markerpos _marker, ["HIDE"],_markerSize]);
    
    • Like 2

  6. I read about optimization and replace createvehicle with createsimpleobject. Its way faster. It cannot open or interact with the object, or destroyed but in my case its worth it. 

     

    gamelogic>init:

    null = ["markername"] execVM "script.sqf";

    script.sqf

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    Buildings = [["CLASSNAME","p3d"],
                   ["CLASSNAME","EMPTY TO DELETE"]
                   ];
    for "_i" from 0 to(count Buildings-1) do {
    	_Current = (Buildings select _i) select 0;
        _Replacement = (Buildings select _i) select 1;
        {
            hideObjectGlobal  _x;
            _myReplacement = createSimpleObject [_Replacement,getPosATL _x];
            _myReplacement setDir (getdir _x);
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal false;
        } forEach nearestObjects [markerpos _marker, [_Current],_markerSize];
    };
    

    For example; ["Land_House_Big_01_V1_ruins_F","A3\Structures_F\Households\House_Big01\i_House_Big_01_V1_F.p3d"]

     

     

    I leave here my progress in case somebody search its or google it. In my case i looking for replace a building ruined, destroyed or abandoned with a the newest version. (or deleted).


  7. Option #1. By changing the script it can use the size of the marker area.

     

    Script

    _marker = _this param [0,"CENTER",[""]];
    _Size = markerSize _marker;
    _markerSize = _Size select 1;
    buildings = [["OBJECT TO REPLACE","REPLACE WITH"],
                  [["OBJECT TO REPLACE","REPLACE WITH"]
                   ];
    for "_i" from 0 to(count Buildings-1) do {
    	_Current = (buildings select _i) select 0;
        _Replacement = (buildings select _i) select 1;
        {
            hideObjectGlobal  _x;
            _myReplacement = createVehicle [_Replacement, getPosATL _x, [], 0, "CAN_COLLIDE"];
            _myReplacement setDir (getdir _x);
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal false;
        } forEach nearestObjects [markerpos _marker, [_Current],_markerSize];
    };
    

    in a gamelogic call script;

    null = ["markername"] execVM "script.sqf";

  8. Excelent!! Thanks DAS Torney and R3vo. I use both.

     

    For reference I leave the script here. Change also the rusty building for new ones.

     

    Game Logic > INIT:

    null = ["MARKERNAME",DISTANCE] execVM "scripts\renew.sqf";
    

    renew.sqf (in scripts folder)

    _marker = _this param [0,"CENTER",[""]];
    _distance = _this param [1,100,[0]];
    myBuildings = [["Land_Cargo_House_V1_ruins_F","Land_Cargo_House_V1_F"],
                   ["Land_Cargo_House_V2_ruins_F","Land_Cargo_House_V1_F"],
                   ["Land_Cargo_House_V2_F","Land_Cargo_House_V1_F"],
                   ["Land_Cargo_House_V3_ruins_F","Land_Cargo_House_V3_F"],
                   ["Land_Cargo_HQ_V1_ruins_F","Land_Cargo_HQ_V1_F"],
                   ["Land_Cargo_HQ_V2_ruins_F","Land_Cargo_HQ_V1_F"],
                   ["Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V1_F"],
                   ["Land_Cargo_HQ_V3_ruins_F","Land_Cargo_HQ_V3_F"],
                   ["Land_Cargo_Patrol_V1_ruins_F","Land_Cargo_Patrol_V1_F"],
                   ["Land_Cargo_Patrol_V2_ruins_F","Land_Cargo_Patrol_V1_F"],
                   ["Land_Cargo_Patrol_V2_F","Land_Cargo_Patrol_V1_F"],
                   ["Land_Cargo_Patrol_V3_ruins_F","Land_Cargo_Patrol_V3_F"],
                   ["Land_Cargo_Tower_V1_ruins_F","Land_Cargo_Tower_V1_F"],
                   ["Land_Cargo_Tower_V2_ruins_F","Land_Cargo_Tower_V1_F"],
                   ["Land_Cargo_Tower_V2_F","Land_Cargo_Tower_V1_F"],
                   ["Land_Cargo_Tower_V3_ruins_F","Land_Cargo_Tower_V3_F"],
                   ["Land_Medevac_house_V1_ruins_F","Land_Medevac_house_V1_F"],
                   ["Land_Medevac_HQ_V1_ruins_F","Land_Medevac_HQ_V1_F"],
                   ["Land_Research_house_V1_ruins_F","Land_Research_house_V1_F"],
                   ["Land_Research_HQ_ruins_F","Land_Research_HQ_F"]
                   ];
    for "_i" from 0 to(count myBuildings-1) do {
    	_Current = (myBuildings select _i) select 0;
        _Replacement = (myBuildings select _i) select 1;
        {
            hideObjectGlobal  _x;
            _myReplacement = createVehicle [_Replacement, getPosATL _x, [], 0, "CAN_COLLIDE"];
            _myReplacement setDir (getdir _x);
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal false;
        } forEach nearestObjects [markerpos _marker, [_Current],_distance];
    };
    

  9. Hi, i´m trying to adapt this script that replace the ruins and destroyed military tower, but it use one marker "hardcoded" (called in this as "CENTER") and I want to use multiple markers and call it passing variables. (Without results)

     

    I´m trying passing variables like

    null ["Markername","Distance"] execVM "script.sqf";

    I tried to add at the beggining of the script and replace it;

    _markername = _this select 0;
    _distance = _this select 1;
    

    script.sqf

    buildings = [["Land_Cargo_House_V1_ruins_F","Land_Cargo_House_V1_F",0],
                   ["Land_Cargo_House_V2_ruins_F","Land_Cargo_House_V2_F",0],
                   ["Land_Cargo_House_V3_ruins_F","Land_Cargo_House_V3_F",0],
                   ["Land_Cargo_HQ_V1_ruins_F","Land_Cargo_HQ_V1_F",0],
                   ["Land_Cargo_HQ_V2_ruins_F","Land_Cargo_HQ_V2_F",0],
                   ["Land_Cargo_HQ_V3_ruins_F","Land_Cargo_HQ_V3_F",0],
                   ["Land_Cargo_Patrol_V1_ruins_F","Land_Cargo_Patrol_V1_F",0],
                   ["Land_Cargo_Patrol_V2_ruins_F","Land_Cargo_Patrol_V2_F",0],
                   ["Land_Cargo_Patrol_V3_ruins_F","Land_Cargo_Patrol_V3_F",0],
                   ["Land_Cargo_Tower_V1_ruins_F","Land_Cargo_Tower_V1_F",0],
                   ["Land_Cargo_Tower_V2_ruins_F","Land_Cargo_Tower_V2_F",0],
                   ["Land_Cargo_Tower_V3_ruins_F","Land_Cargo_Tower_V3_F",0]
                   
                   
                   ];
    
    for "_i" from 0 to(count buildings-1) do {
    
        _Current 	 = (buildings select _i) select 0;
        _Replacement = (buildings select _i) select 1;
        
    
        {
            hideObjectGlobal  _x;
        
            _myReplacement = createVehicle [_Replacement, getPosATL _x, [], 0, "CAN_COLLIDE"];
            _myReplacement setDir (getdir _x);
            _myReplacement setPosATL (getPosATL _x) ;
            _myReplacement enableSimulationGlobal false;
        } forEach nearestObjects [markerpos "CENTER", [_Current], DISTANCE];
    
    
    };
    

    Any help its appreciatted.

×