Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Help with making random passage destinations less random (Harlowe 1.2.2, Twine 2.0.11)

The basic set-up: I have a maze-like area, with a "hub" room that randomly leads to one of 10-ish other rooms. Using (either: ) means each of those rooms has a roughly equal likelihood of being found. The player then returns to the hub and gets another random room the next time they explore.

What I would like to do is set it up so that rooms that have already been seen are less likely to come up on subsequent explorations, but still have a small chance to do so. I have a couple VERY rough ideas as to how to set this up, but hoped that maybe someone out there had a solid method for doing such a thing.

Hopefully that explanation is clear. Thanks!

Comments

  • Um... someone correct me if I'm wrong, but you could store the values (room names of numbers) in an array, use (either:) on the array:
    (set: $rooms to (a: rm1, rm2, rm3))
    (set: $selected to (either: ...$rooms))
    
    That would just select one, and they all would have the same chance always, until you add something that takes the room out of the array, like this:
    (set: $rooms to $rooms - $selected)
    
    With this setup, though, you can only go to the room once, so maybe you could add a chance that the room will be removed (all code):
    (set: $rooms to (a: rm1, rm2, rm3))
    (set: $selected to (either: ...$rooms))
    (set: $remove to (either: 0, 1))
    (if: $remove is 1)[(set: $rooms to $rooms - $selected)]
    
    By changing the last either statement to have more values (i.e. pick 1, 2 or 3, but it only counts if it's 1) you can change the chance. Anyway I pretty much just started with Harlowe and Twine so someone please correct me if I'm wrong.
Sign In or Register to comment.