anaximandross 34 Posted February 6, 2019 I'm working on writing a script that assembles objects using the bohemia object mapper function. This function is called from multiple objects that are spawned in by another script. I'm using _this select 0, but its returning this: [228ae7e56080# 620815: vergepost_01_f.p3d,bis_o2_4896,0,<null>] Here is the script: Spoiler if(!isServer) exitWith {}; (_this select 3) params ["_target","_facilityType","_facilityCost"]; _plot = (_this select 0); hint format ["%1",_plot]; _storPosit = getPos _plot; //hint format ["%1",_storposit]; if(GLOBALSCRAP > _facilityCost) then { if (_facilityType isEqualTo "foodS") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType isEqualTo "foodL") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType isEqualTo "workshopS") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType isEqualTo "workshopL") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType isEqualTo "storageS") then { hint "this"; private _choice = selectRandom [1,2]; if (_choice isEqualTo 1) then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\AmmoStorage.sqf"))] call BIS_fnc_ObjectsMapper; } else { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\AmmoStorage_2.sqf"))] call BIS_fnc_ObjectsMapper; }; }; }; And this is the addAction that is calling the above: Spoiler _postPole addAction ["Build a Small Farm (15 Scrap)", {[_this,"foodS",15] execVM "Compositions\assembler.sqf"}]; Share this post Link to post Share on other sites
pierremgi 4906 Posted February 6, 2019 In addAction, _this will be equivalent as params ["_target","_caller","_id","_arguments"] so (_this select 3) is _arguments To make it works, you have to write something like: _postPole addAction ["Build a Small Farm (15 Scrap)", {_this execVM "Compositions\assembler.sqf"},["foods",15] ]; so _arguments select 0 (or _this select 3 select 0) will be "foods" and _arguments select 1 (or _this select 3 select 1) will be 15 On the other hand, there is no need to pass as arguments some "hard" values like "foods" or 15, but rather something like [_food,_cost], coming from your outer script. Share this post Link to post Share on other sites
anaximandross 34 Posted February 6, 2019 1 minute ago, pierremgi said: In addAction, _this will be equivalent as params ["_target","_caller","_id","_arguments"] so (_this select 3) is _arguments To make it works, you have to write something like: _postPole addAction ["Build a Small Farm (15 Scrap)", {_this execVM "Compositions\assembler.sqf"},["foods",15] ]; so _arguments select 0 (or _this select 3 select 0) will be "foods" and _arguments select 1 (or _this select 3 select 1) will be 15 I actually just fixed my first problem, and I THINK you just fixed my second one as soon as I got that! Let me try this out, and i will report back in a few minutes. Share this post Link to post Share on other sites
anaximandross 34 Posted February 6, 2019 @pierremgi I've been working on this script for about two weeks now, and you've just helped me get the final touches on it! Thank you so much!!!! 1 Share this post Link to post Share on other sites