• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: RNG and Weather

interdpth

I've seen things, man.
275
Posts
19
Years
    • Seen Jun 8, 2021
    SOmeone make a script that everyone agree's on, and i'll hack the level loading routines and make it execute.

    DEAL?
     

    colcolstyles

    Yours truly
    1,588
    Posts
    15
    Years
  • Code:
    '----------------------------------------------------------------
    ' Natural Weather Script
    ' By colcolstyles
    ' 10/17/2009
    ' As the player moves from one map to the next, the weather has
    ' the possibility of changing. Both the type of weather that
    ' might begin and the odds of a change occurring depend on
    ' the current weather (actual odds given in script). This script
    ' also contains an available option for manual override; the
    ' hacker can (by setting the OVERRIDE flag) specify a particular
    ' weather to be used, thus deactivating the random weather.
    '----------------------------------------------------------------
    
    #erase 0x800000 0x100
    #dynamic 0x800000
    
    #define V_WEATHER 0x7000
    #define V_RANDVAR 0x7001
    #define F_OVERRIDE 0x500
    #define W_SUNNY 0x2
    #define W_CLOUDY 0xB
    #define W_RAIN 0x3
    #define W_THUNDER 0xD
    
    '----------------------------------------------------------------
    
    #org @main
    compare F_OVERRIDE B_TRUE
    if B_== goto @manual
    random 0x13
    copyvar V_RANDVAR LASTRESULT
    compare V_WEATHER W_SUNNY
    if B_== goto @sunnyscript
    compare V_WEATHER W_CLOUDY
    if B_== goto @cloudyscript
    compare V_WEATHER W_RAIN
    if B_== goto @rainscript
    compare V_WEATHER W_THUNDER
    if B_== goto @thunderscript
    end
    
    '----------------------------------------------------------------
    
    #org @sunnyscript
    compare V_RANDVAR 0x1 ' 2/20 chance of becoming cloudy
    if B_<= goto @becomecloudy
    compare V_RANDVAR 0x2 ' 1/20 chance of spontaneous rain
    if B_<= goto @becomerainy
    setweather W_SUNNY ' 17/20 chance of remaining the same
    goto @end
    
    #org @cloudyscript
    compare V_RANDVAR 0x4 ' 5/20 chance of becoming sunny
    if B_<= goto @becomesunny
    compare V_RANDVAR 0xE ' 10/20 chance of becoming rainy
    if B_<= goto @becomerainy
    compare V_RANDVAR 0x11 ' 3/20 chance of thunderstorm
    if B_<= goto @becomethunder
    setweather W_CLOUDY ' 2/20 chance of remaining the same
    goto @end
    
    #org @rainscript
    compare V_RANDVAR 0x2 ' 3/20 chance of thunderstorm
    if B_<= goto @becomethunder
    compare V_RANDVAR 0xA ' 8/20 chance of rain stopping but remaining cloudy
    if B_<= goto @becomecloudy
    compare V_RANDVAR 0xC ' 2/20 of rain cutting out completely
    if B_<= goto @becomesunny
    setweather W_RAIN ' 7/20 chance of remaining the same
    goto @end
    
    #org @thunderscript
    compare V_RANDVAR 0xC ' 13/20 chance of reducing to rain
    if B_<= goto @becomerainy
    compare V_RANDVAR 0xF ' 3/20 chance of suddenly reducing cloudy
    if B_<= goto @becomecloudy
    setweather W_RAIN ' 4/20 chance of remaining the same
    goto @end
    
    '----------------------------------------------------------------
    
    #org @becomesunny
    setvar v_WEATHER W_SUNNY
    setweather W_SUNNY
    goto @end
    
    #org @becomecloudy
    setvar V_WEATHER W_CLOUDY
    setweather W_CLOUDY
    goto @end
    
    #org @becomerainy
    setvar V_WEATHER W_RAIN
    setweather W_RAIN
    goto @end
    
    #org @becomethunder
    setvar V_WEATHER W_THUNDER
    setweather W_THUNDER
    goto @end
    
    '----------------------------------------------------------------
    
    #org @manual
    setweather V_WEATHER
    doweather
    end
    
    '----------------------------------------------------------------
    
    #org @end
    doweather
    end
    
    '----------------------------------------------------------------

    I looked through the script and I realized that a "goto @end" is also necessary at the end of @sunnyscript and its corresponding scripts.

    This hasn't been fully tested yet but it's nearing the final stages. Does anyone have any other ideas that they want added? I've already added manual override and the ability to disable the random weather at any time but if there are any other features that you think would be nice to have, just speak up and I'm sure we can figure out how to implement them.
     

    colcolstyles

    Yours truly
    1,588
    Posts
    15
    Years
  • I guess we'll need to try and fully test it if you're satisfied. I know I am.

    Well, Darthatron and I have been talking and we're working on a better version. If you have MSN you can join us, actually.

    edit: We think we're nearing in on a final version but we're still testing it. We'll keep you updated.

    edit2: Well we think we have finally agreed on a script. We've tested it too and as far as we can tell, it works like we want it to. Now all we need is for interdpth to work his magic.

    Here's the script:
    Code:
    //----------------------------------------------------------------
    // Natural Weather Script
    // Script by Darthatron and colcolstyles, original concept and odds by Anthony La
    // 1/2/10
    // This script will create a system which aims to simulate the
    // "real world" weather by randomly switching between weather
    // effects (sunny, cloudy, raining, and thunderstorm). The odds of
    // a change occurring depend on the current weather (i.e. it is
    // more likely to start raining when it is already cloudy than
    // when it is sunny). However, random weather will only occur if
    // the weather type on the player's current map is set to 0x0F.
    // Because of this, the hacker can make a map use a preset weather
    // condition and be exempt from random weather. The script will
    // also only activate on maps of type Village, City, and Route to
    // ensure that it does not rain inside or in a cave.
    //----------------------------------------------------------------
    
    #erase 0x800000 0xFFF
    #dynamic 0x800000
    
    #define V_DEFAULT 0x8000
    #define V_WEATHER 0x7000  //This must be set to a value between 1 and 4 to work.
    #define V_RANDVAL 0x7001
    
    #define A_WEATHER 0x02036E12
    #define A_MAPTYPE 0x02036E13
    #define A_DEFAULT 0x020370B8
    
    #define W_SUNNY 0x02
    #define W_CLOUDY 0x0B
    #define W_RAIN 0x03
    #define W_THUNDER 0x0D
    
    #org @Setup
    setvar V_WEATHER 0x01
    setweather W_SUNNY
    doweather
    end
    
    #org @Main
    setvar V_DEFAULT 0x0000
    copybyte A_DEFAULT A_WEATHER //Grabs the default map weather and stores it in V_DEFAULT
    compare V_DEFAULT 0x0F
    if B_<< goto @Quit
    copybyte A_DEFAULT A_MAPTYPE //Grabs the map type and stores it in V_DEFAULT
    compare V_DEFAULT 0x03
    if B_>> goto @Quit
    random 0x13 //Create a random value between 0 and 19.
    copyvar V_RANDVAL LASTRESULT
    compare V_WEATHER 0x01
    if B_TRUE goto @CurrentlySunny
    compare V_WEATHER 0x02
    if B_TRUE goto @CurrentlyCloudy
    compare V_WEATHER 0x03
    if B_TRUE goto @CurrentlyRaining
    compare V_WEATHER 0x04
    if B_TRUE goto @CurrentlyStorming
    end
    
    #org @Quit
    end
    
    #org @BecomeSunny
    setweather W_SUNNY
    setvar V_WEATHER 0x01
    doweather
    end
    
    #org @BecomeCloudy
    setweather W_CLOUDY
    setvar V_WEATHER 0x02
    doweather
    end
    
    
    #org @BecomeRaining
    setweather W_RAIN
    setvar V_WEATHER 0x03
    doweather
    end
    
    #org @BecomeStorming
    setweather W_THUNDER
    setvar V_WEATHER 0x04
    doweather
    end
    
    #org @CurrentlySunny
    compare V_RANDVAL 0x01 //10% chance of becoming cloudly.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x02 //5% chance of it raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //85% chance of the weather staying the same.
    if B_<= goto @BecomeSunny
    end
    
    #org @CurrentlyCloudy
    compare V_RANDVAL 0x04 //25% chance of becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x06 //10% chance of it staying cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x10 //50% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyRaining
    compare V_RANDVAL 0x06 //35% chance that it will keep raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x08 //10% chance of it becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x10 //40% chance that it will become cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyStorming
    compare V_RANDVAL 0x0C //65% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x0F //15% chance of it becoming cloudy
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //20% chance that the thunder storm will continue.
    if B_<= goto @BecomeStorming
    end
     
    Last edited:

    0m3GA ARS3NAL

    Im comin' home...
    1,816
    Posts
    16
    Years
  • Well well well, stuff happened pretty fast!
    I wasn't even here for the initial idea pitch, oh well.
    I've tried out this script a bit on my PSP, and all goes well, well indeed.
    Though I had an idea...
    What about snow?
    I know for a fact that people nowadays have the strangest fascination with snowy maps in a ROM hack, and if someone makes a snowy mountain, how would this random weather be incorporated...
    I guess as of yet one could simply change the "Storm" and "Rain" to things like "3 Snowflakes" and the Ash snow used in R/S/E...
    But that would require compiling a completely different script, and if someone were to cross maps while things are stormy, to a map intended to have the chance of snow, things may get a little buggy.
     

    Darthatron

    巨大なトロール。
    1,152
    Posts
    18
    Years
  • Of note, is it fully necessary to define the ONE weather byte that the script activates on AND ensure it doesn't activate in certain areas? Sounds like an unnecessary measure when it's up to the hacker to set which weather byte activates it.
    You make a valid point. It's not difficult to simply get rid of that check, as it's only 3 lines. Here is an updated version for you:
    Code:
    //----------------------------------------------------------------
    // Natural Weather Script!
    //----------------------------------------------------------------
    // By colcolstyles and Darthatron (3/1/2010)
    //----------------------------------------------------------------
    // This script will create a system which aims to simulate the
    // "real world" weather by randomly switching between weather
    // effects (sunny, cloudy, raining, and thunderstorm). The odds of
    // a change occurring depend on the current weather (i.e. it is
    // more likely to start raining when it is already cloudy than
    // when it is sunny). However, random weather will only occur if
    // the weather type on the player's current map is set to 0x0F.
    // Because of this, the hacker can make a map use a preset weather
    // condition and be exempt from random weather.
    //----------------------------------------------------------------
    
    #erase 0x800000 0xFFF
    #dynamic 0x800000
    
    #define V_DEFAULT 0x8000
    #define V_WEATHER 0x7000  //This must be set to a value between 1 and 4 to work.
    #define V_RANDVAL 0x7001
    
    #define A_WEATHER 0x02036E12
    #define A_MAPTYPE 0x02036E13
    #define A_DEFAULT 0x020370B8
    
    #define W_SUNNY 0x02
    #define W_CLOUDY 0x0B
    #define W_RAIN 0x03
    #define W_THUNDER 0x0D
    
    #org @Setup
    setvar V_WEATHER 0x01
    setweather W_SUNNY
    doweather
    end
    
    #org @Main
    setvar V_DEFAULT 0x0000
    copybyte A_DEFAULT A_WEATHER //Grabs the default map weather and stores it in V_DEFAULT
    compare V_DEFAULT 0x0F
    if B_<< goto @Quit
    random 0x13 //Create a random value between 0 and 19.
    copyvar V_RANDVAL LASTRESULT
    compare V_WEATHER 0x01
    if B_TRUE goto @CurrentlySunny
    compare V_WEATHER 0x02
    if B_TRUE goto @CurrentlyCloudy
    compare V_WEATHER 0x03
    if B_TRUE goto @CurrentlyRaining
    compare V_WEATHER 0x04
    if B_TRUE goto @CurrentlyStorming
    end
    
    #org @Quit
    end
    
    #org @BecomeSunny
    setweather W_SUNNY
    setvar V_WEATHER 0x01
    doweather
    end
    
    #org @BecomeCloudy
    setweather W_CLOUDY
    setvar V_WEATHER 0x02
    doweather
    end
    
    
    #org @BecomeRaining
    setweather W_RAIN
    setvar V_WEATHER 0x03
    doweather
    end
    
    #org @BecomeStorming
    setweather W_THUNDER
    setvar V_WEATHER 0x04
    doweather
    end
    
    #org @CurrentlySunny
    compare V_RANDVAL 0x01 //10% chance of becoming cloudly.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x02 //5% chance of it raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //85% chance of the weather staying the same.
    if B_<= goto @BecomeSunny
    end
    
    #org @CurrentlyCloudy
    compare V_RANDVAL 0x04 //25% chance of becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x06 //10% chance of it staying cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x10 //50% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyRaining
    compare V_RANDVAL 0x06 //35% chance that it will keep raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x08 //10% chance of it becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x10 //40% chance that it will become cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyStorming
    compare V_RANDVAL 0x0C //65% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x0F //15% chance of it becoming cloudy
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //20% chance that the thunder storm will continue.
    if B_<= goto @BecomeStorming
    end
    Well well well, stuff happened pretty fast!
    I wasn't even here for the initial idea pitch, oh well.
    I've tried out this script a bit on my PSP, and all goes well, well indeed.
    Though I had an idea...
    What about snow?
    I know for a fact that people nowadays have the strangest fascination with snowy maps in a ROM hack, and if someone makes a snowy mountain, how would this random weather be incorporated...
    I guess as of yet one could simply change the "Storm" and "Rain" to things like "3 Snowflakes" and the Ash snow used in R/S/E...
    But that would require compiling a completely different script, and if someone were to cross maps while things are stormy, to a map intended to have the chance of snow, things may get a little buggy.
    If you can come up with the chances of the snow weathers happening then I would have no problem adding it in. I, however, am far too lazy to think of those values up. ^_^
     
    Last edited:

    0m3GA ARS3NAL

    Im comin' home...
    1,816
    Posts
    16
    Years
  • Well, the sown weather would be the one thing that would need to change depending on the map itself, what it looks like, I mean, even I could add that in myself, I know my way around a script, what I mean, is the off chance someone decides to want to use this for snow too.
    Adding in a probability wouldn't help one bit, since even then snow could happen in a place such as a beach, or a rain forest, not exactly natural.
    The best thing I can come up with is a variable the user would have to set themselves.... (Aside from @setup, where V_SNOW is set to 0, which can be removed fairly easily)


    Here is a changed script for you to look at, changes in BOLD RED

    Code:
    //----------------------------------------------------------------
    // Natural Weather Script!
    //----------------------------------------------------------------
    // By colcolstyles and Darthatron (3/1/2010)
    [b][color=red]// Revised for snow by 0m3GA ARS3NAL (2:15 AM  -8 PST)[/color][/b]
    //----------------------------------------------------------------
    // This script will create a system which aims to simulate the
    // "real world" weather by randomly switching between weather
    // effects (sunny, cloudy, raining, and thunderstorm). The odds of
    // a change occurring depend on the current weather (i.e. it is
    // more likely to start raining when it is already cloudy than
    // when it is sunny). However, random weather will only occur if
    // the weather type on the player's current map is set to 0x0F.
    // Because of this, the hacker can make a map use a preset weather
    // condition and be exempt from random weather.  [b][color=red]The hacker may
    // now also set Variable 0x7002 to either 0 or 1 do define if the map
    // the player is on will be a normal map, or a snowy one respectively.[/color][/b]
    //----------------------------------------------------------------
    
    #erase 0x800000 0xFFF
    #dynamic 0x800000
    
    #define V_DEFAULT 0x8000
    #define V_WEATHER 0x7000  //This must be set to a value between 1 and [b][color=red]5[/color][/b] to work.
    #define V_RANDVAL 0x7001
    [b][color=red]#define V_SNOW 0x7002 //Set this to either 0 or 1, 0 to define normal weather, 1 for snow changes[/color][/b]
    
    #define A_WEATHER 0x02036E12
    #define A_MAPTYPE 0x02036E13
    #define A_DEFAULT 0x020370B8
    
    #define W_SUNNY 0x02
    #define W_CLOUDY 0x0B
    #define W_RAIN 0x03
    #define W_THUNDER 0x0D
    [b][color=red]#define W_SNOW 0x7[/color][/b]
    
    #org @Setup
    setvar V_WEATHER 0x01
    [b][color=red]setvar V_SNOW 0x0[/color][/b]
    setweather W_SUNNY
    doweather
    end
    
    #org @Main
    setvar V_DEFAULT 0x0000
    copybyte A_DEFAULT A_WEATHER //Grabs the default map weather and stores it in V_DEFAULT
    compare V_DEFAULT 0x0F
    if B_<< goto @Quit
    random 0x13 //Create a random value between 0 and 19.
    copyvar V_RANDVAL LASTRESULT
    compare V_WEATHER 0x01
    if B_TRUE goto @CurrentlySunny
    compare V_WEATHER 0x02
    if B_TRUE goto @CurrentlyCloudy
    compare V_WEATHER 0x03
    if B_TRUE goto @CurrentlyRaining
    compare V_WEATHER 0x04
    if B_TRUE goto @CurrentlyStorming
    [b][color=red]compare V_WEATHER 0x5
    if B_TRUE goto @CurrentlySnowing[/color][/b]
    end
    
    #org @Quit
    end
    
    #org @BecomeSunny
    setweather W_SUNNY
    setvar V_WEATHER 0x01
    doweather
    end
    
    #org @BecomeCloudy
    setweather W_CLOUDY
    setvar V_WEATHER 0x02
    doweather
    end
    
    
    #org @BecomeRaining
    [b][color=red]compare V_SNOW 0x1
    if B_TRUE goto @BecomeSnowing[/color][/b]
    setweather W_RAIN
    setvar V_WEATHER 0x03
    doweather
    end
    
    #org @BecomeStorming
    [b][color=red]compare V_SNOW
    if B_TRUE goto @BecomeSnowing[/color][/b]
    setweather W_THUNDER
    setvar V_WEATHER 0x04
    doweather
    end
    
    [b][color=red]#org @BecomeSnowing
    setweather W_SNOW
    setvar V_WEATHER 0x5
    doweather
    end[/color][/b]
    
    #org @CurrentlySunny
    compare V_RANDVAL 0x01 //10% chance of becoming cloudly.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x02 //5% chance of it raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //85% chance of the weather staying the same.
    if B_<= goto @BecomeSunny
    end
    
    #org @CurrentlyCloudy
    compare V_RANDVAL 0x04 //25% chance of becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x06 //10% chance of it staying cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x10 //50% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyRaining
    compare V_RANDVAL 0x06 //35% chance that it will keep raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x08 //10% chance of it becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x10 //40% chance that it will become cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyStorming
    compare V_RANDVAL 0x0C //65% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x0F //15% chance of it becoming cloudy
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //20% chance that the thunder storm will continue.
    if B_<= goto @BecomeStorming
    end
    
    [b][color=red]#org @CurrentlySnowing
    compare V_RANDVAL 0x2  //15% chance of it becoming cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //85% Chance that the snow will continue.
    if b_<== goto @BecomeSnowing
    end[/color][/b]
     
    Last edited:

    colcolstyles

    Yours truly
    1,588
    Posts
    15
    Years
  • Of note, Matt, will you be calling this script from the header while leaving it modifiable?

    It was my understanding that the script would be accessed by the ASM routine, making the script modifiable at any time.

    Of note, is it fully necessary to define the ONE weather byte that the script activates on AND ensure it doesn't activate in certain areas? Sounds like an unnecessary measure when it's up to the hacker to set which weather byte activates it.

    Actually, interdpth also wanted to get rid of the "check 0xF" part so if you don't want that part in the script either, then can just remove it without harming anything. However, I would argue that the "check 0xF" function is beneficial because it allows a hacker to make a map use a fixed weather condition for a map if they want without having to change the map type to indoors or something like that. It may not be the most realistic if a town always has rain but I could imagine that hackers might enjoy that option.

    Eh, it's really up to you and if you don't want it, then just use the modified script that Darthatron posted.

    Code:
    //----------------------------------------------------------------
    // condition and be exempt from random weather.  The hacker may
    // now also set Variable 0x7002 to either 0 or 1 do define if the [b]map[/b]
    // the player is on will be a normal map, or a snowy one respectiv[b]ely.[/b]
    //----------------------------------------------------------------
    
    ...

    Gah! You went over the character limit! My beautiful header text!

    In my opinion, I think snow is just unnecessary. If the only conditions that the script can alter between are "3 snowflakes" and "snowing", it just doesn't seem worth it to me. I think the hacker would be better off setting a fixed condition seeing how they know how the map is going to look and can decide whether light or heavy snow is more realistic.
     

    Darthatron

    巨大なトロール。
    1,152
    Posts
    18
    Years
  • It was my understanding that the script would be accessed by the ASM routine, making the script modifiable at any time.
    That's what he told me he was going to do.
    In my opinion, I think snow is just unnecessary. If the only conditions that the script can alter between are "3 snowflakes" and "snowing", it just doesn't seem worth it to me. I think the hacker would be better off setting a fixed condition seeing how they know how the map is going to look and can decide whether light or heavy snow is more realistic.
    This.

    where do you put the script after compiling it?

    Right now, in a level script on every map.
     
    Last edited:

    0m3GA ARS3NAL

    Im comin' home...
    1,816
    Posts
    16
    Years
  • In my opinion, I think snow is just unnecessary. If the only conditions that the script can alter between are "3 snowflakes" and "snowing", it just doesn't seem worth it to me. I think the hacker would be better off setting a fixed condition seeing how they know how the map is going to look and can decide whether light or heavy snow is more realistic.

    Meh, just a suggestion you know, if someone wanted snow to happen, it could.
    (Besides, I decided not to include 3 Snowflakes, since it isn't exactly... ideal, so to speak.)
    The 3 Snowflakes weather is odd, and only seems to work half the time.

    I do agree though, snow is a bit unnecessary, just thought I would include it for anyone who wants it. (And I know, someone out there wants a more natural snow, lol)
    If only we could make MORE weather types...
     

    Megiddo-san

    Barium - Summer '12 Return?
    1,308
    Posts
    16
    Years
  • Are these the correct settings for implementation? 1. Use offset of @main 2. Use an 01 setmaptile script 3. Set map weather to 0F I haven't gotten it to do anything yet. Probably some key detail I missed.
     

    colcolstyles

    Yours truly
    1,588
    Posts
    15
    Years
  • Are these the correct settings for implementation? 1. Use offset of @main 2. Use an 01 setmaptile script 3. Set map weather to 0F I haven't gotten it to do anything yet. Probably some key detail I missed.

    Remember to initialize the weather variable (0x7000) to either 0x2, 0xB, 0x3, or 0xD (sunny, cloudy, raining, and thunderstorm respectively).

    So how's the ASM part of this idea coming along? Last time I checked, interdpth said that he was going to add a "hook" to the routine that runs every time a map loads. Is that still the plan? And if so, how is progress on that so far?
     
    115
    Posts
    15
    Years
    • Seen Apr 13, 2024
    Think you could make a video tutorial on this? I think it'd help me a bit more as I am having a bit of trouble understanding exactly how to do this.

    ----------------------------------------------------
    Also....

    You make a valid point. It's not difficult to simply get rid of that check, as it's only 3 lines. Here is an updated version for you:
    Code:
    //----------------------------------------------------------------
    // Natural Weather Script!
    //----------------------------------------------------------------
    // By colcolstyles and Darthatron (3/1/2010)
    //----------------------------------------------------------------
    // This script will create a system which aims to simulate the
    // "real world" weather by randomly switching between weather
    // effects (sunny, cloudy, raining, and thunderstorm). The odds of
    // a change occurring depend on the current weather (i.e. it is
    // more likely to start raining when it is already cloudy than
    // when it is sunny). However, random weather will only occur if
    // the weather type on the player's current map is set to 0x0F.
    // Because of this, the hacker can make a map use a preset weather
    // condition and be exempt from random weather.
    //----------------------------------------------------------------
    
    #erase 0x800000 0xFFF
    #dynamic 0x800000
    
    #define V_DEFAULT 0x8000
    #define V_WEATHER 0x7000  //This must be set to a value between 1 and 4 to work.
    #define V_RANDVAL 0x7001
    
    #define A_WEATHER 0x02036E12
    #define A_MAPTYPE 0x02036E13
    #define A_DEFAULT 0x020370B8
    
    #define W_SUNNY 0x02
    #define W_CLOUDY 0x0B
    #define W_RAIN 0x03
    #define W_THUNDER 0x0D
    
    #org @Setup
    setvar V_WEATHER 0x01
    setweather W_SUNNY
    doweather
    end
    
    #org @Main
    setvar V_DEFAULT 0x0000
    copybyte A_DEFAULT A_WEATHER //Grabs the default map weather and stores it in V_DEFAULT
    compare V_DEFAULT 0x0F
    if B_<< goto @Quit
    random 0x13 //Create a random value between 0 and 19.
    copyvar V_RANDVAL LASTRESULT
    compare V_WEATHER 0x01
    if B_TRUE goto @CurrentlySunny
    compare V_WEATHER 0x02
    if B_TRUE goto @CurrentlyCloudy
    compare V_WEATHER 0x03
    if B_TRUE goto @CurrentlyRaining
    compare V_WEATHER 0x04
    if B_TRUE goto @CurrentlyStorming
    end
    
    #org @Quit
    end
    
    #org @BecomeSunny
    setweather W_SUNNY
    setvar V_WEATHER 0x01
    doweather
    end
    
    #org @BecomeCloudy
    setweather W_CLOUDY
    setvar V_WEATHER 0x02
    doweather
    end
    
    
    #org @BecomeRaining
    setweather W_RAIN
    setvar V_WEATHER 0x03
    doweather
    end
    
    #org @BecomeStorming
    setweather W_THUNDER
    setvar V_WEATHER 0x04
    doweather
    end
    
    #org @CurrentlySunny
    compare V_RANDVAL 0x01 //10% chance of becoming cloudly.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x02 //5% chance of it raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //85% chance of the weather staying the same.
    if B_<= goto @BecomeSunny
    end
    
    #org @CurrentlyCloudy
    compare V_RANDVAL 0x04 //25% chance of becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x06 //10% chance of it staying cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x10 //50% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyRaining
    compare V_RANDVAL 0x06 //35% chance that it will keep raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x08 //10% chance of it becoming sunny.
    if B_<= goto @BecomeSunny
    compare V_RANDVAL 0x10 //40% chance that it will become cloudy.
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //15% chance that a thunder storm will start.
    if B_<= goto @BecomeStorming
    end
    
    #org @CurrentlyStorming
    compare V_RANDVAL 0x0C //65% chance that it will start raining.
    if B_<= goto @BecomeRaining
    compare V_RANDVAL 0x0F //15% chance of it becoming cloudy
    if B_<= goto @BecomeCloudy
    compare V_RANDVAL 0x13 //20% chance that the thunder storm will continue.
    if B_<= goto @BecomeStorming
    end
    If you can come up with the chances of the snow weathers happening then I would have no problem adding it in. I, however, am far too lazy to think of those values up. ^_^

    That script you have there, where exactly do you put that in the game? Or do you just compile it... I'm such a n00b.
     
    Last edited:

    Darthatron

    巨大なトロール。
    1,152
    Posts
    18
    Years
  • Think you could make a video tutorial on this? I think it'd help me a bit more as I am having a bit of trouble understanding exactly how to do this.

    ----------------------------------------------------
    Also....



    That script you have there, where exactly do you put that in the game? Or do you just compile it... I'm such a n00b.
    Compile it anywhere, then put it in a level script.
     

    rockeymon

    Real life Silver Shirubaa
    229
    Posts
    16
    Years
  • Um so question.
    1.) Is this open to the public
    2.) What is a level script
    3.) Where do you put it on a map
    4.) Can you use xse and Am1.92 to insert it into the game?
     

    colcolstyles

    Yours truly
    1,588
    Posts
    15
    Years
  • Um so question.
    1.) Is this open to the public
    2.) What is a level script
    3.) Where do you put it on a map
    4.) Can you use xse and Am1.92 to insert it into the game?

    1) Not technically
    2) This isn't the place to be asking that
    3) I don't really feel like explaining
    4) Yes but, as I said, it's not finished yet. If you wait a little longer, there will be a patch that won't require using XSE or AdvanceMap to use :)
     
    Back
    Top