Creating multiple inventories and modifying their behaviour

Hi, I am a university student in my final year and am making an IF game as part of my dissertation.

I wanted to create two more inventories on top of the existing default one to use as health and mana storage. I was thinking that I could have an ‘inventory’ full of e.g. 10 health units so that I could incorporate some kind of RPG style fights in my IF game. When the enemy hits you successfully, you lose health unit(s) and when this ‘inventory’ is empty, game over. Similarly with mana to cast magic.

Does anyone know a way I can do this? There doesn’t seem to be a lot of info on the Inventory class.

Thanks for your help!

John

There is no such thing as an Inventory class in the standard adv3 library for there to be any information on. An actor’s inventory is basically the list of objects located within the actor in the containment hierarchy. But do you actually need an Inventory class (or any kind of inventory) for this, or simply a property that stores a number? For example:

modify Actor
    health = 10
    mana = 10
;

Okay, that makes sense, thanks. Thought I’d be able to add this as a variable to the block:

  • me: Actor
    location = cell
    health = 100
    mana = 0;

but it doesn’t seem to like this! Just starting out so still figuring my way around the language but sure I can sort it out somehow. Someone on another forum suggested initiating these as integer variables (perhaps this should be established in the gameMain section rather than the ‘me: Actor’ section?) and using the verb ‘diagnose’ to return the values (status) to the player. Not sure how to modify/add my own parser commands yet though.

Thanks for your help,

John