Jump to content

Recommended Posts

Hello.

Would be knowledge and skills.
I do CTF multiplayer and AI should have the same equipment as the player. But here's the problem and how to get a functional entity.

player gear
(CBA_A3 and NIARms all in one)

 

_this = player;
_mag1 = selectRandom [7,9,11,13,17,21];
_mag2 = selectRandom [5,7,9,11,13];

removeAllWeapons _this;
removeAllAssignedItems _this;
removeAllContainers _this;
removeGoggles _this;
removeHeadgear _this;
removeVest _this;
removeUniform _this;

 

//Clothing
if (side player == east) then {
    _this addUniform "U_OG_Guerilla1_1";
    _this addGoggles "G_Shades_Red";
    _this addHeadgear "H_Booniehat_khk";
    _this addVest "V_TacVest_camo";
    _this addBackpack "B_TacticalPack_rgr";
    _this addMagazine "SmokeShellRed";
    if ((daytime < 7) or (daytime > 17)) then {
        _this addItem "NVGoggles_OPFOR";
        _this assignItem "NVGoggles_OPFOR";
    };
};
if (side player == west) then {
    _this addUniform "U_BG_Guerilla2_3";
    _this addGoggles "G_Shades_Blue";
    _this addHeadgear "H_Booniehat_oli";
    _this addVest "V_TacVest_camo";
    _this addBackpack "B_TacticalPack_rgr";
    _this addMagazine "SmokeShellBlue";
    if ((daytime < 7) or (daytime > 17)) then {
        _this addItem "NVGoggles";
        _this assignItem "NVGoggles";
    };
};

//Items
_this addWeapon "ItemMap";
_this addWeapon "ItemCompass";
_this addWeapon "ItemRadio";
_this addWeapon "ItemWatch";
_this addWeapon "ItemGPS";
_this addItem "FirstAidKit";
_this addItem "FirstAidKit";

for "_i" from 1 to 2 do {_this addItemToBackpack "HandGrenade";};

private _weapon1 = selectRandom 
[
//Assault Rifles
"Weapon_hlc_rifle_bcmblackjack",
"hlc_rifle_honeybadger",
"hlc_rifleACR_SBR_cliffhanger",
"hlc_rifle_aek971",
"hlc_rifle_ak47",
"hlc_rifle_ak74",
"hlc_rifle_akm",
"hlc_rifle_aks74",
"hlc_rifle_aks74u",
"hlc_rifle_vendimus",
"hlc_rifle_RU5562",
"hlc_rifle_RU556",
"hlc_rifle_auga3_b",
"hlc_rifle_auga3_bl",
"hlc_rifle_auga3",
"hlc_rifle_bcmjack",
"hlc_rifle_Bushmaster300",
"hlc_rifle_M4a1carryhandle",
"hlc_rifle_FAL5061Rail",
"hlc_rifle_hk51",
"hlc_rifle_G36C",
"hlc_rifle_hk53",
"hlc_rifle_416D10_ptato",
"hlc_rifle_416D10_RAHG",
"hlc_rifle_416D10_geissele",
"hlc_rifle_416D145_wdl",
"hlc_rifle_416D145_tan",
"hlc_rifle_SAMR",
"hlc_rifle_samr2",
"hlc_rifle_M14_Rail",
"hlc_rifle_RK62",
"hlc_rifle_m14sopmod",
"hlc_rifle_slr107u",
"hlc_rifle_BAB",
"hlc_rifle_416C",
//Light Machine Guns
"hlc_rifle_rpk",
"hlc_rifle_rpk74n",
"hlc_lmg_MG3",
"hlc_lmg_MG42",
"hlc_lmg_m60",
//SMG
"hlc_smg_mp510",
"hlc_smg_mp5a3",
"hlc_smg_mp5k_PDW",
"hlc_smg_MP5N",
//Sniper Rifleman
"hlc_rifle_M1903A1",
"hlc_rifle_M1903A1OMR",
//Shotgun
"hlc_rifle_saiga12k"
];

[_this,_weapon1,_mag1] call BIS_fnc_addWeapon;

sleep 2;

 

//pistols
private _weapon2 = selectRandom ["hlc_Pistol_M11","hlc_pistol_Mk25","hlc_pistol_P226WestGerman","hlc_Pistol_P228","hlc_Pistol_M11A1","hlc_Pistol_M11A1D","hlc_pistol_Mk25D","hlc_Pistol_mk25RX","hlc_pistol_Mk25TR","hlc_pistol_P226US","hlc_pistol_P226R","hlc_pistol_P226R_Combat","hlc_pistol_P226R_357Combat","hlc_pistol_P226R_40Combat","hlc_pistol_P226R_Elite","hlc_pistol_P226R_357Elite","hlc_pistol_P226R_40Elite","hlc_pistol_P226R_40Enox","hlc_pistol_P226R_Stainless","hlc_pistol_P226R_357","hlc_pistol_P226R_40","hlc_pistol_P229R","hlc_pistol_P229R_Combat","hlc_pistol_P229R_357Combat","hlc_pistol_P229R_40Combat","hlc_pistol_P229R_40Enox","hlc_pistol_P229R_357Stainless","hlc_pistol_P229R_357","hlc_pistol_P229R_40","hlc_pistol_P229R_Elite","hlc_pistol_P229R_357Elite","hlc_pistol_P229R_40Elite","hlc_pistol_P239","hlc_pistol_P239_357","hlc_pistol_P239_40"];

[_this,_weapon2,_mag2] call BIS_fnc_addWeapon;

Share this post


Link to post
Share on other sites

It helps if you use code tags. Also, it won't work for AI as you have:

_this = player;

Change it to:

params ["_unit"];
// Change all:
_this
// To:
_unit
// Pass argument to script/function
[player]
0 = [this] // Eden Editor
// You will need to adjust accordingly in AI script

Might be useful too:

 

Share this post


Link to post
Share on other sites

@HazJ
I tried the script but somehow did not work at all.
I'll try it again, at some point. Fortunately, there are many scripts of this type.
It was great that you posted this website. That helped the future.

Share this post


Link to post
Share on other sites

How does it not work? Or is it you doing it wrong? Any errors? I shall test this evening to be sure but looks okay to me. Make sure to declare function and pass argument to it.

Share this post


Link to post
Share on other sites

I may do something wrong, I will try my best to find out where I do wrong. (at this minute)

Share this post


Link to post
Share on other sites

Or... Show me code / info so I can help you better.

Share this post


Link to post
Share on other sites

When do you want that? for what units? player's group, player's side?  We guess it's MP, but try to explain what you want, when. You need code, we need to understand the purpose.

 

Example: In editor, you can select all units you want and right click for editing loadout. Then you have all these units similar, by this simple selection.

If you need something evolving and scripted, it's possible. Just say what/when/for who you want that.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×