Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

How do I give randomized events in my storygame?

2 days ago
Newbie here, I am currently creating a storygame where I hope randomized events could occur throughout the game. To make the story more unique and dynamic everytime I play it! I have read some Help and Info articles but am still a bit confused.

Example 1: You arrive at the crossroads, which side would you choose?

Left (link) : Clicking on this link could give two endings, One is good, One is Bad, but their appearance is randomized.
Right (link) : Certain death.

Example 2: A journal like diary for the player, but the events occuring in each playthrough are randomized and different in each playthrough.

If any experts are still active here, I would be eternally grateful if you could teach me some tips and tricks or redirect me to some forums or tutorials. Thanks a bunch!


How do I give randomized events in my storygame?

2 days ago

I think there is a way to do dice rolls. IIRC it's like 1D10, 1D20, etc. For example, name a variable, say, DICEROLL, set equal to 1D20 (% DICEROLL := 1D20—spaces to not screw up page) the page before, and then use a stop sign at the choice links based on the roll to determine where you go.

To make this crystal clear, the way I've done this is the dice roll bit I wrote above happens in the scripting with the top left icon of the page, and the part that is determined BY the dice roll is given in the choices at the bottom of the (next) page. I don't recall if you can do the page scripting and the choices on the same page, though.

How do I give randomized events in my storygame?

2 days ago
I don't know if "the game kills you at random regardless of your choices" is a structure I'd really recommend, but it's all pretty simple in concept. For the first example you set a variable to a random amount in the link script, then use $DEST to set the page the link takes them to based on that.

%VAR := 1D2 (The := always means "set to" )

IF %VAR = 2 (you can also use greater than or less than)
THEN
$DEST := @P24 (or whatever number)


For your second example, combine the random variables with the info in the On Page scripting article.