[ZS] Easier way to set max item capacity with backpack items

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [ZS] Easier way to set max item capacity with backpack items

Re: [ZS] Easier way to set max item capacity with backpack i

by Graf Zahl » Fri Apr 29, 2022 1:32 am

I can give you Get/SetAmmoCapacity functions, like in ACS. This kind of operation is not safe for non-ammoi tems

[ZS] Easier way to set max item capacity with backpack items

by kevansevans » Thu Mar 24, 2022 12:57 pm

The outdated entry on the wiki brought this to my attention: https://zdoom.org/wiki/Classes:BackpackItem
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:
Spoiler:
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:

Code: Select all

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.

Top