I have several variables in my game meant to represent different classes a player can end up with. There's a chain of questions meant to set up a character's class, but I also want an option if the player chooses a really scattershot combination of answers that doesn't fit any particular class. Basically, I want the class variable to be randomly assigned.
I tried to use Random to do this, but it kicked back that Random only allowed for numbers. Is there a way I'm missing to set random variables with a click? Thanks!
Comments
(set $myClass to (either: ...$classOptions) will set the player's class randomly to any of the ones defined in the $classOptions array. This will inherently make your $myClass variable become whatever variable type it gets randomly assigned. So if your $mage is already setup as its own Array, it could hold randomly assigned class stats (magicka, health, strength etc..)
I'm using Harlowe right now.
This is how i set my random variables in sugarcube. I guess story format is not necesary in twine 2
<<set $variable1 to random($lowerValue,$higherValue)>>
<<set $variable2 to random($lowerValue,$higherValue)>>
...
More in http://twinery.org/wiki/function#random_value_value
The Harlowe version of your example would be: .. in Harlowe (random:) is a macro where as in SugarCube random() it is a Javascript function.