PDA

View Full Version : [Essentials script] B/W Season Splash


Crazyninjaguy
November 14th, 2010, 07:50 AM
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:

#===============================================================================
# * 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)

lark125
November 14th, 2010, 10:14 AM
Great script man, i'm defenetly going to use it in my game :classic:

Maruno
November 15th, 2010, 07:54 AM
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.

me2hack
November 15th, 2010, 01:03 PM
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.

Crazyninjaguy
November 15th, 2010, 01:17 PM
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.

DarkDoom3000
November 16th, 2010, 03:12 AM
It's obvious that all pokemon fangames are made using essentials
/sarc

Crazyninjaguy
November 16th, 2010, 07:46 AM
Well yeah, but this can be used in non pokemon projects.

tato
November 16th, 2010, 03:12 PM
Thank you brother, your script helped me

Soul.//Silver
November 16th, 2010, 10:20 PM
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.

Birdybot
November 27th, 2010, 04:35 AM
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)?

Crazyninjaguy
November 27th, 2010, 05:29 AM
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.

Birdybot
November 27th, 2010, 05:48 AM
OK then, I'll go look for that, thanks mate ^_^