Making random events

Hey everyone!

I’m hoping to try and make a game, but I had an idea of randomizing the start of my story with different beginnings. Is that possible? And if so, how can I do it? I’m tried doing the

*label event0
And
*****Seed0

But I still don’t really understand everything.

Please help me :pray:

5 Likes

First of all, welcome to the forum. I’m hoping you know what will be the base for the player to get a different beginning as they start the story.

Do you meed the story will start like:

Prologue

From as far as you remember you always like the color:

*fake_choice
 #Red.
  *goto redbeginning
 #Blue.
  *goto bluebeginning
 #Green.
  *goto greenbeginning

Is that what you mean or?

Choicescript does have a *rand command. You can read more about it here.

To achieve what you’re trying to do, I think your code would look something like this unless I am mistaken.

*temp prologue_check 0
*rand prologue_check 1 5

*if (prologue_check = 1)
         Random prologue #1.
         *goto prologue_1
*elseif (prologue_check = 2)
        Random prologue #2.
        *goto prologue_2
*elseif (prologue_check = 3)
        Random prologue #3.
        *goto prologue_3
*elseif (prologue_check = 4)
        Random prologue #4.
        *goto prologue_4
*else
       Random prologue #5.
       *goto prologue_5

*label prologue_1
       Prologue Number One.

*label prologue_2
       Prologue Number Two.

*label prologue_3
       Prologue Number Three.

*label prologue_4
       Prologue Number Four.

*label prologue_5
       Prologue Number Five.
4 Likes

To randomise your start scene you can do the following.

In startup

*create origin 0

Then at the start of your game do this.

[TITLE HERE]
*rand origin 1 3
*page_break
*if origin = 1
    ORIGIN ONE.
    *goto one
*elseif origin = 2
    ORIGIN TWO.
    *goto two 
*else
    ORIGIN THREE.
    *goto three

Edit: @AChubbyBlackCat beat me to the punch but either way would work.

5 Likes

Hi! Thank you for replying :smiling_face:

An example I could only think of is like when you have a baby and you don’t know what gender, how many they are, and when your baby will come out.

So like, if ever you end up playing the baby, or playing the mothers, the beginning would be so random. Maybe you gave birth months earlier than the due date. Maybe you don’t only have one kid but twins, or even triplets.

It’s literally going to be a hard thing to make if the beginning already has random beginnings, and the storyline would be so hard to keep track off, but every time I read a Choice of Game story, I keep thinking, what would happen if this or that happened instead of the beginning I’m reading?

3 Likes

Hey! Thanks for replying!

I saw the_black_reaper’s comment, and I do want to know if there is a difference between

*rand prologue_check 1 5

And

*rand origin 1 3

I kinda hope it’s not a stupid question asi know prologue and origin are two different things, but when putting the code in at the start of the game, i think they’re both the same, but I still would like to know if they have any differences

Hi!

Oh! Okay… It’s a little bit easy to understand!

But I do have a question, before writing

*if (prologue_check = 1)
Random prologue #1
*goto prologue 1

And etc.

Do you write the many different prologues that you want to randomize? And if so, how do you do it?

*prologue 1
Blah blah blah ?

From what you said to CC_Hill, it sounds more like you have a list of permanent variables that would be randomized to create variations within the prologue. So it depends on how you want to write these prologues. I assumed you’d be giving the readers a prologue that they’d read through (growing up in a poor family, middle class family, a rich family, etc.) but I can see that might not be the case.

Malin Ryden, author of the Fallen Hero series, has a demo for the next book, Retribution. In it, you can create a random character. That sounds more like what you’re trying to achieve. You can look at Malin’s startsettings.txt file here and get an idea of how Malin did it.

Not @Nocturnal_Stillness, but here’s the answer to your question.

No, there’s no difference between the labels besides their name. They’re still serving the same purpose as a unique label name for the variable, so as not to receive a bug, but otherwise they’re the same.

Forgot to mention, you can @/USERNAME if you want to reply to multiple people in a single reply so as not to clutter a thread with your own posts.

I used a randomizer for the gender of your baby in The Parenting Simulator, which worked along similar lines to what has already been outlined here (except a bit less advanced, I must admit; I never did master the elseif command). Also used it to allow for randomized events if the player preferred that to seeing everything in one go. They’re a lot of fun, but the page breaks are key. If you don’t insert a page_break between the randomizer running and the reader seeing the results, anytime they go to the stat page and then return it will reroll the result. As long as they have yet to see the result that’s not an issue, because they’ll never know it’s rerolling. But if they can see it, it will be a little jarring to see one outcome at one moment and another after they return from the stat screen.

2 Likes