Page 1 of 1

How to make random events?[solved]

Posted: Mon Jan 29, 2018 1:17 pm
by PoisionLullaby
So I was wondering how I can go about making some events random. Basically I'm wanting the player to choose "Play video games" and then have it say "I played (Randomized game)". To be clear I'm using DSE and the choice is when you choose what to do on the day planner.

Re: How to make random events?

Posted: Mon Jan 29, 2018 1:58 pm
by Ocelot
Should it influence anything else?

If not, this is trivial:

Code: Select all

# somewhere in the beginning of script outside of any label
define game_names = ["Karma", "Tremor", "FuchsHolz", "Frenzy"]

# In script itself
$ game = renpy.random.choice(game_names)
"I played [game]"
# . . .

Re: How to make random events?

Posted: Mon Jan 29, 2018 2:21 pm
by PoisionLullaby
Nope that's all I needed. Thank you for the quick reply. :) Have a good day!

Re: How to make random events?

Posted: Mon Jan 29, 2018 4:51 pm
by PoisionLullaby
Actually I do have further questions. How would I go about making the random choices influence or I guess have the potential to influence other things? Lets say for example I want the player to pick "go outside" on the day planner and then randomize potential outcomes like before. but this time one is an event where you have no choice (They just go on a calm walk with randomized creatures or something small like that) and the other outcome is an event where you can then choose to do "option a" or "option b".

Re: How to make random events?

Posted: Tue Jan 30, 2018 1:48 pm
by Ocelot
THere are many different ways to do that. One of them is to make several labels for different events and randomly jump into one (or call one).

Code: Select all

label walk_with_creatures:
    # Some stuff
    return

label event_with_choice:
    # Some stuff
    return

# . . . 
menu:
    "what do you want to do?"
    "Relax in your room":
        "you spend some time doint nothing"
    "go outside":
        call expression renpy.random.choice(["walk_with_creatures","event_with_choice"])
# . . .

Re: How to make random events?

Posted: Wed Jan 31, 2018 9:56 am
by PoisionLullaby
ah, okay then. Thank you for the help! :)