Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Credits Script

Status
Not open for further replies.
Note: This is NOT my script. I found it in the Project Zelda Engine. I did, however, edit it so that it may be called with $scene = Scene_Credits.new instead of having it appear on the Title Screen (which is very annoying).
If you are the original author of this script, please say so and I will give credit ASAP (basically...whenever I see your post).


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 so it doesn't play over the Title, but runs by calling the following:
#  $scene = Scene_Credits.new
#==============================================================================

class Scene_Credits

  # This next piece of code is the credits.
  
    CREDIT=<<_END_
#Start Editing
Untitled Project

Director
---------------
MiDas Mike

Scripts
---------------
SephirothSpawn
Deke
Dubealex
Momomomo? (yes, that's their name)
Wachunga
Near Fantastica
Datriot
MeisMe
rpgmaker
CogWheel
BudsieBuds

Graphics
---------------
Tana
zanyzora
ccoa
Enterbrain
TR-the-one-and-only

Music and sound
---------------
Andrew Estrada
DoomWorld.com
IcePlug
Andy Smith
Enterbrain
Joe Gallagher
drenrin2120

Mapping
---------------
MiDas Mike

Storyline
---------------
MiDas Mike

Beta Testers
---------------


Special Thanks
---------------
Unlimited Adventures - "Without that game, this game would never
have made a start. UA is where Journey of Heroes first started."

Trickster - "Thanks for fixing the scripts. I greatly appreciate your
help in this project."

---------------

Thank you for playing this game. We hope you enjoyed it. Watch for
other titles by MiDas Productions in the future..

#Stop Editing
_END_
  def main
    
    #-------------------------------
    # Animated Background Setup
    #-------------------------------
    @sprite = Sprite.new
    #@sprite.bitmap = RPG::Cache.title($data_system.title_name)
    @backgroundList = ["MiDas"] #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 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
    @frame_index = 0
    @last_flag = false
    
    #--------
    # Setup
    #--------
    
    # ME?BGS ??????
    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?
    return (@frame_index >= @credit_sprite.bitmap.height + 480)
  end
  def last
    if not @last_flag
      @last_flag = true
      @last_count = 0
    else
      @last_count += 1
    end
    if @last_count >= 300
      $scene = Scene_Map.new
    end
  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?
    last if last?
    @credit_sprite.oy += 1
  end
end

So, anyway, what this does is it plays the ending credits. You simply start the music you want (usually I put the player on a special map specifically for the Ending Credits) and then run an Auto-run process and call the script "$scene = Scene_Credits.new" (without the quotation marks...DUH!!!)

It will automatically put the words in the center of the screen, so you won't have to worry about that. Any questions, feel free to ask...not sure if I can answer or not, though...It is SDK compatible (thanks to Master Inuyasha for finding out for me.)
 
Never Mind...I fixed it...just go in and replace the section between CREDITS=<<_END_ and _END_ with the new one above. For some reason, the comments that were after each _END_ messed the script up...not sure why...Basically, go in and delete those 2 comments and it will work (or just recopy the script above)
 
Hmm...the following is possible...1) you're missing Times New Roman (which is the font needed) 2) it's lagging an error about not having the "MiDas" image... or 3) ...I have no idea... it works fine for me...
 
Awesome script; is there any way of detecting when all the credits' finished scrolling though? So I can make it go back to title page or something? Thanks in advance.
 
in the script, near the bottom, look for the method called def last. there should be a line that says
Code:
$scene = Scene_Map.new
change that to say
Code:
$scene = Scene_Title.new
.
then find def cancel, which should be just under neath that...
find this line
Code:
$scene = Scene_Map.new
and change it to
Code:
$scene = Scene_title.new

after this, when the credits roll, it will return the player to the title screen. also, if they press the cancel button, it returns them to the title screen.
 
I'm not sure if that'll do it, as def last checks if the background reaches the end...and I'm not sure how to change it so the background will match your credits, but...
 
Help please, I tried to use it but it says I'm missings "MiDas" I made a directory in there and put in my imaegs but it wont work.
 
Find this line.
Code:
@backgroundList = ["MiDas"]
and change "MiDas" to whatever the titles you have are (i.e. you have 4 titles so it would be like "Title1","Title2","Title3","Title4" etc) After that, just upload your images into the Titles section. Just remember, though, that they circulate. They don't fade between, so I recommend using 1 image or several images that are set up to move. In the original it had 65 images that were the Triforce circulating. They formed into the triforce over 65 images, and then they went backwards and unformed.
 
WOW. TOTAL ACCIDENTAL NECRO POST. SORRY.

I have a credits script, it creates a window that scrolls the information found in a text file.

First, create a text-file with your credits and put it in ..\Credits\ and name it "credits.rxdata"

Then, copy and paste this script above main, name it Window_Credits:

Code:
class Window_Credits < Window_Base
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @credits = IO.readlines("credits/credits.rxdata")
    @y = 240
    @max_y = @credits.size * 32
    refresh
  end
  def refresh
    self.contents.clear
    for i in 0...@credits.size
      self.contents.draw_text(0, @y + (i * 32), self.contents.width, 32, @credits[i].to_s, 1)
    end
  end
  def update
    return if Graphics.frame_count % 2 != 0
    @y -= 1
    if @y == (-1 * @max_y)
      @y = 240
    end
    refresh
  end
end

Now, to use it, you can do one of those things:

1. Create the window object in an existing scene (I usually used it in Scene_Title) by adding this line in the main() method:

@credits_window = Window_Credits.new

and the appropriate dispose/update lines.

2. Create a new scene with just this window, like so:

Code:
class Scene_Credits
  def main
    @credits_window = Window_Credits.new
    $game_system.bgm_play("CreditsMusic") # <- Change "CreditsMusic" to the name of the music sound file.
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @credits_window.dispose
  end
  def update
    @credits_window.update
    if Input.trigger?(Input::B) or Input.trigger?(Input::C)
      $scene = Scene_Title.new # Change this line as you see fit.
    end
  end
end


Here is an example credits.rxdata file:
-Creator-
Prexus

-Scripting-
Enterbrain
Prexus
Dubealex (AMS)
Near Fantastica (View Range)
Sandgolem (Anti-Event Lag)
RMXP.net (SDK)

-Graphics-
Enterbrain
Prexus
Kaeru-Sama (Portraits)
Despain (Animations/Title)
Ragnarok Online (Icons)
Nintendo (Coins)

-Music-
Enterbrain
Astral Craft (satoc)

-Special Thanks-
RMXP.org
rpgmaker.net
Enterbrain

Anaryu
Despain
Kaeru-Sama
MeisMe
ccoa
ArtBane
FzGhouL
 
Sorry this sounds stupid but how do I set up an Auto-Run process so the credits will appear on the screen of my selected map. I have no clue how to do this.

Thanks in advance, CofloQuest
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top