Jump to content
Sign in to follow this  
pedwards3x

Add Magzine into Weapon?

Recommended Posts

Anyone know how to force a weapon given to a player to start with a magazine? When I add magazines to the player they just go into the inventory, so when the player spawns they have mags but have to reload in order to put one in their weapon to start. Any way to fix that?

Share this post


Link to post
Share on other sites

Problem is though sometimes you will not have space for the magazine until the weapon is added.

Share this post


Link to post
Share on other sites

Still no solution for how to add magazine into weapon that is already equipped? Is this completely impossible? If so, might be worth a ticket on the tracker.

Share this post


Link to post
Share on other sites

Remove the weapon, then immediately afterward add a magazine and add the weapon again.

I tested it holding an empty weapon, then doing what I said above adds a magazine to it without having to reload.

I don't really know what the problem is though, you mean if you have full inventory but pick up an empty weapon and want a mag in it?

Share this post


Link to post
Share on other sites

Your suggestion didn't work for me, Ranger.

However, I finally figured it out! :D

Not working, magazine won't be loaded:

player addMagazine _magazine;
player addWeapon _weapon;

Works, weapon will be loaded:

player addMagazine _magazine;
sleep 0.001;
player addWeapon _weapon;

Share this post


Link to post
Share on other sites

Make sure you add a vest BEFORE adding multiple magazines, else it wont be stored.

Share this post


Link to post
Share on other sites

Space really wasn't the issue, at least in my case. It just needed the micro-sleep. I try to avoid sleeps in functions, like most people, but it really seems necessary in this case. :(

Edit:

There you go... seems to be working as well, weapon will be loaded:

player addMagazine _magazine;
waitUntil {(_magazine in (magazines player))};
player addWeapon _weapon;

Edited by sxp2high

Share this post


Link to post
Share on other sites

No need for sleeping as far as I'm aware...

However space is still a very big issue, especially now in 0.76 where launcher ammo does not fit into a vest and thus you cannot load add a loaded launcher without adding a backpack first.

Share this post


Link to post
Share on other sites

_muzzle = [player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;

Equips the player with an underwater rifle and six dual purpose magazines.

_muzzle = [player, "arifle_SDAR_F", 6, 1] call BIS_fnc_addWeapon;

OR

_muzzle = [player, "arifle_SDAR_F", 6, "30Rnd_556x45_Stanag"] call BIS_fnc_addWeapon;

Equips the player with an underwater rifle and six normal magazines.

Share this post


Link to post
Share on other sites

You need to load the weapon a bit later than the magazine. With this line:

_workaround = this spawn {waitUntil{time > 0.5}; _this addweapon "srifle_EBR_ACO_F"}; 

This is my loadout:

this = _this select 0;

RemoveAllWeapons this;
{this removeMagazine _x;} foreach (magazines this);
removeUniform this;
removeVest this;
removeBackpack this;
removeGoggles this;
removeHeadGear this;
{
this unassignItem _x;
this removeItem _x;
} foreach (assignedItems this);

this addmagazine "20Rnd_762x51_Mag";
_workaround = this spawn {waitUntil{time > 0.5}; _this addweapon "srifle_EBR_ACO_F"};
_workaround = this spawn {waitUntil{time > 1}; _this addPrimaryWeaponItem "optic_Sos"};
_workaround = this spawn {waitUntil{time > 1}; _this addPrimaryWeaponItem "acc_pointer_IR"};
_workaround = this spawn {waitUntil{time > 1}; _this addPrimaryWeaponItem "muzzle_snds_B"};
this addmagazine "16Rnd_9x21_Mag";
_workaround = this spawn {waitUntil{time > 1}; _this addweapon "hgun_Rook40_F"};
_workaround = this spawn {waitUntil{time > 1}; _this addHandgunItem "muzzle_snds_L"};
_workaround = this spawn {waitUntil{time > 1}; _this addWeapon "Rangefinder"};
_workaround = this spawn {waitUntil{time > 1}; _this addWeapon "B_UavTerminal"};

this addVest "V_HarnessOGL_brn";
this addmagazine "16Rnd_9x21_Mag";
this addmagazine "20Rnd_762x51_Mag";
this addmagazine "20Rnd_762x51_Mag";
this addmagazine "20Rnd_762x51_Mag";
this addmagazine "20Rnd_762x51_Mag";
this addmagazine "20Rnd_762x51_Mag";
this addmagazine "20Rnd_762x51_Mag";
_workaround = this spawn {waitUntil{time > 1}; _this addmagazine "SatchelCharge_Remote_Mag"};

this adduniform "U_B_SpecopsUniform_sgg";
this addItem "FirstAidKit";
this addMagazine "HandGrenade";
this addMagazine "HandGrenade";
this addMagazine "SmokeShellGreen";
this addMagazine "SmokeShellGreen";
this addMagazine "SmokeShellGreen";
this addMagazine "SmokeShell";
_workaround = this spawn {waitUntil{time > 1}; _this additem "optic_Arco"};

this addbackpack "B_Kitbag_mcamo";
this addmagazine "Titan_AT";
this addWeapon "launch_B_Titan_short_F";
this addmagazine "Titan_AT";
this addmagazine "Titan_AT";
this addmagazine "Titan_AT";

this addHeadgear "H_Beret_brn_SF";
this assignItem "H_Beret_brn_SF";
this addGoggles "G_Lowprofile";
this assignItem "G_Lowprofile";	
this addItem "ItemMap";
this assignItem "ItemMap";
this addItem "ItemRadio";
this assignItem "ItemRadio";
this addItem "ItemWatch";
this assignItem "ItemWatch";
this addItem "ItemCompass";
this assignItem "ItemCompass";

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  

×