Some help with making randomized dialogue

Harlowe 3.3.3

i am looking for some help on how I’d go about making randomized dialogue. i am also wondering if there would be a way to add a % / Percentage chance of triggering each one. so some would be more rare than others.

sorry, i am still rather new and not sure where to start with it or what changers, commands or whatever else i can use to actually get it started.

1 Like

First of all, Harlowe has a built in random number macro that should help. The simplest way to set it up would be something like this:

(set: $foo to (random 1,10))
(if: $foo < 9)[Common dialog!]
(elseif: $foo is 10)[Rare dialog!]

You can also look into using arrays with your dialog and use the random number as an index.

(Pardon any mistakes - I’m not super familiar with Harlowe.)

3 Likes

I’m not sure quite how “random” you mean but you could look into the Tracery library by Kate Compton. I’m not sure how easy this would be to use from Twine but I guess doable.

Wow, thanks for that. to be honest, i had no idea you could actually set things to a random, i tried binding things to them earlier and gave up on it, this is rather surprising and helpful for me. i can now do alot more with randoms now that i got n idea of how to set them out and use them. thanks for the help!

1 Like

No problem! There’s all kinds of useful things built into Harlowe–I’d recommend taking a deep dive through the manual sometime just to familiarize yourself with the kind of things it can do.