Hello, just like in the title. I tried to make simple event with randomized weather effect. It should rain for the 20% of time but it's raining all the time. Someone maybe know to done it right?
Random weather
RPG Maker MZ Supportif (weather <= 20 AND weather >= 0)
{
effect
}
If (weather <= 100 AND weather >= 21)
{
effect
}
The example above includes 2 variables to pin-point what effect goes off. Right now <=100 always goes off because it is the exact same as <= 20
EDITED: Better example
You can also add more options for other weather patterns with the logic above. It's easier to understand than locking it with an else statement.
Assuming you are using a set of random numbers between 1 and 100 for the weather variable, you can just remove the if condition and leave it as else only:
Code:
◇If : weather <= 20
◇Set Westher Effect : Rain, 5, 60 frames
◇
: Else
◇Set Weather Effect : None, 60 frames
◇
: End
◇
Why did you only show that cropped portion of your event? Where are you actually giving a value to the weather number?
Another (potentially visually simpler) way to do a progression like that is to stop after you've done what you want to do for this iteration of the event.
By simply pasting an Exit Event Processing (or Jump to Label, if there's other stuff to always be done), you avoid having to make a second, nested Conditional Branch for each thing.
Or just use Else branches. 0 additional Conditions or commands needed in that case.
That's incorrect, the OP's screenshot shows the <= 100 is inside an Else branch, so it only gets checked if weather is greater than 20. It's also not what the OP said is happening:
That's the result for the first, <= 20 condition, not the <= 100.
It works perfectly 100%. Try it before you claim false information.
EDIT:
lol I was in a crappy mood with this post and he was correct.

Read the words in my post before you claim I claim something.
I said zero words about "false information" or that something you posted doesn't work.
If that's the case, why did you even respond to this thread when I've already helped the OP?
I also did two IF in this type of scenario in case the OP wanted to add more options for weather patterns. Locking it with an Else doesn't leave much room for versatility.
The OP can also use Else on each of those IFs too for even more flexibility.
It is the case - read the English words I typed.
Because
1 - Anyone has the right to post in a thread
2 - I had different things to contribute (for example, what you told the OP was wrong was not what's wrong)
That's why I asked the OP to share the entire event, to try to help them correct it.
I have no idea what is wrong with you and your attitude, but it's not at all appropriate.
You brought the attitude in your response to this. Or at least it appeared you were being snarky. The last thing I want to do is argue with anybody on here.
If I took it the wrong way my apologies.
EDIT
I’ve been working so hard on my music lately that I must be exhausted. You were right about the else statement. He just needed to remove the variable check entirely.
Honestly, that’s a very confusing way to do it. My approach above is much easier for a novice to understand.
Let’s agree to steer the conversation back toward helping out OP’s problem. They can speak themselves as to what additional troubleshooting they may have completed based on the thread responses. No reason to limit what they can try out.
As ATT-Turan stated, you can also do labels as well. Put one at the very top of the script and put returns under the Weather=0 variables that direct to it. This prevents the script from chewing which might cause some lag.
if your going to use only 20% then u don't need put if weather <=100 in else just set effect to none in else branch it will work ?
remove else condition from else branch set there none effect direclty
Original thread: https://forums.rpgmakerweb.com/threads/random-weather.171303/