How to use Random on Variables
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.
- neometalero
- Regular
- Posts: 198
- Joined: Sun Oct 23, 2016 3:51 am
- Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Deviantart: neometalero
- Contact:
How to use Random on Variables
I want to know how can I create a random between 1 and 10 for example to use on a variable.
- Onomatopoeia
- Regular
- Posts: 40
- Joined: Wed Jan 11, 2012 7:36 pm
- Location: GA
- Contact:
Re: How to use Random on Variables
Hello, new friend! You'd use the 'random' code for that. The exact code to use would be:
It may do you well to check out the 'Other Functions' documentation (https://www.renpy.org/doc/html/other.html), there are all sorts of fun codes on that page. Random is located at the very bottom.
Code: Select all
renpy.random.randint(1, 10)
- neometalero
- Regular
- Posts: 198
- Joined: Sun Oct 23, 2016 3:51 am
- Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
- Deviantart: neometalero
- Contact:
Re: How to use Random on Variables
Tks a lot, I will read that. If I want to store this random variable for future use would be something like this?Onomatopoeia wrote:Hello, new friend! You'd use the 'random' code for that. The exact code to use would be:
It may do you well to check out the 'Other Functions' documentation (https://www.renpy.org/doc/html/other.html), there are all sorts of fun codes on that page. Random is located at the very bottom.Code: Select all
renpy.random.randint(1, 10)
Code: Select all
$ d10roll = renpy.random.randint(1,10)
Who is online
Users browsing this forum: Google [Bot]