Jump to content
Sign in to follow this  
opendome

Select Loadout Via a Crate

Recommended Posts

Hi everyone,

 

So Im trying to get a crate which players can select predefined loadouts via .sqf's through addaction but it just doesn't seem to work

 

For instance one of my init lines in the ammobox is

 

this AddAction ["Antitank","at1.sqf"];

 

and my at1.sqf looks like

 

_unit = _this select 0;
 
removeAllWeapons _unit;
 
removeBackpack _unit;
 
 
 
{_unit addMagazine "ACE_Battery_Rangefinder"} foreach [1];
 
{_unit addMagazine "ACE_30Rnd_556x45_S_Stanag"} foreach [1,2,3,4];
 
{_unit addMagazine "ACE_30Rnd_556x45_T_Stanag"} foreach [1,2,3,4];
 
_unit addWeapon "ACE_M4A1_ACOG";
 
_unit addWeapon "GBL_Keycuffs";
 
_unit addWeapon "Binocular_Vector";
 
_unit addWeapon "ACE_CharliePack";
 
{_unit addMagazine "HandGrenade_West"} foreach [1];
 
{_unit addMagazine "SmokeShellRed"} foreach [1];
 
{_unit addMagazine "ACE_Bandage"} foreach [1,2];
 
{_unit addMagazine "ACE_Morphine"} foreach [1,2];
 
{_unit addMagazine "ACE_Epinephrine"} foreach [1];
 
{_unit addMagazine "ACE_Medkit"} foreach [1];
 
{_unit addMagazine "7Rnd_45ACP_1911"} foreach [1];
 
 
_unit addWeapon "Colt1911";
 
[_unit, "ACE_Morphine", 2] call ACE_fnc_PackMagazine;
 
[_unit, "ACE_LargeBandage", 2] call ACE_fnc_PackMagazine;
 
[_unit, "ACE_Bandage", 2] call ACE_fnc_PackMagazine;
 
[_unit, "ACE_Medkit", 1] call ACE_fnc_PackMagazine;
 
[_unit, "ACE_Epinephrine", 1] call ACE_fnc_PackMagazine;
 
[_unit, "ACE_30Rnd_556x45_S_Stanag", 1] call ACE_fnc_PackMagazine;
 
[_unit, "7Rnd_45ACP_1911", 1] call ACE_fnc_PackMagazine;
 
[_unit, "HandGrenade_West", 1] call ACE_fnc_PackMagazine;
 
[_unit, "SmokeShell", 1] call ACE_fnc_PackMagazine;
 
[_unit, "SmokeShellGreen", 1] call ACE_fnc_PackMagazine;
 
_unit setVariable ["ACE_weapononback", "ACE_M136_CSRS"];
 
I can see the Antitank option in the ammobox but when I select it nothing happens?
 
Thanks!

Share this post


Link to post
Share on other sites

I jsut dont get why this isn't doing anything, it seems like it should work fine. If I use it for initial lloadouts and respawns via the units init it works fine too

 

NM: forgot to change it too _unit = _this select 1;

Share this post


Link to post
Share on other sites

Now that I got it working correctly Im having an issue with the items packed in the ruck, in ACE is there a fnc command I can use to remove the items from the ruck when switching loadouts? Right now when I switch loadouts the items remain the the pack and build up each time I switch.

 

Thanks!

Share this post


Link to post
Share on other sites

try something like:

clearWeaponCargoGlobal (unitBackpack _unit);  clearmagazineCargoGlobal (unitBackpack _unit);

Might just be without that Global part, might not work at all, not sure.

Share this post


Link to post
Share on other sites

Thanks for the help! I gave it a shot and it doesn't work, the weird thing with ACE is that it defines backpacks as weapons and has its own pack magazine function (call ACE_fnc_PackMagazine;). So I also tried making a loadout where it clears everything

 

_unit = _this select 1;
 
 
 
removeAllWeapons _unit;
 
removeBackpack _unit;
 
clearWeaponCargoGlobal (unitBackpack _unit);  
 
clearmagazineCargoGlobal (unitBackpack _unit);
 
so it does work by clearing all weapons/magazines/backpack etc but as soon as I switch to one of the other loadouts it still carries over items in the ruck from the initial loadout.

Share this post


Link to post
Share on other sites

nm dug around and found

 

[player, "BTH"] call ACE_fnc_RemoveGear;
 
[player, "WOB"] call ACE_fnc_RemoveGear;

Share this post


Link to post
Share on other sites

so it seems to work fine but one add thing is everytime someone joins the mission while others are still playing, the rucks inventory disapears? Should I add

 

waitUntil {!isNull player}; 

 

or maybe it has something to do with 

 

waitUntil {!isNil "ace_sys_ruck"};

waitUntil {ace_sys_ruck};

 

ro should it be [unit, "BTH"] call ACE_fnc_RemoveGear;?

Share this post


Link to post
Share on other sites

nm changed the initial loadout to [unit, "BTH"] call ACE_fnc_RemoveGear; which fixed the JIP issue

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
Sign in to follow this  

×