RNG and weather

This is certainly not an original idea. In fact, it’s something that I’ve seen long before – the first person to demonstrate it of whose name I forget designed it for his hack, Pokémon Dirt Brown (which, mind you, actually has no relation to Pokémon Brown and never made it to the public… as the person had lost interest).

Using RNG, I’ve thought up a similar system. It might actually be the same as this one; I’ll never know since the hack never released. My system (which I actually wrote on paper but now the sheet’s disappeared) involves changing weather depending on certain variables to another weather condition. For example, if it’s sunny in a map at the moment, then there may be a small chance that the sky will become cloudy (and then, the area will seemingly dim) when the player enters another map. When the player enters another map, there’s a chance that it will start raining, or it will become clear again. (Perhaps the chance that it starts raining will be somewhat high.) Enter another map, and the rain will either clear instantaneously (low chance), the rain will stop and the map will return to a cloudy state (high chance), or, for the worst possible condition, a thunderstorm will occur (low, low chance).

Continue reading

Perhaps if structured out, the script would look like, though my sheet of paper did it better so this might not work:

Variables values reserved:
1 = normal, 2 = cloudy, 3 = rain, 4 = thunderstorm, 5 = light fog, 6 = thick fog, 7 = diagonal fog
(5, 6, and 7 will not be used in this sample structure.)

  • Perhaps I’ll keep in mind that, upon switching to a different map where ever the script is loaded:
  • If its currently sunny, 2/20 that it will be cloudy,  17/20 that it will remain sunny, and 1/20 determining that it will suddenly start raining.
  • If it’s cloudy, 5/20 chance that it will suddenly become sunny again, 2/10 that it will remain cloudy,  and 10/20 chance that it will suddenly rain. 3/20 chance that the player will be slapped with a thunderstorm.
  • If it’s currently raining, make a 3/20 chance that a thunderstorm will start, 7/20 that it will continue raining, 2/20 that the rain will cut out, and 8/20 that the rain will stop but the area remains cloudy.
  • Finally, if a thunderstorm has popped up, leave a 13/20 chance that it will reduce into rain again, 3/20 that it’ll quickly become cloudy,  and a 4/20 chance that it will continue as-is.

Due to how the script is formatted, if the player enters a map where the script isn’t already implemented, the conditions in the maps prior will remain. So, if I entered a house in the town where the script was, when I exit, the RNG magic will start again.

Main script

  • Check variable for weather condition set between maps
  • If variable = 1, go to RNG script 1 (sets conditions when normal)
  • If variable = 2, go to RNG script 2 (sets conditions when cloudy)
  • If variable = 3, go to RNG script 3 (sets conditions when raining)
  • If variable = 4, go to RNG script 4 (sets conditions during thunderstorm)

RNG script 1

  • Start RNG, set to 20 (is this meant to be an integer value?) and store into LASTRESULT.
  • Copy LASTRESULT to variable.
  • (Following the chances set above) If RNG returns 0 (treat as hex?), go to script that sets weather to cloudy.
  • If RNG returns 1, set to cloudy.
  • If RNG returns 2, run script that ends script without doing anything.
  • If RNG returns 3, do nothing.
  • If RNG returns 4, do nothing.

(the rest of the script would be rinse and repeat of RNGs and such, so it’s cut for brevity)

Wow, I just gave other hackers a tip. Maybe though, if I decide to actually embrace variables, this script could be made much more efficient than it is here. If anyone wants to give me tips, by all means comment.

Originally posted on the old Rijon website, now offline. Archive link.

Scroll to top