Search the Community
Showing results for tags 'dismiss ai'.
Found 1 result
-
I've been working on a little lightweight recruitment and dismissing script for editor placed AI units. So far it works well in single player games, as you can recruit and dismiss AI units repeatedly and at will. In my noobiness, I decided to achieve this via 4 small .sqf files inside a folder called wRecruit: recruiting.sqf - file content below: /* Usage: put this in INIT of the unit to be recruited; nul=[this] execVM "wRecruit\recruiting.sqf"; */ _guyNotRecruited = true; _fng = _this select 0; _fng setcaptive true; _recruitGuy = _fng addAction ["Recruit","wRecruit\newguyinit.sqf"]; while {_guyNotRecruited} do { if (not(captive _fng)) then {_guyNotRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _recruitGuy}; sleep 1; }; _fng removeAction _recruitGuy; [_fng] join (group player); _fng enableAI "MOVE"; sleep 1; nul = [[["New Team Member recruited.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; sleep 5; nul=[_fng] execVM "wRecruit\dismissing.sqf"; __________________________________________________________ newguyinit.sqf - file content below: // set unit not captive _unit=_this select 0; _unit setCaptive false; __________________________________________________________ dismissing.sqf - file content below: _guyRecruited = true; _fng = _this select 0; _dropGuy = _fng addAction ["Dismiss","wRecruit\dropguyinit.sqf"]; while {_guyRecruited} do { if (captive _fng) then {_guyRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _dropGuy}; sleep 1; }; _fng removeAction _dropGuy; [_fng] join grpNull; _fng setCaptive true; sleep 1; if (not alive _fng) then { hint "Team member deceased"; } else { nul = [[["Team Member dismissed.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; nul=[_fng] execVM "wRecruit\recruiting.sqf"; }; sleep 5; ____________________________________________________ dropguyinit.sqf - file content below: // set unit captive _unit=_this select 0; _unit setCaptive true; _____________________________________________________ This works well in single player but I would love to know how to make this multiplayer-compatible without making the script too big or cumbersome. ?? Also, how would I be able to implement this on units spawned in-game by other scripts? I used setCaptive as the condition needed to achieve the effect I wanted but I'm sure there are different ways or conditions that could be used similarly?