However, the quantity of contained ammunition, and the size of the increase are qualities of the ammunition, not of the backpack. Therefore, it is not possible to make several different types of backpacks, such as a "regular backpack" that would double the basic carrying capacity and a "super backpack" that would triple it, for example. Or a "cursed backpack" that would reduce carrying capacity.
I know this is in regards to DECORATE, and how that is not currently possible, however in ZScript it is, and I have written a backpack replacement that allows each backpack to stack onto each other:
Class GHAGBackpack : Backpack replaces Backpack
{
override bool HandlePickup (Inventory item)
{
if (item is 'BackpackItem')
{
for (let probe = Owner.Inv; probe != NULL; probe = probe.Inv)
{
let ammoitem = Ammo(probe);
if (ammoitem && ammoitem.GetParentAmmo() == ammoitem.GetClass())
{
if (ammoItem.maxAmount <= ammoItem.BackpackMaxAmount * 20) {
ammoItem.MaxAmount = ammoitem.MaxAmount * 1.5;
if (ammoItem.MaxAmount >= (ammoItem.BackpackMaxAmount * 20)) ammoItem.MaxAmount = ammoItem.BackpackMaxAmount * 20;
if (ammoitem.Amount < ammoitem.MaxAmount || sv_unlimited_pickup)
{
int amount = ammoitem.Default.BackpackAmount;
if (!bIgnoreSkill)
{
amount = int(amount * G_SkillPropertyFloat(SKILLP_AmmoFactor));
}
ammoitem.Amount += amount;
if (ammoitem.Amount > ammoitem.MaxAmount && !sv_unlimited_pickup)
{
ammoitem.Amount = ammoitem.MaxAmount;
}
}
}
}
}
item.bPickupGood = true;
return true;
}
return false;
}
}
And quite frankly, this is hecking hideous. Would it be possible to have a function in the Inventory class that can explicitly change the max capacity of an item/items without whatever it was I posted above? ACS has this functionality, with SetAmmoCapacity, so I don't see why not ZScript can have it. Ideally, I would like to see something like:
Inventory.setMaxAmount(Class Name, Double Multiplier, Bool specific value);
Class name being anything that is that class and inherits from it, a double being the multiplier (IE 2 for backpack behavior), and a bool if the user wants to set a very specific value.