How to make a list/items


#1

So, what is the best way to make a list of items? how can i add additional items to do this?


#2

By items you mean like swords, staves etc? Will they have different attributes?


#3

If you’re asking to make an inventory system, it’s pretty easy. Make a variable for that item in startup.
*create iron_sword false
Once the player gets that item, set it to true. Then, in the stats screen, you only need this.
*if iron_sword
Iron Sword/Sword.


#4

Or:
*create iron_sword 0
And add one every time the player gets a new sword, with this in the stats screen:

*if (iron_sword >= 1)
    Iron sword * ${iron_sword}

#5

Well, yeah, it’s just I think that’d mostly be useful for more RPG themed games so I just check the condition whether it’s true or false. The system can be tweaked and modified to perform better of course, but I haven’t shown interest in it.


#6

To clarify, I mean that when presented with combat, there will be different dialogue trees/outcomes depending on which weapon/item you use. I won’t be calculating different damages per item, but want the player/reader to be aware on what they have. I wanted to have an ordered list without having to make a thousand different options, and wanted to know if i could simply put multiple (and sometimes random) items in order.


#7

Like, if they had a sword and a spear it would say “Sword, Spear” but if they had a backpack, gun, and sword it would say “Gun, Backpack, Sword”


#8

Do you mean making this appear in the text or in the choices?

If it’s in the choices, you can make variables to check if the player has a specific type of item; set these true or false after the player has finished selecting his inventory. For example:

*create has_sword false
*create has_spear false
*create has_gun false
*create has_backpack false

Then when time comes to use them, you would add conditions to the choices, so that they only appear when the player has the specific item type.

An angry dog charges you, what will you do?

*choice
   *if (has_sword) #Slash him with my sword.
      *goto slashDog
   *if (has_spear) #Use my spear.
      *goto spearDog
   *if (has_gun) #Shoot him.
      *goto shootDog
   *if (has_backpack) #Try to smack him with my backpack.
      *goto backpackDog
   #Attack with my bare hands.
      *goto punchDog

For displaying the currently equipped items, you could do it like this:

@{has_sword ${sword_name}|}

@{has_spear ${spear_name}|}

@{has_gun ${gun_name}|}

@{has_backpack ${backpack_name}|}

This one uses multi replace to show the item name if there is one; if the player doesn’t have an item of the type, no text will appear.

More on multireplace here:


#9

It is sort of like that… I wanted to list items in the choicescript_stats file so players are aware of what they have. Will the multi replace help to show a one- lined, list of items?