Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Creating random items

$
0
0
Hello everyone!
Currently I'm working on creating a small game and I am rather fond of random things but I am currently running into a problem.

I try to create random things, let's say like this:

Weapon - can be a spear, a sword, an axe
made out of - wood, iron, bronze
with a random crystal attached - namely sapphire, ruby, etc.

so it would look like this:
<<set $Weapon to ["Sword", "Spear", "Bow", "Axe", "Staff"]>>
<<set $Material to ["Stone", "Bronze", "Silver", "Iron", "Wood"]
<<set $Gem to ["Ruby", "Emerald", "Saphire"]>>

These would allow for randomly created items with one characteristic from each of these three categories. Now I only need to know on how to incorporate all of these into a single item.

I think I have to work with arrays to get this done, which actually isn't such a problem to set up - I just need to understand how these randomly generated items can be added into the game. It might be necessary to use the .push - thingy, but I am still puzzled on how to do it right.

Oh, I am using sugarcube by the way but don't let that stop you.

Viewing all articles
Browse latest Browse all 1844

Trending Articles