RPGVX.net

  RPG-Maker VX => VX Skripte [Fertiger Code] => Thema gestartet von: woratana am Mai 11, 2008, 11:58:41

Titel: +[ MAP CREDIT ]+
Beitrag von: woratana am Mai 11, 2008, 11:58:41
Map Credit
Version 1.0
by Woratana
Release Date: 10/05/2008 *Prom Night~*


Introduction
Same as old XP credit script that I have no idea who is originally scripted that  :confused:

Anyway, this script has same way to setup the credit, but the different is CREDIT WILL SHOW IN MAP!!  :pinch:

Why the credit in map is better?
Because you can move event, show picture, do other thing else while credit text is scrolling. :)

And you can also decorate text in credit the way you like with tag, like <b> for bold text, or <i> for italic text.

You can set the background image you want to show when credit is scrolling too~


Features
Version 1.0
- You can use background image
- You can decorate text with special tags
- You can setup default decoration for header text (text that include <h>) and normal text
- Credit will run in map, so you can use your eventing skill to make credit scene more interesting. :)


Screenshots
(http://i25.tinypic.com/2r7pzpx.jpg)


Script
Place it above main
#===============================================================
# ? [VX] ? Map Credit ? ?
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 09/05/2008
# ? Version: 1.0
#----------------------------------------------------
# ? How to use:
# ** To start Credit, call script:
# $scene.credit.start
#
# ** To Stop and Clear Credit, call script:
# $scene.credit.terminate
#----------------------------------------------------
# ? Special Tags for Decorate Text:
# There are special tags that you can put in text to decorate that line
#
# You can also set default text decoration for all text in:
  #-------------------------------------
  # SETUP HEADER TEXT HERE
  #-------------------------------------
# for Header line (line that has tag <h>)
# &
  #-------------------------------------
  # SETUP CONTENT TEXT HERE
  #-------------------------------------
# for Normal line~
#-----------------------------------------------------
# ? >= Tag List <= ?
# * These tags will only apply to the line it is in~
# * You cannot use opposite tags in same line. (e.g. <b> and </b>)
#
# <b> :Bold Text
# </b> :No Bold Text

# <i> :Italic Text
# </i> :No Italic Text

# <center> :Align text to Center
# <left> :Align text to left
# <right> :Align text to right

# <h> :Make that line become Header line
#===========================================================================

#----------------------------------------
# Map Credit Main Script \('w' )
#----------------------------------------
class Wora_Map_Credit

  BG_Image = 'credit_bg' # Background Image file name, image must be in folder 'Picture'
  # leave '' for no background
  BG_Image_Opacity = 255 # Background Opacity (0 - 255)
  
  Text_Begin_y = 416 # Use 0 - 416: Text will start in the screen
  # Use 416+: Text will start below the screen
  
  Text_Scroll_Speed = 1 # Higher this number = Faster
  Text_Scroll_Delay = 0 # Delay between each text move (0 for no delay)
  Text_Opacity = 220 # Text Opacity
  Text_Blend_Type = 0 # 0: Normal, 1: Add, 2: Subtraction
  
  Test_Text = 'I' # Text for test height,
  # Change to taller alphabet if height is not right~

#--------------------------
# Start Credit
#--------------------------
Credit= <<_MAP_CREDIT_

<h>Story
Name Here

<h>Graphics
Name Here

<h>Mapping
Name Here

<h>Scripting
Name Here
Name Here

<h>Special Thanks
Name Here
Name Here
Name Here

_MAP_CREDIT_
#--------------------------
# End Credit
#--------------------------
  #-------------------------------------
  # SETUP HEADER TEXT HERE
  #-------------------------------------
  def header_properties(bitmap)
    bitmap.font.name = 'Tahoma' # Text Font
    bitmap.font.color = Color.new(0, 0, 255, 255) # (Red, Green, Blue, Opacity)
    bitmap.font.size = 30 # Text size
    bitmap.font.bold = true # Bold Text? (true/false)
    bitmap.font.italic = false # Italic Text? (true/false)
    bitmap.font.shadow = true # Shadowed Text? (true/false)
    @text_outline = Color.new(0,0,0) # nil for no outline, Color.new(r,g,b) for outline
    @text_align = 1 # 0: Left, 1: Center, 2: Right
  end
  
  #-------------------------------------
  # SETUP CONTENT TEXT HERE
  #-------------------------------------
  def content_properties(bitmap)
    bitmap.font.name = 'Tahoma'
    bitmap.font.color = Color.new(255, 255, 255, 255)
    bitmap.font.size = 22
    bitmap.font.bold = true
    bitmap.font.italic = false
    bitmap.font.shadow = true
    @text_outline = nil
    @text_align = 1
  end
#-----------------------------------------------------------------------
# -END- MAP CREDIT SCRIPT SETUP PART
#===========================================================================

  def initialize
    @started = false
  end
  
  # Delete credit if credit started
  def terminate
    if @started
      if @bg != nil
        @bg.bitmap.dispose
        @bg.dispose
      end
      @sprite.bitmap.dispose
      @sprite.dispose
      @started = false
    end
  end
  
  # Start Credit
  def start(text = Credit, bg = BG_Image)
    # Create Background Sprite
    if BG_Image != ''
      @bg = Sprite.new
      @bg.bitmap = Cache.picture(bg)
      @bg.opacity = BG_Image_Opacity
      @bg.z = 10000
    end
    # Create Text Sprite
    @sprite = Sprite.new
    @sprite.x = 0
    @sprite.y = 0
    @sprite.z = 10001
    @sprite.opacity = Text_Opacity
    @sprite.blend_type = Text_Blend_Type
    # Calculate Credit Height
    header_line = 0
    content_line = 0
    height = 0
    text = text.split(/\n/)
    text.each do |i|
      if i.include?('<h>'); header_line += 1
      else; content_line += 1
      end
    end
    @sprite.bitmap = Bitmap.new(1,1)
    # Test Header Properties
    header_properties(@sprite.bitmap)
    header_height = @sprite.bitmap.text_size(Test_Text).height
    height += ( header_line * ( header_height ) )
    # Test Content Properties
    content_properties(@sprite.bitmap)
    content_height = @sprite.bitmap.text_size(Test_Text).height
    height += ( content_line * ( content_height ) )
    @sprite.bitmap.dispose
    # Finished Test, Draw Text
    @sprite.bitmap = Bitmap.new(Graphics.width, Text_Begin_y + height + 32)
    content_x = 0
    content_y = Text_Begin_y
    text.each do |i|
      
      # Determine Special Tags
      if i.include?('<h>')
        i.sub!('<h>', '')
        header_properties(@sprite.bitmap)
        bitmap_height = header_height
      else
        content_properties(@sprite.bitmap)
        bitmap_height = content_height
      end
      # Bold Text
      if i.include?('<b>')
        i.sub!('<b>', ''); @sprite.font.bold = true
      elsif i.include?('</b>')
        i.sub!('</b>', ''); @sprite.font.bold = false
      end
      # Italic Text
      if i.include?('<i>')
        i.sub!('<i>', ''); @sprite.font.italic = true
      elsif i.include?('</i>')
        i.sub!('</i>', ''); @sprite.font.italic = false
      end
      # Align Text
      if i.include?('<center>')
        i.sub!('<center>', ''); @text_align = 1
      elsif i.include?('<left>')
        i.sub!('<left>', ''); @text_align = 0
      elsif i.include?('<right>')
        i.sub!('<right>', ''); @text_align = 2
      end
      if !@text_outline.nil? # Text Outline
        ori_color = @sprite.bitmap.font.color.clone
        @sprite.bitmap.font.color = @text_outline
        @sprite.bitmap.draw_text(content_x-1, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
        @sprite.bitmap.draw_text(content_x, content_y-1, @sprite.bitmap.width,
bitmap_height, i, @text_align)
        @sprite.bitmap.draw_text(content_x, content_y+1, @sprite.bitmap.width,
bitmap_height, i, @text_align)
        @sprite.bitmap.draw_text(content_x+1, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
        @sprite.bitmap.font.color = ori_color
      end
      
      # Draw Text
      @sprite.bitmap.draw_text(content_x, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
      content_y += bitmap_height
    end
    @delay = 0
    @started = true
  end
  
  # Update credit if credit started~
  def update
    if @started
      if @delay > 0
        @delay -= 1
        return
      else
        @sprite.oy += Text_Scroll_Speed
        @delay += Text_Scroll_Delay
      end
    end
  end
end

#----------------------------------------
# Plug Credit to Map >_> <_<~
#----------------------------------------
class Scene_Map < Scene_Base
  attr_reader :credit
  alias wor_mapcre_scemap_str start
  alias wor_mapcre_scemap_upd update
  alias wor_mapcre_scemap_ter terminate

  def start
    @credit = Wora_Map_Credit.new # Create Credit
    wor_mapcre_scemap_str
  end
  
  def update
    @credit.update # Update Credit
    wor_mapcre_scemap_upd
  end
  
  def terminate
    @credit.terminate # Dispose Credit
    wor_mapcre_scemap_ter
  end
end


Instruction
- Setup credit in the script

- Start credit by call script:
$scene.credit.start
- Stop and Clear credit by call script:
$scene.credit.terminate

Author's Notes
Free for use in your work if credit is included.

Please do not redistribute this script without permission. If you want to post it on any forum, please link to this topic.


Bug Report?
Please give me these informations:
Zitat
- What is it says in error window?
- When is it get error? (Right after run game, when you choose something, etc.)
- What have you changed in setting part?
- Do you have any other scripts running in your game that may crash with this script?
Titel: +[ MAP CREDIT ]+
Beitrag von: Evil95 am Mai 11, 2008, 12:10:50
Very good Script woratana. I will use it :)thx
Titel: +[ MAP CREDIT ]+
Beitrag von: $@$uk€ am Mai 11, 2008, 12:25:14
Thanks Woratana for this awesome script, but i have a question, what have i to do, if i won't a BG-Image? Because it asks me after an "credit_bg".

(i know my english is terrible^^)
Titel: +[ MAP CREDIT ]+
Beitrag von: Evil95 am Mai 11, 2008, 12:31:05
Look at Line 52. You can see this here or? BG_Image = 'credit_bg'Than Delete "credit_bg". Its look than so:
BG_Image = ''
Have fun!
Titel: +[ MAP CREDIT ]+
Beitrag von: $@$uk€ am Mai 11, 2008, 12:48:51
ok thx, hättste mir auch auf deutsch hinschreiben können^^

weiteres problem: (in english)
I can't use <b> </b> and <i> </i>
why?
Titel: +[ MAP CREDIT ]+
Beitrag von: OceanBlue am Mai 11, 2008, 12:57:29
Sry für diesen dreisten Offtopic-Post, aber 1.: $@$uk€ kann deutsch, und 2.:Euer Englisch ist wirklich schlimm XD

@Topic: Really nice script, wora, I'll probably use it in my game.
Titel: +[ MAP CREDIT ]+
Beitrag von: Razael am Mai 11, 2008, 13:05:11
@OB:
XD lass sie doch du hast dafür nen schlimme Abkürzung ;)

@Topic:
Nice Script Woratana i hope you make more of that Scripts.
;)
Titel: +[ MAP CREDIT ]+
Beitrag von: Snake am Mai 11, 2008, 13:07:26
Yay this looks great!
I hoped for this script to get ported since a few weeks ;)
thx Wora!
Titel: +[ MAP CREDIT ]+
Beitrag von: woratana am Mai 11, 2008, 20:28:21
Thanks guys! :)
I'm glad you like it.

@Evil95
Thanks for answering the question. :)

@$@$uk€
Because this script will write text 1 line in a time, not letter-by-letter,
so it cannot write bold text and not bold text in same line.

And in some languages, you will get problem when you try to write letter-by-letter. :)
Titel: +[ MAP CREDIT ]+
Beitrag von: FaG am Mai 11, 2008, 20:46:50
Oh thats nice ^^

ich werd mir das gleich mal nehmen ^^
Titel: +[ MAP CREDIT ]+
Beitrag von: $@$uk€ am Mai 12, 2008, 15:36:43
@wora:
Ok, but i can't use just <b> either... e.g. <b>Story
and why that?
Titel: +[ MAP CREDIT ]+
Beitrag von: Dainreth am Mai 12, 2008, 19:30:40
Nice, a script which allow's showing credits and running events the same time..thanks for the great work, very useful!
Titel: +[ MAP CREDIT ]+
Beitrag von: chaosBlender am Mai 16, 2008, 00:38:05
Oh! That could be useful!
Maybe I'm gonna implement it in my project. Thanks woratana and keep up yer good work, will ya? ^^
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: Giga_t0ni am Juli 10, 2008, 02:23:08
bei mir kommt ??????? NoMethodError ??????????
                      undefined method `credits' for # <scene_map:0x16c8d68>
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: PD am Juli 10, 2008, 03:13:01
bei mir gehts irgendwie net....
kommt immer syntax error....
kann mir mal jemand schritt für schritt erkläre wie man des in nem event einstelle muss?
büdde :)
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: Giga_t0ni am Juli 10, 2008, 05:15:38
gäh ich hab auch probs und immer des mit dem faq dieses faq gibts gar ned!!!:'(:'(:'(
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: PD am Juli 10, 2008, 06:32:02
was steht bei dir mit faq?
also bei mir kam nur syntax erreor sobald des event gestartet wurd, dass die credits abspiele soll....
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: ERZENGEL am Juli 10, 2008, 11:51:31
@Giga_t0ni:
Es heißt credit nicht credits, deswegen gibt's nen NoMethodError. Und könntest du noch bitte erklären, was du mit faq meinst?

@Nocturn:
Per Strg+C kopierst du den Inhalt des Fensters, dass den Fehler anzeigt. Füg ihn mal hier rein, so dass woratana eine möglichen Fehler leichter beheben kann. Oder du machst nen Screenshot.
Und überprüf mal, ob du den Aufruf auch genauso geschrieben hast wie woratana.
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: PD am Juli 10, 2008, 12:14:58
n screenshot würd net viel bringe da ich die japanische maker version hab un da bis auf syntax error nur ????? stehe lol
un was meinstn mit aufruf?
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: ERZENGEL am Juli 10, 2008, 12:18:52
Achso okay ^^ und mit Aufruf mein ich das was woratana bei Instructions in den Codeframes stehen hat (Call = engl. für Aufruf). Teste es am besten mit dem Originalskript, da es selbst bei mir vorkommt, dass ich was veränder und nicht mehr weiß was und den Fehler erst aufgrund des Originals behebe =)
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: PD am Juli 10, 2008, 12:44:27
der syntax error is weg :)
aber credits komme trotzdem keine lol
also des bild ( was man sich ja selbst ausuchen kann) kommt, aber die schrift ( credits) fehlt....
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: Kasaar am Juli 13, 2008, 19:12:43
Very nice script Woratana.
I'm sure I'll need it when my project is finished.I think i will use it then...
Thanks for it :)
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: Cryptodrache am Januar 28, 2009, 20:56:59
Wirklich großartiges Skript!

Ich hab nur eine Frage:
Ich arbeite gerade an meinem allerersten Projekt und habe vorher noch nie mit Skripts oder generell einem RPG-Maker gearbeitet!
Was ich fragen wollte war: Wo ist dieses Call script kommand?
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: RPGSasuke am Februar 12, 2009, 02:36:48
ALSO ich mach euch mal das Tutorial auf DEUTSCH :

1. Skript kopieren.

2.im RPG Maker Script Editor aufrufen(oben).

3.Linkes fenster nach unten Scrollen und ''Main Process'' finden.

4. Auf ''Main'' mit linker maustaste drücken und dann auf ''Insert''

5.Dann erscheint ein Feld zwischen Main Process und Main.

6.Da drauf klicken und dann auf das leere Textfeld.

7.STRG+V drücken und das Skript ist da.

8.Etwas nach unten scrollen bis ihr das seht:

(http://i42.tinypic.com/2w38310.jpg)

Wie ihr sehen könnt,hab ich im Vergleich zu eurer Version ein Paar Sachen dazugetan. Das könnt ihr auch machen.

9. Name Here mit euren Sachen ersetzen

10.Bei Event auf die dritte Seite gehen und unten bei Advanced seht ihr das 'Script...' event. Da drauf und dann das eingeben:

$scene.credit.start
11.fertig,auf OK drücken und fertig. genießt eure Credits am Ende des Spiels.


Ich habe aber trotzdem selber einen Fehler:

Sobald ich im Laufe der Credits die Leertaste drücke,stoppt es und es fängt von neu an. Aber nicht nur das. Das erste bleibt stehen und das zweite kommt. Wenn ich also 100 Mal auf die Leertaste drücke,kann ich nichts mehr sehen.
Titel: Re: +[ MAP CREDIT ]+
Beitrag von: Ðeity am Februar 12, 2009, 15:27:21
@Cryptodrache
Ich hoffe ich habe es richtig verstanden, wenn ja dann musst du die 3te Seite beim editieren eines Events aussuchen und dort ist der Befhel der unterste in der linken Leiste.

MfG
Deity
SimplePortal 2.3.3 © 2008-2010, SimplePortal