Been nonstop watching your channel ever since I started making a project, you teach so many cool things and in such a simple way, thanks a lot for these tutorials!
Thank you so much! Your walkthrough was easy to understand and follow, and through your tutorial, I was able to do what I wanted to do with my code. Keep up the good work!
I'll have to check out some videos on how to create a 'dice roll' kind of deal, as I'm trying to create a turn-based RPG system that incorporates an element of chance with certain actions. This is pretty quick and easy for a number of uses, though!
Dice rolls use the randint function! I usually set them up like this: label d20: $ d20 = renpy.random.randint(1, 20) return Then, whenever I need to know the result of rolling a twenty sided die, I'll use "call d20", and it resets the variable "d20" to a new value between 1 and 20. I cover this stuff in my Renpy RPG Combat video!
I honestly had to learn the last one just for this video 😤 I haven't found an occasion where I needed to use it yet, but it's a nice thing to have in your programming rolodex!
@@vimi This could be good for a minigame that shuffles items around (imagine you having to reorganize the things in your desk after a messy coworker uses it).
@UCmaPe0ET53Qw45lssEjVr2g I wish I had the time and opportunity to make half of the dumb mini game ideas I have. I would make some real weird garbage.
I set renpy.random.randint(2,8) for blinking, but it's always the same amount no matter what I do. So every blink is timed the same way despite "randint" command. So as a result, I gave up and set up blinking manually but complex enough so it doesn't look robotic. Still, feels like "change" and "randint" should have worked. I don't understand.
@@igretrovods9189 That second one was almost right! Try this (with proper indentation, of course): Image ken_slideshow: "ken normal" choice: pause 3.0 choice: pause 5.0 choice: pause 8.0 "ken blink" pause 0.75 repeat
There are a few ways to do it, depending on what you mean, exactly? If you want each choice to be randomized, you can add an if statement to each menu option, that only activates when it is randomly chosen; or if you just want the text to be randomized, you can set the text to be a randomized variable itself. It really depends on what the purpose is!
On point! I was struggling these days with a not so random "renpy.random.randint(1,6)" because of getting every-time the same numbers while rolling my dice, only with restarting the game, like you said, there was a new random output. But I wanted to use it often without smashing the flow - so the only conclusion to solve that was: Create new variables doing the same stuff XD
Hi, how can I use this here? So that every iteration I get a random number, and not just the first pass. define scream_timer_before = renpy.random.randint(1, 4) image main_menu_animated: "gui/main_menu.png" pause scream_timer_before choice: "gui/main_menu_3.png" pause 0.2 choice: "gui/main_menu_3.png" pause 0.2 pause 0.2 repeat
For some reason im heading an issue, where in line: $ gained_milk = renpy.random.randint(15, 20) Every time the number is either 15 or 20 and nothing in between. How do i fix that?
That line of code seems right - how are you evaluating the result? Is it some if/elif statements, is the number being adjusted elsewhere, or is directly added to a larger sum? When I have problems like that, I usually have a dialogue box or screen with the variable in it, like this,"[gained_milk]", so I can see exactly what value is spitting out, and I can use that information to see how that value is being processed elsewhere.