Dyeg0 2 Posted July 17, 2021 cool little script to make ai units join you in-game: Place your player on the map Place as many AI units you desire Name each the AI unit a specific Variable Name. Example: AIsoldier_1, AIsoldier_2, AIsoldier_3, etc. The Variable Name should be unique and placed in each ai attribute (under Variable Name) Place a no space trigger under "Trigger: Expression" Condition: player distance AIsoldier_1 <2 On Activation: [AIsoldier_1] join player; You will have to walk up to the ai unit (within 2 meters according to this script) to have it join your squad. Picture 1 Share this post Link to post Share on other sites
wogz187 1086 Posted July 17, 2021 @Dyeg0, Check this out, Spoiler player spawn { "auto recruit nearby units"; waitUntil {sleep 1; if ( (_this nearEntities ["Man", 3]) - [_this] isEqualTo []) then {false} else { private _recruit= ((_this nearEntities ["Man", 3])- [_this]) select 0; if ( side _recruit == side _this && group _recruit !=group _this ) then { [_recruit] join _this; false }else{false} } } } Simple recruit addAction, [player, "Recruit Unit", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "side cursorTarget == side _this && cursorTarget distance _this < 3 && group cursorTarget != group _this", "alive cursorTarget",{},{},{ params ["_target", "_caller", "_actionId", "_arguments"]; [cursorTarget] join _target; },{},[],2,0,false,true] call BIS_fnc_holdActionAdd; Have fun! 2 1 Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 18, 2021 Into init field of each AI which should join if player gets near: this setVariable ["saro_joinable", true]; set the trigger to: none, none, repeatable Condition: not ( (units side player) findIf { _x getVariable ["saro_joinable", false] and { _x distance player < 2 } } < 0 ) On Activation: [] spawn { private _near_men = player nearEntities ["Man", 2]; private _marked_men = _near_men select { _x getVariable ["saro_joinable", false] }; private _man = _marked_men select 0; _man setVariable ["saro_joinable", false]; [_man] join player; }; Now if you reach any of the AI which was marked with the init field enrtry it will join players group. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 18, 2021 12 hours ago, Dyeg0 said: Name each the AI unit a specific Variable Name. Example: AIsoldier_1, AIsoldier_2, AIsoldier_3, etc. The Variable Name should be unique and placed in each ai attribute (under Variable Name) Why naming multiple units? Your code let AISoldier_1 join players group if player is near. nothing else. no reason to name the other AI. Share this post Link to post Share on other sites
Play3r 147 Posted July 18, 2021 8 hours ago, sarogahtyp said: Why naming multiple units? Your code let AISoldier_1 join players group if player is near. nothing else. no reason to name the other AI. I guess he means that you have to make a trigger for all Ai units (AIsoldier_1, AIsoldier_2, AIsoldier_3) Cheers 1 Share this post Link to post Share on other sites
Dyeg0 2 Posted July 18, 2021 6 hours ago, Play3r said: I guess he means that you have to make a trigger for all Ai units (AIsoldier_1, AIsoldier_2, AIsoldier_3) Cheers Exactly what I meant. TY. 1 Share this post Link to post Share on other sites
Play3r 147 Posted August 27, 2021 On 7/18/2021 at 9:59 AM, sarogahtyp said: Into init field of each AI which should join if player gets near: this setVariable ["saro_joinable", true]; set the trigger to: none, none, repeatable Condition: not ( (units side player) findIf { _x getVariable ["saro_joinable", false] and { _x distance player < 2 } } < 0 ) On Activation: [] spawn { private _near_men = player nearEntities ["Man", 2]; private _marked_men = _near_men select { _x getVariable ["saro_joinable", false] }; private _man = _marked_men select 0; _man setVariable ["saro_joinable", false]; [_man] join player; }; Now if you reach any of the AI which was marked with the init field enrtry it will join players group. Hi Sarogahtyp The Condition text give me a error : invalid number in expression. I have take the text and copied it in to notepad ++ before taking it to the trigger. can you guide me about what there could be wrong in what i do. Play3r Share this post Link to post Share on other sites
sarogahtyp 1108 Posted August 27, 2021 Check the copied condition text for invisible characters or rewrite it manually. 1 Share this post Link to post Share on other sites
dvdbrewster 12 Posted February 15, 2022 On 7/17/2021 at 3:20 PM, wogz187 said: @Dyeg0, Check this out, Hide contents player spawn { "auto recruit nearby units"; waitUntil {sleep 1; if ( (_this nearEntities ["Man", 3]) - [_this] isEqualTo []) then {false} else { private _recruit= ((_this nearEntities ["Man", 3])- [_this]) select 0; if ( side _recruit == side _this && group _recruit !=group _this ) then { [_recruit] join _this; false }else{false} } } } Simple recruit addAction, [player, "Recruit Unit", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "side cursorTarget == side _this && cursorTarget distance _this < 3 && group cursorTarget != group _this", "alive cursorTarget",{},{},{ params ["_target", "_caller", "_actionId", "_arguments"]; [cursorTarget] join _target; },{},[],2,0,false,true] call BIS_fnc_holdActionAdd; Have fun! How could I make Join Group vs Unit? and join on Group Leader ? btw awesome work. Share this post Link to post Share on other sites