Help - Search - Members - Calendar
Full Version: Ending Credits Script
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
Emily_Konichi
Use this script to make Ending Credits at the end of your game. Simply call
CODE
$scene = Scene_Credits.new
To change the image used in the background change
CODE
@backgroundList = ["Pic_2"]
to another image in your Titles (I think that's it anyway). Also, they loop if you wish to post multiples, say, if you are making a zelda game and want the Triforce to spin in the background, just do this
CODE
@backgroundList = ["Triforce1","Triforce2","etc"]


Credit goes to Emily_Konichi (yay me!), AvatarMonkeyKirby, and another unknown...most likely Wachunga.

CODE
CREDITS_FONT = ["Times New Roman"]
CREDITS_SIZE = 24
CREDITS_OUTLINE = Color.new(0,0,127, 255)
CREDITS_SHADOW = Color.new(0,0,0, 100)
CREDITS_FILL = Color.new(255,255,255, 255)

#==============================================================================
# ¦ Scene_Credits
#------------------------------------------------------------------------------
# Scrolls the credits you make below. Original Author unknown. Edited by
# MiDas Mike (now known as Emily_Konichi) so it doesn't play over the Title, but runs by calling the following:
# $scene = Scene_Credits.new
# New Edit 3/6/2007 11:14 PM by AvatarMonkeyKirby.
# Ok, what I've done is changed the part of the script that was supposed to make
# the credits automatically end so that way they actually end! Yes, they will
# actually end when the credits are finished! So, that will make the people you
# should give credit to now is: UNKOWN, Emily_Konichi, and AvatarMonkeyKirby.
#                                             -sincerly yours,
#                                               Your Beloved
# Oh yea, and I also added a line of code that fades out the BGM so it fades
# sooner and smoother.
#==============================================================================

class Scene_Credits

# This next piece of code is the credits.
CREDIT=<<_END_
#Start Editing
Credits!
--------------
Here you can make
a list of people who
made the project.
Like regular ending
credits to any normal
video game out there!
Yay!
#Stop Editing
_END_
def main

#-------------------------------
# Animated Background Setup
#-------------------------------

@sprite = Sprite.new
#@sprite.bitmap = RPG::Cache.title($data_system.title_name)
@backgroundList = ["Pic_2"] #Edit this to the title screen(s) you wish to show in the background. They do repeat.
@backgroundGameFrameCount = 0
# Number of game frames per background frame.
@backgroundG_BFrameCount = 3.4
@sprite.bitmap = RPG::Cache.title(@backgroundList[0])

#------------------
# Credits txt Setup
#------------------

credit_lines = CREDIT.split(/\n/)
credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
credit_lines.each_index do |i|
line = credit_lines[i]
credit_bitmap.font.name = CREDITS_FONT
credit_bitmap.font.size = CREDITS_SIZE
x = 0
credit_bitmap.font.color = CREDITS_OUTLINE
credit_bitmap.draw_text(0 + 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 + 1,i * 32 - 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 - 1,640,32,line,1)
credit_bitmap.font.color = CREDITS_SHADOW
credit_bitmap.draw_text(0,i * 32 + 8,640,32,line,1)
credit_bitmap.font.color = CREDITS_FILL
credit_bitmap.draw_text(0,i * 32,640,32,line,1)
end
@credit_sprite = Sprite.new(Viewport.new(0,50,640,380))
@credit_sprite.bitmap = credit_bitmap
@credit_sprite.z = 9998
@credit_sprite.oy = -430 #-430
@frame_index = 0
@last_flag = false

#--------
# Setup
#--------

#Stops all audio but background music.
Audio.me_stop
Audio.bgs_stop
Audio.se_stop

Graphics.transition

loop do

Graphics.update
Input.update


update
if $scene != self
break
end
end
Graphics.freeze
@sprite.dispose
@credit_sprite.dispose
end

##Checks if credits bitmap has reached it's ending point
def last?
    if @frame_index > (@credit_sprite.bitmap.height + 500)
       $scene = Scene_Map.new
       Audio.bgm_fade(10000) #aprox 10 seconds
      return true
    end
      return false
    end

#Check if the credits should be cancelled
def cancel?
    if Input.trigger?(Input::C)
      $scene = Scene_Map.new
      return true
    end
      return false
    end
def update
@backgroundGameFrameCount = @backgroundGameFrameCount + 1
if @backgroundGameFrameCount >= @backgroundG_BFrameCount
@backgroundGameFrameCount = 0
# Add current background frame to the end
@backgroundList = @backgroundList << @backgroundList[0]
# and drop it from the first position
@backgroundList.delete_at(0)
@sprite.bitmap = RPG::Cache.title(@backgroundList[0])
end
return if cancel?
return if last?
@credit_sprite.oy += 1 #this is the speed that the text scrolls. 1 is default
#The fastest I'd recomend is 5, after that it gets hard to read.
@frame_index += 1 #This should fix the non-self-ending credits
end
end
Redd
Wait a second I was using your script for my credits the whole time? No way! That's awesome! I didn't know you were Midas Mike! That's sweet! I use this script for every game I make so it is really helpful to me. In Aradiah I'm not using it though because I'm using pictures instead.

Here's a little fix for you though : Oh nevermind you edited all that junk out and put number signs in front of the start and end things so that they don't show. That's a really awesome script.
Emily_Konichi
hehe, yeah, I was originally MiDas Mike. After I realized my transexuality, though, I switched names...I'm still SCMike on Creation Asylum, but that's because I can't change my name, and their rules say I can't make a second account for the purpose of name change...
DespairReigns
I have a question though, which category of scripts do we put this in? Is it a call script?
Emily_Konichi
err...yes? I'd guess by call script you mean a script that has to be run using "call script"? If so, then yes, if not, then I have no idea what kind of category it would be in ^^"
DespairReigns
Nevermind, I figured out I had to make a new category called Scene_Credits in XP.
Thanks!
Emily_Konichi
Oh, yeah, you have to make a new category...sorry, I couldn't figure out what you meant. But, yeah, just make sure it goes between Scene_Debug and Main and you should be good...you might need to move it around if you have other custom scripts, though...mine is like...the 10th out of 33 scripts for my game...
Jizzo
yea cool this is really helpfull ^^
and can i put any kind of music in the script? also mp3? and can i put some video files? You know that if you see the credits and then you see all the things the player has been through in the game etc.
Fraöt
Cool! It works, thanx!

But I need to know how to play a bgm, directly from the script, not on the map.

QUOTE
#--------
# Setup
#--------

#Stops all audio but background music.
Audio.me_stop
Audio.bgs_stop
Audio.se_stop
Audio.bgm_stop
<--------- I think here goes a "Audio.bgm_play"... Am I right?
Graphics.transition

loop do

Graphics.update
Input.update


I hope you can help me.
obsorber
By what I'm seeing, this script looks very good and easy to use. I will consider using it for the ending of my game then... tongue.gif
mana child
Is there a way to make more than one script like for an opening credits?
obsorber
I know this is an Ending Credit's Script but can you use it at the start of your game
aswell? huh.gif
Momo_san
Well,it's looks that it's not too complicated... I hope tongue.gif
Then maybe i will use this for my project thanx a lot laugh.gif
BlackStatic
QUOTE (Emily_Konichi @ Oct 30 2008, 08:32 PM) *
Use this script to make Ending Credits at the end of your game. Simply call
CODE
$scene = Scene_Credits.new
To change the image used in the background change
CODE
@backgroundList = ["Pic_2"]
to another image in your Titles (I think that's it anyway). Also, they loop if you wish to post multiples, say, if you are making a zelda game and want the Triforce to spin in the background, just do this
CODE
@backgroundList = ["Triforce1","Triforce2","etc"]


Credit goes to Emily_Konichi (yay me!), AvatarMonkeyKirby, and another unknown...most likely Wachunga.

CODE
CREDITS_FONT = ["Times New Roman"]
CREDITS_SIZE = 24
CREDITS_OUTLINE = Color.new(0,0,127, 255)
CREDITS_SHADOW = Color.new(0,0,0, 100)
CREDITS_FILL = Color.new(255,255,255, 255)

#==============================================================================
# ¦ Scene_Credits
#------------------------------------------------------------------------------
# Scrolls the credits you make below. Original Author unknown. Edited by
# MiDas Mike (now known as Emily_Konichi) so it doesn't play over the Title, but runs by calling the following:
# $scene = Scene_Credits.new
# New Edit 3/6/2007 11:14 PM by AvatarMonkeyKirby.
# Ok, what I've done is changed the part of the script that was supposed to make
# the credits automatically end so that way they actually end! Yes, they will
# actually end when the credits are finished! So, that will make the people you
# should give credit to now is: UNKOWN, Emily_Konichi, and AvatarMonkeyKirby.
#                                             -sincerly yours,
#                                               Your Beloved
# Oh yea, and I also added a line of code that fades out the BGM so it fades
# sooner and smoother.
#==============================================================================

class Scene_Credits

# This next piece of code is the credits.
CREDIT=<<_END_
#Start Editing
Credits!
--------------
Here you can make
a list of people who
made the project.
Like regular ending
credits to any normal
video game out there!
Yay!
#Stop Editing
_END_
def main

#-------------------------------
# Animated Background Setup
#-------------------------------

@sprite = Sprite.new
#@sprite.bitmap = RPG::Cache.title($data_system.title_name)
@backgroundList = ["Pic_2"] #Edit this to the title screen(s) you wish to show in the background. They do repeat.
@backgroundGameFrameCount = 0
# Number of game frames per background frame.
@backgroundG_BFrameCount = 3.4
@sprite.bitmap = RPG::Cache.title(@backgroundList[0])

#------------------
# Credits txt Setup
#------------------

credit_lines = CREDIT.split(/\n/)
credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
credit_lines.each_index do |i|
line = credit_lines[i]
credit_bitmap.font.name = CREDITS_FONT
credit_bitmap.font.size = CREDITS_SIZE
x = 0
credit_bitmap.font.color = CREDITS_OUTLINE
credit_bitmap.draw_text(0 + 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 + 1,i * 32 - 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 - 1,640,32,line,1)
credit_bitmap.font.color = CREDITS_SHADOW
credit_bitmap.draw_text(0,i * 32 + 8,640,32,line,1)
credit_bitmap.font.color = CREDITS_FILL
credit_bitmap.draw_text(0,i * 32,640,32,line,1)
end
@credit_sprite = Sprite.new(Viewport.new(0,50,640,380))
@credit_sprite.bitmap = credit_bitmap
@credit_sprite.z = 9998
@credit_sprite.oy = -430 #-430
@frame_index = 0
@last_flag = false

#--------
# Setup
#--------

#Stops all audio but background music.
Audio.me_stop
Audio.bgs_stop
Audio.se_stop

Graphics.transition

loop do

Graphics.update
Input.update


update
if $scene != self
break
end
end
Graphics.freeze
@sprite.dispose
@credit_sprite.dispose
end

##Checks if credits bitmap has reached it's ending point
def last?
    if @frame_index > (@credit_sprite.bitmap.height + 500)
       $scene = Scene_Map.new
       Audio.bgm_fade(10000) #aprox 10 seconds
      return true
    end
      return false
    end

#Check if the credits should be cancelled
def cancel?
    if Input.trigger?(Input::C)
      $scene = Scene_Map.new
      return true
    end
      return false
    end
def update
@backgroundGameFrameCount = @backgroundGameFrameCount + 1
if @backgroundGameFrameCount >= @backgroundG_BFrameCount
@backgroundGameFrameCount = 0
# Add current background frame to the end
@backgroundList = @backgroundList << @backgroundList[0]
# and drop it from the first position
@backgroundList.delete_at(0)
@sprite.bitmap = RPG::Cache.title(@backgroundList[0])
end
return if cancel?
return if last?
@credit_sprite.oy += 1 #this is the speed that the text scrolls. 1 is default
#The fastest I'd recomend is 5, after that it gets hard to read.
@frame_index += 1 #This should fix the non-self-ending credits
end
end


Alright, the script worked fine for me as I was testing it, but after putting in all of the information, it wouldnt play. it only says 'script is hanging', then shuts down the game. did i put too much info in?

and yes, i did make sure to hit enter when i came close to the 'edge' of the screen. i used the original text as a guide.
Linkio123
thank you sooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
much! this is really gonna help with my game...
Here's 2 pics!
JEHINC.
EXTRA NICE SCRIPT!! I will surely use this baby in my RMXP project! Great job for making this script! biggrin.gif
Taiine
Could someone make a small demo with this so I can see how it looks? I can't seem to get it to work for mine. Nothing shows sad.gif
The Law G14
@Taiine: To show the credits you have to make an event. Go to the last page of the list of event commands and click 'script'. In there, copy and paste this into it:

CODE
$scene = Scene_Credits.new


Hope that helped smile.gif
Taiine
QUOTE (The Law G14 @ Oct 11 2009, 09:35 AM) *
@Taiine: To show the credits you have to make an event. Go to the last page of the list of event commands and click 'script'. In there, copy and paste this into it:

CODE
$scene = Scene_Credits.new


Hope that helped smile.gif


That uis what I've done but it just sits there and does nothing.
Night_Runner
What you need to do, straight after your event runs the script:
$scene = Scene_Credits.new
You need to put a wait command in, for as few as 1 frame if you want, but there needs to be a wait.
If that isn't it, here's what I was originally going to post:
[Show/Hide] Don't spoil the surprise
Sometimes there's nothing better than a demo....
Secret Stash 2
Just a few notes, if you go into Tools >> Script Editor, and scroll down on the left hand side, just before Main there should be Credits - Emily Konichi
Everything that I've put in, has been between lines 28 - 38, so you can edit everything from Credits! down to And especially to ...

And 1 other point of notice, the event, after
@> Script: $scene = Scene_Credits.new
There is a
@> Wait: 1 frame(s)
That wait is necessary.
Taiine
Hm, can the text be slowed down more? I'm tweaking this a bit to try and make an 'intro short story' for my game but the text still scrolls up to fast even with the speed set at it's lowest.
Seitei Son Goku
A very nice script! There can't be a game with out credits!

There is only one thing I still don't get about this script though...

It seems to have a "limit" to how long the credits can be. If you put too much, it says "Script is hanging" and shuts down the whole program.
Is there a way to break that limit without it freezing and shutting down? Or is it really too much for the system to handle?

Either way, it worked for me! cool.gif
Jujiro
Oh..err..It's a good code..helped me alot..
but how to change the text color?
I'm tweaking it but it just won't change the font color..it's just white..
I need it to be black though.. happy.gif
stripe103
QUOTE (Jujiro @ Apr 12 2010, 05:01 PM) *
Oh..err..It's a good code..helped me alot..
but how to change the text color?
I'm tweaking it but it just won't change the font color..it's just white..
I need it to be black though.. happy.gif

In the top of the script there is a configuration part
CODE
CREDITS_FONT = ["Times New Roman"]
CREDITS_SIZE = 24
CREDITS_OUTLINE = Color.new(0,0,127, 255)
CREDITS_SHADOW = Color.new(0,0,0, 100)
CREDITS_FILL = Color.new(255,255,255, 255)

Have you tried that?
Jujiro
QUOTE (stripe103 @ Apr 12 2010, 11:50 PM) *
QUOTE (Jujiro @ Apr 12 2010, 05:01 PM) *
Oh..err..It's a good code..helped me alot..
but how to change the text color?
I'm tweaking it but it just won't change the font color..it's just white..
I need it to be black though.. happy.gif

In the top of the script there is a configuration part
CODE
CREDITS_FONT = ["Times New Roman"]
CREDITS_SIZE = 24
CREDITS_OUTLINE = Color.new(0,0,127, 255)
CREDITS_SHADOW = Color.new(0,0,0, 100)
CREDITS_FILL = Color.new(255,255,255, 255)

Have you tried that?


yeah i tried that. i tried tweaking that to black..but its still on white text and blue outline.. happy.gif
stripe103
Strange. Works like a charm for me.
You don't have any other script that changes the variables CREDITS_FILL and CREDITS_OUTLINE?
Locke
Very nice ad well made script i like it thumbsup.gif

SALUTE!!
spextre
I am a little new at this... What I'm tring to do is have the credits run from a window option on the title screen. I have the window option set and the call script in place, but I'm getting an error message when I select the Credits option on the title window

"Script `Main' line 14: NoMethodError occurred
undefined `main' for Scene_Credits:Class"

Nothing was changed on the Main script, Any suggestions or ideas please?

*********************************
Nevermind... I figured it out. I forgot to put a .new to the end of my call script in the Title script smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.