Psymon

Guns Spawn with respective ammo

2 posts in this topic

I'm building my loot tables for my server and the way it looks it'll spawn a gun based off the % chance, and ammo from the % but if it spawns gun X it won't spawn with gun X ammo.   Is there a way to force the type of ammo that spawns based off the gun that spawns.  Include the ammo with the gun?

Share this post


Link to post
Share on other sites

The default system already does this.

case 2: 	
		{ 
			_lootHolder addWeaponCargoGlobal [_itemClassName, 1]; 
			if !(_itemClassName isKindOf ["Exile_Melee_Abstract", configFile >> "CfgWeapons"]) then
			{
				_magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines");
				if (count(_magazineClassNames) > 0) then
					{
						_magazineClassName = selectRandom _magazineClassNames;
						_numberOfMagazines = 1 + floor(random 2); // Spawn Less Ammo
						_lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines];
						_spawnedItemClassNames pushBack _magazineClassName;
					};
			};
					_numberOfItemsToSpawn = -1;
		};

 

Edited by kuplion

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.