Jump to content
  • 0

Respawn Weapon+ammo


Gromes

Question

2 answers to this question

Recommended Posts

  • 0

Cameltoe's

14 Apr 2015

V1va, on 12 Apr 2015 - 08:43 AM, said:

So currently no way to spawn a gun with 1-3 mags of its specific ammo?

I found a solution:

in your fn_LSgetBuildingstospawnLoot.SQF

find

//special for weapons

if(_lootType == 1) exitWith {

_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];

_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));

_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);

_lootholder addWeaponCargoGlobal [_loot, 1];

_lootholder setdir (random 360);

_lootholder setPosATL _spwnPos;

and right after that insert this

//Function to add the right magazine for a weapon.

_ammo = [] + getArray (configFile >> "cfgWeapons" >> _loot >> "magazines");

_lootholder addMagazineCargoGlobal [(_ammo select 0),(round(random 3))]; //max 3 magazines per weapon

//end custom funtion

_lootholder setdir (random 360);

_lootholder setPosATL _spwnPos;

where this (round(random 3) number defines how many magazines will spawn.

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...