Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old November 14th, 2010 (7:50 AM).
Crazyninjaguy's Avatar
Crazyninjaguy Crazyninjaguy is offline
I'm back.
     
    Join Date: May 2008
    Location: England
    Age: 25
    Gender: Male
    Posts: 663
    This script imitates the feature from Pokemon Black/White which shows an image when you first start up the game showing whichever season it is.

    Put this in a new script section above main:

    Spoiler:
    Code:
    #===============================================================================
    # * Day/Season Checker
    # * By Crazyninjaguy
    # * http://www.planetdev.net
    #===============================================================================
    
    module TimeChecker
      
      # Number of the switch to turn on per day of week
      MONDAY = 30
      TUESDAY = 31
      WEDNESDAY = 32
      THURSDAY = 33
      FRIDAY = 34
      SATURDAY = 35
      SUNDAY = 36
      # Switch to turn on according to season
      WINTER = 37
      SPRING = 38
      SUMMER = 39
      AUTUMN = 40
      
    end
    
    class CheckTime
      include TimeChecker
      def initialize
        @day = Time.now.strftime("%A")
        @month = Time.now.strftime("%m").to_i
        @date = Time.now.strftime("%d").to_i
        if @month >= 3 && @month <= 5
          if @month == 5 && @date >= 21
            $game_switches[WINTER] = false
            $game_switches[SPRING] = true
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = false
          elsif @date <= 20
            $game_switches[WINTER] = true
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = false
          end
        elsif @month >= 6 && @month <= 8
          if @month == 8 && @date >= 21
            $game_switches[WINTER] = false
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = true
            $game_switches[AUTUMN] = false
          elsif @date <= 20
            $game_switches[WINTER] = false
            $game_switches[SPRING] = true
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = false
          end
        elsif @month >= 9 && @month <= 11
          if @month == 11 && @date >= 21
            $game_switches[WINTER] = true
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = false
          elsif @date <= 20
            $game_switches[WINTER] = false
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = true
          end
        elsif @month >= 12 || @month <= 2
          if @month == 2 && @date >= 21
            $game_switches[WINTER] = true
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = false
          elsif @date <= 20
            $game_switches[WINTER] = false
            $game_switches[SPRING] = false
            $game_switches[SUMMER] = false
            $game_switches[AUTUMN] = true
          end
        end
        if @day == "Monday"
          $game_switches[MONDAY] = true
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = false
        elsif @day == "Tuesday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = true
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = false
        elsif @day == "Wednesday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = true
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = false
        elsif @day == "Thursday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = true
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = false
        elsif @day == "Friday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = true
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = false
        elsif @day == "Saturday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = true
          $game_switches[SUNDAY] = false
        elsif @day == "Sunday"
          $game_switches[MONDAY] = false
          $game_switches[TUESDAY] = false
          $game_switches[WEDNESDAY] = false
          $game_switches[THURSDAY] = false
          $game_switches[FRIDAY] = false
          $game_switches[SATURDAY] = false
          $game_switches[SUNDAY] = true
        end
      end
    end
    
    class Scene_Map
      alias cng_dayseason_map_main main
      def main
        CheckTime.new
        if $game_switches[TimeChecker::SPRING] && $season == false
          @season = Sprite.new
          @season.bitmap = RPG::Cache.picture("spring")
          @season.opacity = 0
        elsif $game_switches[TimeChecker::SUMMER] && $season == false
          @season = Sprite.new
          @season.bitmap = RPG::Cache.picture("summer")
          @season.opacity = 0
        elsif $game_switches[TimeChecker::AUTUMN] && $season == false
          @season = Sprite.new
          @season.bitmap = RPG::Cache.picture("autumn")
          @season.opacity = 0
        elsif $game_switches[TimeChecker::WINTER] && $season == false
          @season = Sprite.new
          @season.bitmap = RPG::Cache.picture("winter")
          @season.opacity = 0
        end
        @season.z = 9999997
        cng_dayseason_map_main
        @season.dispose
      end
      alias cng_dayseason_map_update update
      def update
        cng_dayseason_map_update
        if $season == false
          if @season.opacity < 255
            @season.opacity += 5
          elsif @season.opacity == 255
            $season = true
            Graphics.wait(60)
          end
        elsif $season == true
          if @season.opacity > 0
            @season.opacity -= 5
          end
        end
      end
    end
    
    $season = false


    Make 4 new images 480 x 320 and put them in Graphics/Pictures/

    autumn.png
    summer.png
    winter.png
    spring.png

    Then just run the game and test it :D
    Credits to me please if you use this.

    If you like this script and would like more, check regularly on my site http://www.planetdev.ihubhost.net (Temporary free domain)
    __________________
    PlanetDev - Game Development Community
    Reply With Quote

    Relevant Advertising!

      #2    
    Old November 14th, 2010 (10:14 AM).
    lark125 lark125 is offline
       
      Join Date: Apr 2008
      Posts: 33
      Great script man, i'm defenetly going to use it in my game
      Reply With Quote
        #3    
      Old November 15th, 2010 (7:54 AM).
      Maruno's Avatar
      Maruno Maruno is offline
      Lead Dev of Pokémon Essentials
         
        Join Date: Jan 2008
        Location: England
        Posts: 5,180
        Why do you spend half the script deciding what day it is? There's already a def that does that in Essentials (pbIsWeekday), and you don't even use the information anyway.

        And as for seasons, there's a def called zodiac in the newer versions of Essentials which takes a date and decides which zodiac number you're in. You can just lump 3 of those together and call it a season. However, if you need to have it stand-alone, why not use a single variable instead of four switches to store the season in (not to mention copy-paste-modify the zodiac def to apply to seasons instead, which would take up less space)?

        This script could be optimised a lot.
        __________________
        Go to the Pokémon Essentials Wiki

        | Downloads | Tutorials | Fangames |
        | All Animations Project |

        Follow me on Twitter: @maruno42


        Reply With Quote
          #4    
        Old November 15th, 2010 (1:03 PM).
        me2hack's Avatar
        me2hack me2hack is offline
        Graphics Artist
           
          Join Date: Jul 2009
          Gender: Female
          Nature: Quiet
          Posts: 292
          Quote:
          Originally Posted by Maruno View Post
          Why do you spend half the script deciding what day it is? There's already a def that does that in Essentials (pbIsWeekday), and you don't even use the information anyway.

          And as for seasons, there's a def called zodiac in the newer versions of Essentials which takes a date and decides which zodiac number you're in. You can just lump 3 of those together and call it a season. However, if you need to have it stand-alone, why not use a single variable instead of four switches to store the season in (not to mention copy-paste-modify the zodiac def to apply to seasons instead, which would take up less space)?

          This script could be optimised a lot.
          I think he made it for his own Kit first, which isn't made from Essentials. Not sure, though.
          __________________



          Reply With Quote
            #5    
          Old November 15th, 2010 (1:17 PM).
          Crazyninjaguy's Avatar
          Crazyninjaguy Crazyninjaguy is offline
          I'm back.
             
            Join Date: May 2008
            Location: England
            Age: 25
            Gender: Male
            Posts: 663
            Me2Hack is right, it was made for my Kit, so the information is used in that.
            I'm using switches as it's easier for newbies to understand, rather than seeing if a variable = 2 or whatever, it's easier to check if a switch named Summer is on.

            I just forgot to take the Days out, that's all.
            __________________
            PlanetDev - Game Development Community
            Reply With Quote
              #6    
            Old November 16th, 2010 (3:12 AM).
            DarkDoom3000's Avatar
            DarkDoom3000 DarkDoom3000 is offline
            Super Pokemon Eevee Edition
               
              Join Date: Jul 2004
              Location: New Zealand
              Age: 25
              Gender: Male
              Nature: Calm
              Posts: 1,694
              It's obvious that all pokemon fangames are made using essentials
              /sarc
              __________________
              Version 0.753 is out
              Thread | Website | Blog
              Reply With Quote
                #7    
              Old November 16th, 2010 (7:46 AM).
              Crazyninjaguy's Avatar
              Crazyninjaguy Crazyninjaguy is offline
              I'm back.
                 
                Join Date: May 2008
                Location: England
                Age: 25
                Gender: Male
                Posts: 663
                Well yeah, but this can be used in non pokemon projects.
                __________________
                PlanetDev - Game Development Community
                Reply With Quote
                  #8    
                Old November 16th, 2010 (3:12 PM).
                tato tato is offline
                   
                  Join Date: Aug 2010
                  Gender: Male
                  Nature: Naughty
                  Posts: 2
                  Thank you brother, your script helped me
                  Reply With Quote
                    #9    
                  Old November 16th, 2010 (10:20 PM).
                  Soul.//Silver's Avatar
                  Soul.//Silver Soul.//Silver is offline
                     
                    Join Date: Sep 2007
                    Location: Brisbane, Australia
                    Age: 24
                    Gender: Male
                    Nature: Jolly
                    Posts: 494
                    Does anyone actually have a video example of this in the actual B/W games? Before I decide to use it, I would actually like to know what it looks like.
                    Reply With Quote
                      #10    
                    Old November 27th, 2010 (4:35 AM).
                    Birdybot's Avatar
                    Birdybot Birdybot is offline
                    -insert witty phrase here-
                       
                      Join Date: Jun 2009
                      Location: In a place.
                      Age: 21
                      Gender: Female
                      Nature: Jolly
                      Posts: 160
                      Does this script do anything aside from show an image when the game starts up? As in, would it be possible to have different maps for each season (as in, the same town/route with snow and such)?
                      __________________


                      Reply With Quote
                        #11    
                      Old November 27th, 2010 (5:29 AM).
                      Crazyninjaguy's Avatar
                      Crazyninjaguy Crazyninjaguy is offline
                      I'm back.
                         
                        Join Date: May 2008
                        Location: England
                        Age: 25
                        Gender: Male
                        Posts: 663
                        No, it only displays the image of the season.
                        If you want a script to change the tileset, then Help-14 released one a while ago in this forum.
                        __________________
                        PlanetDev - Game Development Community
                        Reply With Quote
                          #12    
                        Old November 27th, 2010 (5:48 AM).
                        Birdybot's Avatar
                        Birdybot Birdybot is offline
                        -insert witty phrase here-
                           
                          Join Date: Jun 2009
                          Location: In a place.
                          Age: 21
                          Gender: Female
                          Nature: Jolly
                          Posts: 160
                          OK then, I'll go look for that, thanks mate
                          __________________


                          Reply With Quote
                          Reply

                          Quick Reply

                          Join the conversation!

                          Create an account to post a reply in this thread, participate in other discussions, and more!

                          Create a PokéCommunity Account

                          Sponsored Links
                          Thread Tools

                          Posting Rules
                          You may not post new threads
                          You may not post replies
                          You may not post attachments
                          You may not edit your posts

                          BB code is On
                          Smilies are On
                          [IMG] code is On
                          HTML code is Off

                          Forum Jump


                          All times are GMT -8. The time now is 5:15 PM.