I posted this in another topic, but I'm posting here so that everyone can find it easier. This is a simple inventory I came up with that stores item properties in arrays.
This is how to set the properties of weapons and armors. The first parameter in the array is the item's name, the second parameter is the Attack plus it gives in combat, and the third parameter is the Defence plus it gives in combat.
Weapon1Stats$ = "RustyDagger 10 0"
Weapon2Stats$ = "BattleAxe 14 0"
Weapon3Stats$ = "LongSword 20 0"
Armor1Stats$ = "LeatherVest 0 8"
Armor2Stats$ = "ChainMail 0 12"
Armor3Stats$ = "SpikedCuiras 3 17"
How to set the player's weapon/armor properties to those of another item: (in other words, how to equip an item
)
PlayerWeaponStats$ = Weapon1Stats$
PlayerArmorStats$ = Armor1Stats$
How to reference the properties of an item:
PlayerWeaponName$ = WORD$ PlayerWeaponStats$ 1
PlayerArmorName$ = WORD$ PlayerArmorStats$ 1
WeaponAttackPlus$ = WORD$ PlayerWeaponStats$ 2
ArmorAttackPlus$ = WORD$ PlayerArmorStats$ 2
WeaponAttackPlus = VAL WeaponAttackPlus$
ArmorAttackPlus = VAL ArmorAttackPlus$
WeaponDefencePlus$ = WORD$ PlayerWeaponStats$ 3
ArmorDefencePlus$ = WORD$ PlayerArmorStats$ 3
WeaponDefencePlus = VAL WeaponDefencePlus$
ArmorDefencePlus = VAL ArmorDefencePlus$
Attack = Attack + WeaponAttackPlus
Attack = Attack + ArmorAttackPlus
Defence = Defence + WeaponDefencePlus
Defence = Defence + ArmorDefencePlus
It's fairly straight forward. You shouldn't have to edit any of the code to use it, so you don't even have to understand it. All you have to do is set the values of "Weapon1Stats" "Weapon2Stats" and so on. If you
do understand it however, you could add extra parameters to the arrays such as attribute bonuses or durability. Or even the item's sell price.
It's easy to mod.