RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
making randon weather effects

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 85
I need what I want but I don't want what I need
is there a tut for random weather effects anywhere if not does anybody know what variable operations work the best I've tried many things but I can't find a way to keep it going continous
jpeazy

**
Rep: +0/-0Level 85
A dying ember still burns
Note: I don't know how skilled you are with switches, variables, and whatnot, so I'll explain everything as best I can in case there's any parts you may not already know how to do. I therefore apologize if it sounds overly simplified.

First off, you need to make yourself a common event, which is going to be triggered by a switch. We'll call the common event WeatherEffects, and the switch will be called WeatherEnabled. Set the Event Start Condition to Parallel Process, and make sure you put a check in the box next to the Appearance Conditions Switch and choose/make the WeatherEnabled switch. Now, before we get into the code for the weather, you're going to have to add another event somewhere on your map (we'll call it Control) that turns on the WeatherEnabled switch, but only does so once - this means we have to create another switch (we'll call it ControlEnabled) for this new event. It doesn't matter where on the map you place the event, since the player can't directly interact with it, so put it somewhere you don't need to have any other events. Also, make sure it's on the first map where you want weather effects to occur.

On the first page of the Control event, set the Event Start Condition to Parallel Process. Under the Event Commands, have it turn on the WeatherEnabled switch and the ControlEnabled switch, in that order. Create a second page with no event commands, but set this page to occur when ControlEnabled is ON under the Event Conditions. Your code so far should look like this:

ChangeSwitch:[####:WeatherEnabled]-ON Set
ChangeSwitch:[####:ControlEnabled]-ON Set


...with nothing on the second page except the Event Condition restriction mentioned above. That completes the Control event. Now back to the WeatherEffects event, where we can actually code the weather. Now, a lot of the code in this section depends on how in-depth you want your random weather to be, how long you want it to last, and so on, so I'll give an example using a very simple system, and if you want/need help building a more complex one, let me know. First, we want this event to repeat itself, so put a Label in the Event Commands. Since there's only one label needed, let's make it Label 1. Next, we need it to assign a random value to a variable. We'll name the variable DetermineWeather, and for the sake of simplicity, let's have it be a random number between 1 and 100. To do this, we need to use the Change Variable command and bubble the circle "Rand." under the Operands, and then fill in the numbers we want. Your code for the WeatherEffects event should look pretty basic so far:

LABEL: 1No
Variable Ch:[####:DetermineWeather]Set, Randm[1*100]


Under our variable, we need a Fork Condition that will determine what the weather should be change to, based on the value that was assigned to DetermineWeather. So, insert a fork, set the Conditions to Variable, and choose the DetermineWeather variable. There's also three options under that which we need to play around with. Because we need an example, let's say you want a 20% for it to rain, with the remaining 80% being just regular, sunny weather. Click the Set bubble, and put it at 80; then, in the third dropdown box, select "Bigger". If you want a different chance of rain, just change the number: increase it for a smaller chance to rain, or decrease it for a larger chance of rain. Now our code should look like this:

LABEL: 1No
Variable Ch:[####:DetermineWeather]Set, Randm[1*100]
FORK Optn:Varbl[####:DetermineWeather]-80more than

:ELSE Case

:END Case


Inside the Fork (right below the line "FORK Optn:etc.), have it Call Weather Effect and set it to "Rain". Let's put it on Medium effect power for now. Now, since we want it to rain for some period of time before the weather changes again, we want to insert a Wait command just below this. Let's put it at 60 seconds (note that the game measures time in tenths of a second, so you have to put 600 in the box). This means that once the weather has been set to rain, the event will wait for a minute before it determines a new weather effect - otherwise, it would repeatedly select a new weather effect every fraction of a second. Now under the ELSE case, have it Call Weather Effect and set it to "None", and then insert another Wait command (set this one to 60 seconds as well). You can, of course, have it wait for a longer/shorter period of time. Note, however, that a single Wait command has a maximum time of 100 seconds, so if you want it to wait longer than that, each case in the fork will need multiple back-to-back Wait commands. For our final touch, insert the Goto Label command beneath the entire fork (below the END Case line) and set it to Label 1. This will cause it to loop back to the beginning of the code (after it's done executing any Wait commands) so that it can continually alter the weather. Our final code looks like this:

LABEL: 1No
Variable Ch:[####:DetermineWeather]Set, Randm[1*100]
FORK Optn:Varbl[####:DetermineWeather]-80more than
Call Weather Effect: Ra, Me
Wait: 60.0s.
:ELSE Case
Call Weather Effect: None
Wait: 60.0s.
:END Case
GOTOLabel: 1No


Like I said, this is a fairly simple system. To increase the complexity (by adding different intensities/durations of rain, adding snow as a possibility, etc.), you just add a new fork under the Else case of the original, with each new fork after that being inserted under the Else case of the one above it. If you need any additional help, or if I didn't explain something here clearly enough, let me know and I'll be happy to elaborate. Good luck with your game.

EDIT: Something I forgot to mention. Whenever the player enters an area where you don't want there to be weather effects (they go into a cave, enter a building, or whatever), just have the same event that moves the player turn off the WeatherEnabled event (don't forget to turn it back on when the player leaves the area) and set the weather to "None". You can also do this at any point in the game where you want a specific weather effect (either on a particular map or during a certain scene).
« Last Edit: August 17, 2008, 04:12:22 AM by Dracomortis »
Warning: posts may contain traces of gaming. If you are allergic to gaming, you should avoid these posts, as the side effects of direct contact with gaming include but are not limited to drowsiness, upset stomach, headache, loss of memory, lack of self esteem, paralysis or other loss of bodily functions, loss of significant other, humiliation, unexplained death, or loss of hair. If you experience any of these symptoms, please contact your doctor immediately.