Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] Animated Title Screen and Other Title Improvements

Notices
For all updates, view the main page.

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.



Reply
 
Thread Tools
  #1    
Old April 29th, 2013 (05:32 PM). Edited April 29th, 2013 by Rayd12smitty.
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
Hey guys. So Thanks to thor348 I figured out how to do something that has been bugging a LOT of people. How to Animate the Title Screen! I've seen many posts asking how you can use a .gif or multiple frames in a loop as a title screen instead of a static image. I found out how (It was actually really simple XD) Anyway here we go.


Tutorial by Rayd12smitty using Pokemon Essentials Version 11

The Images
First, you need your new title screen. No .gif images here! You need all your images as frames, one for each frame in the game (Unless you want to mess around with the timer) There are 20 frames in one second, so you may have a LOT of images. Thats alright though. Name your images
Splash_1, Splash_2, Splash_3, etc. Put them in a folder Called Splash inside your game folder in Graphics/Titles. I recommend over 100 frames, even if they are just duplicates. I have 40 different frames, but 3 or 4 of each one in a row so it doesn't move so fast. This brings the total to 120 or 160 depending on how fast I want it. It takes a while to name all the images but it needs to be done.

The Script
Alright. The script we are dealing with is Scene_Intro. This is the scene that loads the start screen (The black screen with Pokemon Essentials creators on it) and the Title screen. Open the script and go to line 50. It should say
Code:
@pic.name="Graphics/Titles/"+@splash
Directly ABOVE it, add the line
Code:
@Animation = 1
This sets the title screen's frame to 1.

Then REPLACE the line that is now line 51 which says
Code:
@pic.name="Graphics/Titles/"+@splash
with
Code:
@pic.name="Graphics/Titles/Splash/Splash_#{@Animation}"
This will change where the images are found and makes it so the images name depends on the variable we created (@Animation)

Halfway done. Now find the line that says
Code:
@timer=0 if @timer>=80
it should be around line 62. AFTER this line add
Code:
@Animation+=1 if @Animation<ZZZ
    @Animation = 1 if @Animation==ZZZ
    @pic.name="Graphics/Titles/Splash/Splash_#{@Animation}"
This adds 1 to the variable @Animation every frame and once it reaches a certain number resets it to 1. It also updates what image is being shown depending on the variable @Animation.

Replace ZZZ with how many frames your title screen has. If you have 160 images in the folder Graphics/Title/Splash, this number is 160. If you have 40 frames, this number is 40. Simple right?

Thats should do it :D Now your title screen acts animated, not static. Below I will explain one more little change to the title screen to help your game.

The Cry
If you've played your game or any other Pokemon Essentials game, you know that a random pokemon's cry is played when the "Enter" button is pressed. But your game might be about Rayquaza, you don't want a random Wynaut screaming when the player hits start! This is a real simple fix. Once again in the script Scene_Intro search for
Code:
cry=sprintf("%03dCry",1+rand(PBSpecies.maxValue))
    pbSEPlay(cry,100,100)
and replace it with
Code:
pbSEPlay('ZZZCry',100,100)
where ZZZ is the national dex number of the pokemon who's cry you want played.
There are 2 places in the script where these lines are found. Do this to both

Please Read
Thats all. Thanks for reading through this and I hope you found it helpful. If you use the animated title screen edits, please give me credit Rayd12smitty. I don't require credit for the cry played. Please comment with any questions/errors (Although there shouldn't be errors if you followed the directions right)


Example (Mine don't use)
__________________
Reply With Quote
  #2    
Old April 29th, 2013 (05:40 PM).
ppooookkkkkkk ppooookkkkkkk is offline
Banned
 
Join Date: May 2012
Location: Newbud town (Pokemon Morning/Night)
Age: 14
Gender: Male
Nature: Gentle
Posts: 229
I love all your tutorials (as well as carmaniacs).
This tutorial hopefully will make my game more attractive thank you.
Reply With Quote
  #3    
Old April 29th, 2013 (05:59 PM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
Quote originally posted by ppooookkkkkkk:
I love all your tutorials (as well as carmaniacs).
This tutorial hopefully will make my game more attractive thank you.
I've only made 2 or 3 XD Thanks so much though it means a lot. Carmaniac actually taught me just about every thing I know about scripting.
__________________
Reply With Quote
  #4    
Old April 29th, 2013 (09:41 PM).
KingCharizard's Avatar
KingCharizard KingCharizard is offline
C++ Developer Extraordinaire
 
Join Date: Dec 2009
Location: Pennsylvania
Age: 26
Gender: Male
Nature: Bold
Posts: 1,245
Quote originally posted by Rayd12smitty:
I've only made 2 or 3 XD Thanks so much though it means a lot. Carmaniac actually taught me just about every thing I know about scripting.
Thats interesting, I remember when carmaniac wasnt that good with scripting himself but nice tut, I do think it would be easier to just use .gif but this way works too
__________________
My personal website. UPDATED 8/29/2013
Reply With Quote
  #5    
Old April 30th, 2013 (03:42 AM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
Quote originally posted by KingCharizard:
Thats interesting, I remember when carmaniac wasnt that good with scripting himself but nice tut, I do think it would be easier to just use .gif but this way works too
.gifs don't work. That's why I made this. When you try using a .gif for a splash screen it just shows the first frame and never animates.
__________________
Reply With Quote
  #6    
Old April 30th, 2013 (05:19 AM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
@LukaSJ0
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 892
Quote originally posted by Rayd12smitty:
.gifs don't work. That's why I made this. When you try using a .gif for a splash screen it just shows the first frame and never animates.
GIFs could have worked if you changed the variable of the splash sprite to be using the class GifSprite instead of PictureEx, and then just set a @pic.update in the def updateSplash. Just sayin'...

Quote originally posted by KingCharizard:
Thats interesting, I remember when carmaniac wasnt that good with scripting himself
Ryan has come a long way in a small period of time. He was really dedicated to improving his skills, both in coding and spriting.
__________________
Reply With Quote
  #7    
Old April 30th, 2013 (07:57 AM).
KingCharizard's Avatar
KingCharizard KingCharizard is offline
C++ Developer Extraordinaire
 
Join Date: Dec 2009
Location: Pennsylvania
Age: 26
Gender: Male
Nature: Bold
Posts: 1,245
Quote originally posted by Luka S.J.:
GIFs could have worked if you changed the variable of the splash sprite to be using the class GifSprite instead of PictureEx, and then just set a @pic.update in the def updateSplash. Just sayin'...



Ryan has come a long way in a small period of time. He was really dedicated to improving his skills, both in coding and spriting.

Yea Luka is right, if you modify the code like you did with the above method you could easily use .gifs

Oh, snap first name basis.. it just got serious.. Yea i know I've been seeing his posts havent talked to him lately since they got rid of MSN
__________________
My personal website. UPDATED 8/29/2013
Reply With Quote
  #8    
Old April 30th, 2013 (09:05 AM).
thor348's Avatar
thor348 thor348 is offline
That's Oak to You
 
Join Date: Nov 2012
Location: Albion
Gender: Male
Nature: Calm
Posts: 136
Quote originally posted by Luka S.J.:
GIFs could have worked if you changed the variable of the splash sprite to be using the class GifSprite instead of PictureEx, and then just set a @pic.update in the def updateSplash. Just sayin'...
Ahh yes. That does work. Very sorry Rayd12smitty for providing a more difficult way to do it
Reply With Quote
  #9    
Old April 30th, 2013 (03:52 PM). Edited April 30th, 2013 by Rayd12smitty.
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
I kind of meant gifs wouldn't work without script edits. Either way it's working and some people may prefer this method.
__________________
Reply With Quote
  #10    
Old April 30th, 2013 (07:01 PM).
KingCharizard's Avatar
KingCharizard KingCharizard is offline
C++ Developer Extraordinaire
 
Join Date: Dec 2009
Location: Pennsylvania
Age: 26
Gender: Male
Nature: Bold
Posts: 1,245
Quote originally posted by Rayd12smitty:
I kind of meant gifs wouldn't work without script edits. Either way it's working and some people may prefer this method.
isnt your way editing a script as well? There is nothing against your method it just is gonna take a little bit more work than the .gif method. but your right some people may prefer this way opposed to the other way. to each their own...

anyways nice tutorial overall, very clear and precise with the instructions.. I like your style, looking forward to seeing more from you.
__________________
My personal website. UPDATED 8/29/2013
Reply With Quote
  #11    
Old May 1st, 2013 (01:44 AM).
Pharetra's Avatar
Pharetra Pharetra is offline
MOM GET THE CAMERA
 
Join Date: Jun 2011
Age: 19
Gender: Male
Posts: 453
Quote originally posted by thor348:
Ahh yes. That does work. Very sorry Rayd12smitty for providing a more difficult way to do it
Don't worry, your way has it's own advantages. You won't be restricted to 252 colours for example, which is something I really like ;)

Thanks for the tutorial :)
__________________
Reply With Quote
  #12    
Old May 2nd, 2013 (04:26 AM).
Peeky Chew's Avatar
Peeky Chew Peeky Chew is offline
Master of Palettes
Crystal Tier
 
Join Date: Sep 2009
Location: Great Britain
Age: 21
Gender: Male
Posts: 852
Can someone please explain what exactly you have to change about smitty's script to make it work with .GIFs?
__________________



Demo Beta out Now!

Reply With Quote
  #13    
Old May 7th, 2013 (07:38 AM).
tylerab01's Avatar
tylerab01 tylerab01 is offline
Pokemon AquaHarmony
 
Join Date: Apr 2009
Location: France
Gender: Male
Nature: Bold
Posts: 165
Quote originally posted by Peeky Chew:
Can someone please explain what exactly you have to change about smitty's script to make it work with .GIFs?
I believe this will work, but Luka knows better than I.

@viewport=Viewport.new(0,0,GRAPHICSHEIGHT,GRAPHICSWIDTH)
@sprites["Pic"]=GifSprite.new (@viewport)
@sprites["Pic"].bitmap=BitmapCache.load_bitmap("PATH TO PICTURE")


I set my own viewports so you will have to check the Settings Script of Essentials.

-AvD
__________________

Reply With Quote
  #14    
Old December 2nd, 2013 (10:24 PM).
CrazyClyde's Avatar
CrazyClyde CrazyClyde is offline
 
Join Date: Oct 2013
Location: Bay Area, California
Gender: Male
Nature: Jolly
Posts: 1
For some reason, when I did all the scripts for the cry at the end. an error came up, and it said, "Script 'Scene_Intro' line 111: SyntaxError occured,". Any idea? I didn't even mess with that line..
Reply With Quote
  #15    
Old December 3rd, 2013 (07:04 PM).
WinterKirby's Avatar
WinterKirby WinterKirby is offline
 
Join Date: Dec 2012
Age: 3
Gender: Male
Nature: Mild
Posts: 152
Quote originally posted by CrazyClyde:
For some reason, when I did all the scripts for the cry at the end. an error came up, and it said, "Script 'Scene_Intro' line 111: SyntaxError occured,". Any idea? I didn't even mess with that line..
What do you have on line 111?
__________________
X/Y Friend Code: 1349-5852-1728 | Pinkie | Flying | Hoot-Hoot, Pidgey, and Tropius

Reply With Quote
  #16    
Old February 8th, 2015 (07:33 AM).
ultrademise ultrademise is offline
 
Join Date: Jun 2014
Posts: 3
when i try to test this, i get the following error:
Script 'Scene_Intro' line 58: SyntaxError occured
please help me

This is my script
Spoiler:
class IntroEventScene < EventScene
def initialize(pics,splash,viewport=nil)
super(nil)
@pics=pics
@splash=splash
@pic=addImage(0,0,"")
@pic.moveOpacity(0,0,0) # fade to opacity 0 in 0 frames after waiting 0 frames
@pic2=addImage(0,322,"") # flashing "Press Enter" picture
@pic2.moveOpacity(0,0,0)
@index=0
data_system = pbLoadRxData("Data/System")
pbBGMPlay(data_system.title_bgm)
openPic(self,nil)
end

def openPic(scene,args)
onCTrigger.clear
@pic.name="Graphics/Titles/"+@pics[@index]
@pic.moveOpacity(15,0,255) # fade to opacity 255 in 15 frames after waiting 0 frames
pictureWait
@timer=0 # reset the timer
onUpdate.set(method(:timer)) # call timer every frame
onCTrigger.set(method(:closePic)) # call closePic when C key is pressed
end

def timer(scene,args)
@timer+=1
if @timer>80
@timer=0
closePic(scene,args) # Close the picture
end
end

def closePic(scene,args)
onCTrigger.clear
onUpdate.clear
@pic.moveOpacity(15,0,0)
pictureWait
@index+=1 # Move to the next picture
if @index>=@pics.length
openSplash(scene,args)
else
openPic(scene,args)
end
end

def openSplash(scene,args)
onCTrigger.clear
onUpdate.clear
@Animation = 1
@pic.name="Graphics/Titles/Splash/Splash_#{@Animation
@pic.moveOpacity(15,0,255)
@pic2.name="Graphics/Titles/start"
@pic2.moveOpacity(15,0,255)
pictureWait
onUpdate.set(method(:splashUpdate)) # call splashUpdate every frame
onCTrigger.set(method(:closeSplash)) # call closeSplash when C key is pressed
end

def splashUpdate(scene,args)
@timer+=1
@timer=0 if @timer>=80
@Animation+=1 if @Animation<1
@Animation = 1 if @Animation==1
@pic.name="Graphics/Titles/Splash/Splash_#{@Animation
if @timer>=32
@pic2.moveOpacity(0,0,8*(@timer-32))
else
@pic2.moveOpacity(0,0,255-(8*@timer))
end
if Input.press?(Input::DOWN) &&
Input.press?(Input::B) &&
Input.press?(Input::CTRL)
closeSplashDelete(scene,args)
end
end

def closeSplash(scene,args)
onCTrigger.clear
onUpdate.clear
# Play random cry
pbSEPlay('384Cry',100,100)
# Fade out
@pic.moveOpacity(15,0,0)
@pic2.moveOpacity(15,0,0)
pbBGMStop(1.0)
pictureWait
scene.dispose # Close the scene
sscene=PokemonLoadScene.new
sscreen=PokemonLoad.new(sscene)
sscreen.pbStartLoadScreen
end

def closeSplashDelete(scene,args)
onCTrigger.clear
onUpdate.clear
# Play random cry
pbSEPlay('384Cry',100,100)
# Fade out
@pic.moveOpacity(15,0,0)
@pic2.moveOpacity(15,0,0)
pbBGMStop(1.0)
pictureWait
scene.dispose # Close the scene
sscene=PokemonLoadScene.new
sscreen=PokemonLoad.new(sscene)
sscreen.pbStartDeleteScreen
end
end



class Scene_Intro
def initialize(pics, splash = nil)
@pics=pics
@splash=splash
end

def main
Graphics.transition(0)
@eventscene=IntroEventScene.new(@pics,@splash)
@eventscene.main
Graphics.freeze
end
end
Reply With Quote
Reply
Quick Reply

Sponsored Links

You may also like.. (Beta)
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 UTC -8. The time now is 12:40 PM.