rtek 10 Posted June 15, 2015 (edited) I'm trying to figure out how it's possible to make an AI in group and/or myself change uniform via an addaction. I want to have a ghillie suit in my backpack, as well as in my spotter's backpack. then via an addaction, have both change into the ghillie suits and put their regular uniform into their bag so as to be able to switch back at a later time. How can this be done? At the very least, I can easily change my own uniform by moving it to the ground, putting it on, then putting my BDU into my backpack. However I mainly need to be able to make my AI group member switch his uniform. I know that I can select F2, then hit 6 and cycle with 0 through each page till I reach Open Subordinate's Inventory, and do the switch that way. I'm looking for a faster way to do the switch if possible, or a faster way to get into the AI's inventory. Edited June 15, 2015 by RTEK Share this post Link to post Share on other sites
Larrow 2822 Posted June 16, 2015 Something like.. //Type of ghillie suit _ghillie = "U_B_GhillieSuit"; //Initial add a backpack containing a ghillie to each unit (mainly for my testing) { _x addBackpackGlobal "B_Carryall_khk"; _backpack = backpackContainer _x; _backpack addItemCargoGlobal [ _ghillie, 1 ]; }forEach units group player; //Action that will swap between ghillie and uniform for player and all his subordinates player addAction [ "Put on Ghillie", { _target = _this select 0; _caller = _this select 1; _actionID = _this select 2; //Initial starting uniform of unit with action _initUniform = _this select 3 select 0; _swapTo = ""; //What are we currently wearing switch ( uniform player ) do { //if ghillie case "U_B_GhillieSuit" : { //we need to change back to our stored uniform _swapTo = _initUniform; //Update action text _caller setUserActionText [ _actionID, "Put on Ghillie" ]; }; case _initUniform : { _swapTo = "U_B_GhillieSuit"; _caller setUserActionText [ _actionID, "Put on Uniform" ]; }; }; //for each subordinate { _thread = [ _x, _swapTo ] spawn { _unit = _this select 0; _newUniform = _this select 1; //Save uniform items so they are not lost in the uniform swap _uniformItems = uniformItems _unit; //remove uniform from backpack _unit removeItemFromBackpack _newUniform; //Play some animation just for kicks _unit playAction "medic"; uiSleep 5; //get their current uniform _uniform = uniform _unit; //get the units backpack container _backpack = backpackContainer _unit; //add current uniform to backpack _backpack addItemCargoGlobal [ _uniform, 1 ]; //wear retrieved uniform _unit forceAddUniform _newUniform; //Reapply uniform items { //make sure items can fit due to different uniform sizes if ( _unit canAddItemToUniform _x ) then { _unit addItemToUniform _x; }else{ //Just add it to the backpack if not _unit addItemToBackpack _x; }; }forEach _uniformItems; }; //Pause between units to break up the.. //synchronized uniform changing championships ( SUCC lol ) uiSleep ( random 2 ); }forEach units group player; }, [uniform player], 1, true, true, "", "" ]; should do the trick, added a few extras in there like a little anim, could do with something better than the medic. Also added some checking for uniform items as in testing i noticed stuff going missing due to size differences between uniforms. Could be added to, maybe use the put action to make them put the bag on the ground infront of them etc just little touches, i did quickly try it but there were some oddities due to the bag being invisible when you wear the ghillie so didnt include it. Share this post Link to post Share on other sites
rtek 10 Posted June 17, 2015 Thanks, works great in testing. I can't get it to work in a mission using LEA for the loadout. LEA must be overwriting this script. The uniform I'm initially wearing gets put into the bag I have as a copy, the animation plays, as well for the subordinate. Except the ghillie in the bag doesn't get put on. The addaction remains as "Put on Ghillie" and will keep just copying the initial uniform into the bag. Without using LEA for a custom loadout, the script works perfectly. Share this post Link to post Share on other sites