How to make random events?[solved]
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- PoisionLullaby
- Regular
- Posts: 44
- Joined: Wed Jan 10, 2018 9:11 pm
- Projects: Reaching
- Deviantart: PoisionLullaby
- Contact:
How to make random events?[solved]
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.
Last edited by PoisionLullaby on Wed Jan 31, 2018 9:56 am, edited 3 times in total.
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: How to make random events?
Should it influence anything else?
If not, this is trivial:
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]"
# . . .
< < insert Rick Cook quote here > >
- PoisionLullaby
- Regular
- Posts: 44
- Joined: Wed Jan 10, 2018 9:11 pm
- Projects: Reaching
- Deviantart: PoisionLullaby
- Contact:
Re: How to make random events?
Nope that's all I needed. Thank you for the quick reply. Have a good day!
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~
- PoisionLullaby
- Regular
- Posts: 44
- Joined: Wed Jan 10, 2018 9:11 pm
- Projects: Reaching
- Deviantart: PoisionLullaby
- Contact:
Re: How to make random events?
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".
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: How to make random events?
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"])
# . . .
< < insert Rick Cook quote here > >
- PoisionLullaby
- Regular
- Posts: 44
- Joined: Wed Jan 10, 2018 9:11 pm
- Projects: Reaching
- Deviantart: PoisionLullaby
- Contact:
Re: How to make random events?
ah, okay then. Thank you for the help!
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~
Who is online
Users browsing this forum: Ahrefs [Bot]