I am using some really helpful code I found in this forum for an inventory system. It works great if something is true or false, for example : you start with no gun and then buy one and it appears in your inventory. However, if you buy bullets these would need a numerical variable ie 6 bullets , then 5 when one is fired etc etc
The inventory can’t show this, it can just show bullets yes or no
I don’t want them in the stats as it is perfectly legitimate in the game to not buy a gun in teh first place , having them as a stat would make them seem vital
Would there be a way to display this ? or alternatively I could just “tell” the reader hoe many are left each time they fire?
here is the startup code:
*create bullets 0
*create gun false
and the shop code
*if (gun = false)
*selectable_if (gold >= 10) #I'd like to buy the Gun
“A Mark 1 Enfield revolver. This packs a punch even Sir Malcolm would be jealous of” says the shopkeeper, his placid eyes twinkling a little.
*set empty_inventory false
*set gun true
*set bullets 6
*set gold -10
*goto top
I would make a second variable, bulletsNumber or something like that, so you could make bullets a boolean, which shows if there are any and the bulletsNumber to show how much you have.
in the inventory you can set an:
*if (bullets)
bullets @{bulletsNumber}
or something similar
it makes it easier to add/reduce bullets
Hi and thanks, I only do this at the weekend so there will be no further daft questions for a least a week
Thank you for your patience and help.
This is happening because I am separating stats and inventory. When you start the game and check stats it looks like this:
Skill: 8
Stamina: 17
Luck: 8
Gold: 20
Inventory: You are carrying nothing
Later, when you find a map and or buy stuff at the shop it looks like this:
Skill: 8
Stamina: 17
Luck: 8
Gold: 0
Inventory: Gun, Clip of 6 bullets, Provisions, Map
The code is flipping things from false to true and then they appear in the inventory
I “could” add bullets to stats, but this would place in the readers mind a need to go off and get bullets. In fact, using the gun and bullets is a bit of a blind alley for the reader
Because bullets are a numerical varaiable I can’t make them a true or false in this inventory system.
Ideally it should read in the inventory Bullets 6
and then when one is fired, Bullets 5 etc etc