aussie battler

[Release] Recruit Ai Bodyguards

140 posts in this topic

Description: Recruit Ai Body guards from your XM8 or from placed objects on the map.

How it works: Recruit an Ai Guard from your Xm8 using beef parts. The ai will auotmatically join the group (controlled by the player who made the party).

Rules: Ai despawns on restarts. Ai only attacks mission ai (only tested on DMS Ai).

Command Ai movement:
1. Press ESC>Configure>Controls>Show:Command

2. Change the "ACTION" of "Select Unit 1" to the key of your choice (I used "semicolon"). Press "OK" and go back to the game.

3. Press "semicolon" to select your Ai, then hit "space bar"

4. Move your mouse to the position you wish the Ai to hold or vehicle you wish the Ai to enter. Now hit the "space bar" :)

Command Ai to drive:

1. Exist a vehicle from a passenger seat.
2. Order the Ai will hop in the vehicle.
3. Get in the vehicle & mark waypoints on the map. You can also take over driving.

(thanks to @TheDaddy for the Ai driving tip)

I would like to change the ai behaviour to help kill other Exile Players out of the players group & also command the Ai. Let me know if you have any ideas.

Install: Recruit Ai from your XM8.

  1. Install ExAd by @Janski https://goo.gl/VBxFFa

  2. Drop the DeployVehicle folder into your.mission\ExAdClient\XM8\Apps\DeployVehicle   found here https://github.com/aussie-battler/Salty-Dog-Exile-Recruit-Ai
    Make sure you drop the Deploy Vehicle server file in your @ExileServer/addons folder found here https://github.com/aussie-battler/Salty-Dog-Exile-Recruit-Ai/tree/master/ExileServer/addons

  3. In config.cpp search for class CFGXM8 

         Add the following to extraApps[] = { };
 

Spoiler

"ExAd_Unit"

        The line should now read: extraApps[] = {"ExAd_Unit"};

  1. Underneath the class CfgXM8, edit it to read:

         

Spoiler

class CfgXM8
{
    extraApps[] = {"ExAd_Unit"};
    
        class settings
    {
        controlID = 4070;
        appID = "App01";
        title = "Settings";
    };
    
    class healthScanner
    {
        controlID = 4120;
        appID = "App02";
        title = "Health Scanner";
    };
    
    class slothMachine
    {
        controlID = 4140;
        appID = "App03";
        title = "Sloth Machine";
    };
    
    class ExAd_Unit
    {
        title = "Recruit Soldier: x2 Beef Parts needed";
        logo = "ExAdClient\XM8\Apps\DeployVehicle\dog.paa";
        bambiState = 0;
        vehicleClass = "Land_AncientStatue_01_F";
        recipe[] = {{"Exile_Item_BeefParts",1}};
        packable = 0;
        autoCleanUp = 0;
        quickFunction = "['ExAd_Unit'] call ExAd_XM8_DV_fnc_spawnVehicle";
    };

};

/*
    XM8 Extra apps, the Exile way of doing it
    
    Here is an example app layout:
    class XM8_App01_Button: RscExileXM8AppButton1x1
    {
        textureNoShortcut = "";      // Path to picture. This can be via mission file or client side PBO
        text = "";                    // The name of the app to be display on the button
        onButtonClick = "";            // The code to fire when the app is clicked
        resource = "";                // The name of the resource to load for the app, leave as an empty string if you just want to run code without a GUI, like BOOM or spawning a bike
    };
*/

class XM8_App01_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "\exile_assets\texture\ui\xm8_app_settings_ca.paa";
    text = "Settings";
    onButtonClick = "['settings', 0] call ExileClient_gui_xm8_slide";
    resource = "XM8SlideSettings";
};

class XM8_App02_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "\exile_assets\texture\ui\xm8_app_health_scanner_ca.paa";
    text = "Health Scanner";
    onButtonClick = "['healthScanner', 0] call ExileClient_gui_xm8_slide";
    resource = "XM8SlideHealthScanner";
};

class XM8_App03_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "\exile_assets\texture\ui\xm8_app_slothMachine_ca.paa";
    text = "Sloth Machine";
    onButtonClick = "['slothMachine', 0] call ExileClient_gui_xm8_slide";
    resource = "XM8SlideSlothMachine";
};

class XM8_App04_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "\exile_assets\texture\ui\xm8_app_boom_ca.paa";
    text = "BOOM!";
    onButtonClick = "call ExileClient_system_breaching_detonate";
    resource = "";
};


class XM8_App5_Button: RscExileXM8AppButton1x1
{
textureNoShortcut = "ExAdClient\XM8\Apps\Unit\dog.paa";
text = "Recruit Soldier: 1x Beef Parts needed";
onButtonClick = "ExileClientXM8CurrentSlide = 'apps';closeDialog 0;[] execVM 'ExAdClient\XM8\Apps\Unit\bodyguard.sqf'";
resource = "";
};

class XM8_App06_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App07_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App08_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App09_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App10_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App11_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App12_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App13_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};

class XM8_App14_Button: RscExileXM8AppButton1x1
{
    textureNoShortcut = "";
    text = "";
    onButtonClick = "";
    resource = "";
};   

      5.  In config.cpp search for BeefParts and change the line to:          

Spoiler

class Exile_Item_BeefParts                                 { quality = 1; price = 50000; sellPrice = 14;};              // change the buy/sell price to whatever suits.

 

Want to make changes?

  1. Change the XM8 logo at:

your.mission\ExAdClient\XM8\Apps\DeployVehicle\dog.paa

In config.cpp under "class ExAd_Unit", change the line to suit your logo name

logo = "ExAdClient\XM8\Apps\DeployVehicle\dog.paa";

  1. Change the soldiers at:

your.mission\ExAdClient\XM8\Apps\DeployVehicle\bodyguard.sqf (line 7)

Here are the classnames: https://community.bistudio.com/wiki/Arma_3_CfgVehicles_GUER

Infistar Settings (thanks to @1Man):
Add "Craft Vehicle" to the allowedActions section:

allowedActions[] = {"Break free","Use AutoLockPicker","Craft Vehicle","Hack UAV"};

Future Updates:

Would love the ai to attack players not in your group. Not sure how to command the ai, I tried keybinding commands (like target) but it didn't work.
Let me know if you have ideas on how to do this.

Thanks to @Janski for making the cool EXAD XM8 Apps and @BetterDeadThanZed for the custom buildings to server addons script.

Enjoy!! aussie

 

OPTIONAL EXTRA:

Spawn the Ai from a mobile phone thanks to @1Man

If you want to allow owners to pick another option I have this if you want to add it.

config.cpp

Spoiler

Under class CfgInteractionMenus

    class Bodyguard
    {
        targetType = 2;
        target = "Land_SatellitePhone_F";
        class Actions
        {
            class Body_guard: ExileAbstractAction
            {
                title = "Deploy AI";
                condition = "('Exile_Item_MobilePhone' in (magazines player) && !ExilePlayerInSafezone)";
                action = "ExAdClient\XM8\Apps\DeployVehicle\bodyguard.sqf";
            };
        };
    };

Under class CfgXM8

    class ExAd_Unit
    {
        title = "AI Support";
        config = "ExAdClient\XM8\Apps\DeployVehicle\guard.sqf";
        logo = "ExAdClient\XM8\Apps\JX\icon_man.paa";
        bambiState = 0;
        vehicleClass = "Land_SatellitePhone_F";
        recipe[] = {{"Exile_Item_MobilePhone",1}};
        autoCleanUp = 1;
        quickFunction = "['ExAd_Unit'] call ExAd_XM8_DV_fnc_spawnVehicle";
        onLoad = "ExAdClient\XM8\Apps\DeployVehicle\guard.sqf";
    };

guard.sqf

Spoiler

ExAd_DV_DESPAWN_IDLE_TIME = 300;

ExAd_XM8_DV_fnc_itemsInCargo = {
    params ["_container","_itemArray","_item","_amount","_response"];

    _item = toLower (_itemArray select 0);
    _amount = _itemArray select 1;

    _response = false;
    {
        if(_item == toLower _x)then{
            _amount = _amount - 1;
        };
        if(_amount <= 0)exitWith{_response = true}
    }forEach magazines player;

    _response    
};

ExAd_XM8_DV_fnc_itemsMissing = {
    params["_recipe","_recipeStr"];
    
    _recipeStr = "";
    {
        private["_amount","_configName","_displayName","_text"];
        _amount = if(count _x > 1)then{_x select 1}else{1};
        _text = [_x select 0] call ExAd_XM8_DV_fnc_getDisplayName;
        _recipeStr = _recipeStr + format["%1x : %2<br />",(if(_amount < 0)then{((-1) * _amount)}else{_amount}), _text];
    }forEach _recipe;
    
    _response = format["You need <br />%1",_recipeStr];

    _response
};

ExAd_XM8_DV_fnc_getDisplayName = {
    params["_class","_configName","_displayName"];
    _configName = _class call ExileClient_util_gear_getConfigNameByClassName;
    _displayName = getText(configFile >> _configName >> _class >> "displayName");
    _text = if(count _displayName > 0)then{_displayName}else{_class};

    _text
};

ExAd_XM8_DV_fnc_canPack = {
    ( ExileClientInteractionObject getVariable["ExAd_DV_Packable", false] )
};

ExAd_XM8_DV_fnc_pack = {
    [ExileClientInteractionObject] spawn {
        params["_obj"];
    
        disableUserInput true;
        player playActionNow "Medic";

        uiSleep 3;
        ["despawnDeployableVehicle", [netId _obj]] call ExAd_fnc_serverDispatch;
        uiSleep 1;

        ["SuccessTitleAndText", ["Vehicle Packed"]] call ExileClient_gui_toaster_addTemplateToast;
        disableUserInput false;
    };
};

ExAd_XM8_DV_fnc_spawnVehicle = {
    params["_slideClass","_bambiState","_delopyRecipe","_vehicleClass"];

    try
    {    
        _bambiState = if(isNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState")) then
        {
            if(getNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState") > 0)then{true}else{false}
        } else {true};

        if(_bambiState && !ExileClientPlayerIsBambi) then { throw "You can only spawn vehicles as a bambi!"};

        _delopyRecipe = getArray(missionConfigFile >> "CfgXM8" >> _slideClass >> "recipe");
        if(count _delopyRecipe > 0) then
        {
            {
                if(count _x > 1) then
                {
                    _amount = if(_x select 1 == -1)then{1}else{_x select 1};
                    if!([player, [_x select 0, _amount]] call ExAd_XM8_DV_fnc_itemsInCargo) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    };
                } else {
                    if!([player, _x select 0] call ExileClient_util_playerEquipment_contains) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    }
                }
            }forEach _delopyRecipe;

            {
                _count = if(count _x > 1)then{(_x select 1)}else{1};
                for "_i" from 1 to _count do {
                    [player, _x select 0] call ExileClient_util_playerCargo_remove
                }
            }forEach _delopyRecipe;
        };

        _vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _slideClass >> "vehicleClass");
        if!(isClass(configFile >> "CfgVehicles" >> _vehicleClass ))then { throw "The vehicle class doesn't exist"};

        [_slideClass] spawn {
            params["_slideClass"];
            disableUserInput true;
            player playActionNow "Medic";

            uiSleep 3;
            ["spawnDeployableVehicle", [netId player, _slideClass]] call ExAd_fnc_serverDispatch;
            uiSleep 1;
            ["SuccessTitleAndText", ["Request AI w/ scroll option"]] call ExileClient_gui_toaster_addTemplateToast;
            ExileClientXM8CurrentSlide = "extraApps";
            disableUserInput false;
        };    

        ["extraApps", 1] call ExileClient_gui_xm8_slide;
        closeDialog 0;


    }
    catch{
        [_exception] spawn {
            UISleep 0.5;
            ["ErrorTitleAndText", ["ExAd - Deploy Vehicle", _this select 0]] call ExileClient_gui_toaster_addTemplateToast;
            ["extraApps", 1] call ExileClient_gui_xm8_slide;
        };
    };
};

bodyguard.sqf

Spoiler

/** Salty Dog Exile: Recruit Ai V.2
**  by aussie 2017
** https://github.com/aussie-battler/Salty-Dog-Exile-Recruit-Ai

    Thanks to geekm0nkey for updating the following:
 +  Fixed toast message not displaying when you didn't have beef parts.. Hint: ( }; else { wont work.. take out the ; )
 +  Added delay during animation so the solider doesn't show till after.. Just my personal preference.
 +  No spawn in safezone.
**/

private ["_statue","_unit","unitList"];
    if(ExilePlayerInSafezone) exitWith {
        ["ErrorTitleAndText", ["Deployment Failed!", "You can't deploy soldier in trader!"]] call ExileClient_gui_toaster_addTemplateToast;
    };
    if ("Exile_Item_BeefParts" in (magazines player)) then
    {
    player removeItem "Exile_Item_BeefParts";
    disableUserInput true;
    player playMove "AinvPknlMstpSnonWnonDr_medic3"; 
    uisleep 10;
    unitList = ["I_Soldier_AT_F","I_ghillie_lsh_F","I_ghillie_sard_F","I_G_Sharpshooter_F"];
    _unit = group player createUnit [unitList select (round(random ((count unitList) - 1))), getPos player, [], 0, "FORM"];
    _unit setskill ["aimingAccuracy",0.9];
    _unit setskill ["aimingShake",0.9];
    _unit setskill ["aimingSpeed",0.9];
    _unit setskill ["spotDistance",0.9];
    _unit setskill ["spotTime",0.9];
    _unit setskill ["courage",1.0];
    _unit setskill ["reloadSpeed",1.0];
    _unit setskill ["commanding",1.0];
    _unit setskill ["general",0.9];
    _unit setCombatMode "RED";
    _unit allowFleeing 0;
    _unit setVariable ["ExileMoney",15000,true];
    ["SuccessTitleAndText",["Bodyguard Deployed, shoot him before restart to get his money."]] call ExileClient_gui_toaster_addTemplateToast;
    _statue = nearestObject [player, "Land_AncientStatue_01_F"];
    deleteVehicle _statue;
    disableUserInput false;
    }
    else
    {
       ["ErrorTitleAndText", ["Deployment Failed!", "You need beef parts..."]] call ExileClient_gui_toaster_addTemplateToast;
    }; 
}; 

Changelog:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

6.09.17 Updated the Ai skill level which can be set in Exile.Mission/ExAdClient/XM8/Apps/DeployVehicle/bodyguard.sqf

Currently it is set to:

Spoiler

    _unit setskill ["aimingAccuracy",0.9];
    _unit setskill ["aimingShake",0.9];
    _unit setskill ["aimingSpeed",0.9];
    _unit setskill ["spotDistance",0.9];
    _unit setskill ["spotTime",0.9];
    _unit setskill ["courage",1.0];
    _unit setskill ["reloadSpeed",1.0];
    _unit setskill ["commanding",1.0];
    _unit setskill ["general",0.9];
    _unit setCombatMode "RED";
    _unit allowFleeing 0;

To learn more about Ai skill settings head to http://www.exilemod.com/topic/13096-guide-how-to-configure-the-ai-properly/
by Tobias Solem

Thanks to @TheDaddy for the idea.

Control your ai with this mod: http://steamcommunity.com/sharedfiles/filedetails/?id=491016790 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

6.09.17 Updated instructions on commanding the Ai to move & stay.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12.03.18 Updated for Exile 1.0.4's new XM8 apps.
+ Removed the deploy statue, it confused players.
+ Updated the script to only deploy cool ai units.
+ Ai can now be recruited in a safe zone.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

20170731154131_1.jpg

20170731153857_1.jpg

20170731154509_1.jpg

20170731154233_1.jpg

Edited by aussie battler
Updated for Exile 1.0.4's new XM8 apps.
6 people like this

Share this post


Link to post
Share on other sites
Advertisement

i dont know why i cant test this on your server salty dog malden. i get kicked i dont know. 

Share this post


Link to post
Share on other sites

ah shit :D  ^^ Germany its a little bit Long way hehe ;)  can  you whitelist me for the Test ? ^^ 

Share this post


Link to post
Share on other sites

@Its me ZovkT I have lifted the ping kick for you. Let me know when you are done so I can change it back. You spawn in with 100k in your locker.

Spawn a quad from your XM8, head to trader & buy x2 packets of beef parts. Head outside of the safezone & hit 6, more and hit the recruit ai button.

Probably worth heading towards a mission before you spawn one.

Good luck.

Share this post


Link to post
Share on other sites

@Its me ZovkT 

Head to Arudy after you pick up beef parts from the trader. I have left lots of spawn statues at the church for you.

20170801020835_1.jpg

20170801020607_1.jpg

20170801022014_1.jpg

Edited by aussie battler

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.