LoseBummer 4 Posted June 2, 2016 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. Share this post Link to post Share on other sites
das attorney 858 Posted June 2, 2016 null = ["Markername","Distance"] execVM "script.sqf"; or _null = ["Markername","Distance"] execVM "script.sqf"; or _handle = ["Markername","Distance"] execVM "script.sqf"; Don't forget the = 1 Share this post Link to post Share on other sites
R3vo 2654 Posted June 2, 2016 _marker = _this param [0,"CENTER",[""]; //Default marker is the center marker _distance = _this param [1,100,[0]]; //Default value will be 100, only typName number is accepted Replace this line: } forEach nearestObjects [markerpos "CENTER", [_Current], DISTANCE]; with } forEach nearestObjects [markerpos _marker, [_Current],_distance]; Now you can spawn the script as follows: ['YOURMAKERNAME',YOURDISTANCE] execVM "scripts.sqf"; 1 Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 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]; }; Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 And thanks to Brun from Exilemod who wrote the original script.Chernarus Building Replacement Script Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 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"; Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 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). Share this post Link to post Share on other sites
R3vo 2654 Posted June 3, 2016 Just keep in mind that the default orientation of some p3d files turned around by 180 decrees. Means if the direction of the org. building was 180, some p3ds would then have a direction of 360. 1 Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 Thanks R3vo, i´m checking that out. BTW thanks to the help i found a way to remove map objects like garbage, wrecks (AFAIK) with a variant of thats scrip. Link Here: Share this post Link to post Share on other sites
LoseBummer 4 Posted June 3, 2016 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]; }; Share this post Link to post Share on other sites
pnn 0 Posted May 10, 2017 I am having a similar issue. I am trying to modify a code "http://killzonekid.com/arma-3-bounding-box-utility/" so that a bounding box moves along with the object (pickup truck) that I created. Unfortunately I am not able to pass the variable using -null=[pickup_truck] execVM "orig_code.sqf" and the bounding box always appears on the player. Any help will be appreciated ( I am new to arma scripting). Share this post Link to post Share on other sites