darkdespair55 10 Posted July 26, 2022 Hello All, So I am trying to make a CIA style mission based around one of the redone buildings on Cam Lao Nam (Multiplayer, self or server hosted). The players will start off as unarmed Blufor operatives in civis and take a ride on Air America. I know I need to use the setCaptive command but I am having issues with the event handler to remove this status. I am using eden editor and not putting extra script files in, just doing it all via the character init boxes. I found some of the below code on an older post but cant get it to work right. In this case SL1 is the squad leader and I'm trying this all just on one before copying it over. The goal is that when the player equips a weapon from the virtual arsenal box I have hidden in a van near the objective they lose the setCaptive state. Any help debugging whats below would be appreciated. *INIT BOX (Of the player)* removeAllWeapons SL1; //remove the weapons and items from default characters inventory removeAllItems SL1; removeAllAssignedItems SL1; SL1 setCaptive true; //set initial captive state this addEventHandler ["Take", { _unit = _this select 0; //at one point it would error out if I had this set at 0 but it seems to be accepting it now. *EDIT/Updated* _item = _this select 2; if ((_item isKindOf ["Rifle", configFile >> "CfgWeapons"]) || (_item isKindOf ["Pistol", configFile >> "CfgWeapons"]) || (_item isKindOf ["Launcher", configFile >> "CfgWeapons"])) then { _unit setCaptive false; //this is what was in the example [_unit, false] remoteExec["setCaptive"]; //tried adding server remote call and it didnt change anything. hint "You picked up a weapon enemies will now be hostile!"; }; }]; myfancygroup = group this; //This is for a helicopter to know the whole spawned group is onboard before taking off Share this post Link to post Share on other sites
Harzach 2505 Posted July 26, 2022 Quote _unit = _this select 1; //example has a 0 here but the editor rejects it as an invalid number so I incremented +1 You can't choose your own syntax. In this case, _unit now refers to the container. From the Biki: Quote unit: Object - unit to which the event handler is assigned So, add your event handler to the player, not the box. Keep things clear by using the given params: this addEventHandler ["Take", { params ["_unit", "_container", "_item"]; if ((_item isKindOf ["Rifle", configFile >> "CfgWeapons"]) || (_item isKindOf ["Pistol", configFile >> "CfgWeapons"]) || (_item isKindOf ["Launcher", configFile >> "CfgWeapons"])) then { _unit setCaptive false; hint "You picked up a weapon - enemies will now be hostile!"; }; }]; You shouldn't need to remoteExec setCaptive as it is GE. Share this post Link to post Share on other sites
darkdespair55 10 Posted July 26, 2022 12 minutes ago, Harzach said: You can't choose your own syntax. In this case, _unit now refers to the container. From the Biki: So, add your event handler to the player, not the box. Sorry if I made a confusing statement. that is all in the init field of the player not of the arsenal box. I have had it show the hint but it failed to change setCaptive. I tried again and it magically accepted 0 this time However the "Take" action is not triggering on grabbing weapons from the virtual arsenal. If the player drops a weapon then picks it up again it works. Is there a similar function to work with the virtual arsenal? Share this post Link to post Share on other sites
Harzach 2505 Posted July 26, 2022 3 hours ago, darkdespair55 said: virtual arsenal. You don't "take" from the VA, that's the problem. It needs to be an ammobox with a real inventory. You could maybe check for weapons in player inventory while near the box, or something along those lines. Share this post Link to post Share on other sites
pierremgi 4737 Posted July 27, 2022 or use: weapons player isNotEqualTo [] (no need to specify)... in a little loop. 1 Share this post Link to post Share on other sites
Harzach 2505 Posted July 27, 2022 weapons player isNotEqualTo [] This will return true if the player has binoculars, though. Share this post Link to post Share on other sites