rkemsley 10 Posted June 21, 2021 I have some boxes (Weapon's Cache) scattered across my map. They can be "retrieved" by any BLUFOR player (BLUFOR player has to use the hold action), which removes the box, adds CuratorPoints to all BLUFOR Curators and removes the question mark from the map (where the box is located). They can also be "destroyed" by any Independent unit (Independent player and AI has to use the hold action), which removes the box and removes the question mark from the map (stopping the BLUFOR Curators from gaining CuratorPoints). I currently have this in the init of all the boxes scattered across the map. Reveal hidden contents [ this, "retrieve weapons cache.", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", "_this distance _target < 4 && side _this == west && isPlayer _this", "_caller distance _target < 4 && side _this == west && isPlayer _this", {}, {}, { _this call { { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); { _x addCuratorPoints 0.1 } foreach [ ZeusBLUFOR1_1_Curator, ZeusBLUFOR1_2_Curator, ZeusBLUFOR1_3_Curator, ZeusBLUFOR1_4_Curator ]; deleteMarker "Zeus_M_Unknown1_1"; }; }, {}, [], 4, 0, true, false ] remoteExec [ "BIS_fnc_holdActionAdd", 0, this ]; [ this, "destroy weapons cache.", "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa", "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa", "_this distance _target < 4 && side _this == independent", "_caller distance _target < 4 && side _this == independent", {}, {}, { _this call { { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); deleteMarker "Zeus_M_Unknown1_1"; }; }, {}, [], 4, 0, true, false ] remoteExec [ "BIS_fnc_holdActionAdd", 0, this ]; When used by any player, the trigger just removes the question mark from the map and nothing else. I think I need to use remoteExec for the deleteVehicle part and the addCuratorPoints, but I do not know how to use that function. Please help! Share this post Link to post Share on other sites
killzone_kid 1332 Posted June 21, 2021 deletevehicle is global command why do you want to use remoteexec? it already can be executed from any client or server Share this post Link to post Share on other sites
rkemsley 10 Posted June 21, 2021 On 6/21/2021 at 4:57 PM, killzone_kid said: deletevehicle is global command why do you want to use remoteexec? it already can be executed from any client or server On 6/21/2021 at 3:42 PM, rkemsley said: When used by any player, the trigger just removes the question mark from the map and nothing else. I think I need to use remoteExec for the deleteVehicle part and the addCuratorPoints, but I do not know how to use that function. When a player uses the BIS_fnc_holdActionAdd, the boxes are not removed and CuratorPoints are not added. Share this post Link to post Share on other sites
killzone_kid 1332 Posted June 22, 2021 Once again, deleteVehicle will delete whatever from any client, most likely you are looking at the wrong cause 1 Share this post Link to post Share on other sites
mrcurry 508 Posted June 22, 2021 { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); Is the objects in a Eden Editor Layer called WeaponCache1_1? @rkemsley Share this post Link to post Share on other sites
sarogahtyp 1109 Posted June 22, 2021 (edited) . Edited June 22, 2021 by sarogahtyp deleted nonsense Share this post Link to post Share on other sites
rkemsley 10 Posted June 22, 2021 (edited) On 6/22/2021 at 8:21 AM, mrcurry said: { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); Is the objects in a Eden Editor Layer called WeaponCache1_1? @rkemsley There are 3 objects which are not named, all grouped together in the Eden Editor Layer called WeaponCache1_1. (Some of the boxes are located in buildings) I have a trigger that destroys the boxes if the building they are in is destroyed, which works fine. It only seems to be an issue with the BIS_fnc_holdActionAdd. Edited June 22, 2021 by rkemsley Wasn't clear about the name Share this post Link to post Share on other sites
rkemsley 10 Posted June 22, 2021 On 6/22/2021 at 6:51 AM, killzone_kid said: Once again, deleteVehicle will delete whatever from any client, most likely you are looking at the wrong cause I can't see what the cause is, that's my issue! Share this post Link to post Share on other sites
pierremgi 4906 Posted June 22, 2021 The name of the layer must be WeaponCache1_1 (not "WeaponCache1_1") then { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); works.... if applied on server (due to getMissionLayerEntities Share this post Link to post Share on other sites
rkemsley 10 Posted June 22, 2021 On 6/22/2021 at 6:11 PM, pierremgi said: The name of the layer must be WeaponCache1_1 (not "WeaponCache1_1") then { deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" select 0 ); works. Edited previous reply, wasn't clear on the name of the MissionLayerEntities. Share this post Link to post Share on other sites
pierremgi 4906 Posted June 22, 2021 so check from where you are running this code (must be server only) getMissionLayerEntities >>> SE means >>>> https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality EDITED: If you run it inside an holdActionAdd, you must remote exec it on server (I known you dislike that but it's same problematic as some curator commands 😁) {{deleteVehicle _x } forEach ( getMissionLayerEntities "WeaponCache1_1" #0)} remoteExec ["call",2]; 1 Share this post Link to post Share on other sites
kibaBG 54 Posted May 20, 2023 @pierremgiHi, I have similar problem. I am trying to delete a spawned from script box (CargoNet_01_box_F) on dedicated server. The trigger to delete the box is like this //Activation Anybody Present Repeatable //Condition (typeOf (thisList select 0) == "CargoNet_01_box_F") //ON Activation deleteVehicle (thisList select 0); private _var = missionNamespace getVariable "KIBA_BuildingPoints"; private _var = _var + 1; KIBA_BuildingPoints = _var; publicVariable "KIBA_BuildingPoints"; On dedicated the player gets the Building Point but the crate is not deleted. Preplaced in editor crates get deleted fine. Only spawned during the mission cannot be deleted. Any ideas? Share this post Link to post Share on other sites
pierremgi 4906 Posted May 20, 2023 anybody present returns all units/rabbits / crates & weapon holders.... So there is few chance for your cargo net to be the first element of thisList. If you spawn a box, you can apply a code on it, no need for a trigger... just choose a condition. In other words, trigger is not the best tool for deleting something you spawned, especially a box or an object not a unit or vehicle. 1 Share this post Link to post Share on other sites
kibaBG 54 Posted May 20, 2023 @pierremgiYou are right but ... The problem is, I want the crate to be transported to a FOB, where a "special building" exists and the trigger is next to this building giving it its "functions". Update: I tried to make addAction to spawned crates that can be used when inside trigger, works with local host, does not work with dedi: _crate addAction ["Produce Building Points", { if ((_this select 0) inArea bp_trig) then { deleteVehicle (_this select 0); private _var = missionNamespace getVariable "KIBA_BuildingPoints"; private _var = _var + 2; KIBA_BuildingPoints = _var; publicVariable "KIBA_BuildingPoints"; } else {hint "Move crate to Cargo Container"}; }, nil, 1.5, false, true,"", "true", 2, false,"",""]; pb_trig is just the name of a trigger with no conditions. Share this post Link to post Share on other sites
mrcurry 508 Posted May 22, 2023 On 5/20/2023 at 6:34 PM, kibaBG said: The problem is, I want the crate to be transported to a FOB, where a "special building" exists and the trigger is next to this building giving it its "functions". Have the trigger condition check the entire thisList for the existence of a box in the list. count is a good command for this. On activation iterate through the thisList and delete any boxes you come across. Any ol' loop will do but forEach is syntactically the simplest. 1 Share this post Link to post Share on other sites
kibaBG 54 Posted May 22, 2023 @mrcurryThank you so much for the suggestion, I will test it when I get home and reply. Share this post Link to post Share on other sites
pierremgi 4906 Posted May 22, 2023 private _action = [ "Produce Building Points", { if ((_this select 0) inArea bp_trig) then { deleteVehicle (_this select 0); KIBA_BuildingPoints = KIBA_BuildingPoints + 2; publicVariable "KIBA_BuildingPoints" } else { hint "Move crate to Cargo Container" } },nil,1.5,false,true,"","true",2,false,"","" ]; [_crate, _action] remoteExec ["addAction",[0,-2] select isDedicated,_crate]; 1 Share this post Link to post Share on other sites
kibaBG 54 Posted May 26, 2023 @pierremgi Works flawlessly, thank you so much. Share this post Link to post Share on other sites