collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Hilfe zu Skripten.  (Gelesen 51381 mal)

Offline Sk!p

  • Foren-ReArchitekt
  • VX-Großmeister
  • *****
  • Beiträge: 975
  • Mit(t)arbeiter schreibt man mit einem T =P
    • Foren-ReArchitekt
Re: Hilfe zu Skripten.
« Antwort #75 am: Februar 03, 2009, 23:06:05 »
Aber sicher kann das jemand tun. Guckst du hier.

<a href="http://www.mediafire.com/?mnt3ii0zojd">Klick Mich</a>

@ Woratana
I Hope Its Okay For U, That I Give Him Ur Great Script This
Way. Die Link To Your File Is Down, So Nobody Can Use It ;)

Sk!p
« Letzte Änderung: Februar 03, 2009, 23:15:58 von Sk!p »

Klischee Antagonist! | Back From Hell To Conquer The World!


Re: Hilfe zu Skripten.

Offline Kasaar

  • Epic Scripter !!
  • Eventmeister
  • ***
  • Beiträge: 305
  • Satanistischer Misantroph... noch Fragen? ]:)
Re: Hilfe zu Skripten.
« Antwort #76 am: Februar 09, 2009, 21:33:14 »
Hey Leute weiß jmd wie man per Script die Actorgrafiken ändert? is wichtig das per script zu machen... also bitte keine bemerkungen "machs doch per event" ;)
Besucht mich auf


Und gebt Kommentare im Blog =)

Re: Hilfe zu Skripten.

Offline Im Not Jesus

  • Eventmeister
  • ***
  • Beiträge: 384
  • Still not Jesus.
Re: Hilfe zu Skripten.
« Antwort #77 am: Februar 10, 2009, 12:35:52 »
hey leute =]

hab da ne kleine frage zu Deadlydans Titel:
und zwar ist das am Titelbildschirm alles n wenig zu weit oben und ich find irgenwdie nich genau heraus,
wie man das tiefer setzen könnte! Wäre nett wenn mir das jemand zeigen/erklären könnte! ^.^

Re: Hilfe zu Skripten.

Offline Prince

  • Eventmeister
  • ***
  • Beiträge: 354
Re: Hilfe zu Skripten.
« Antwort #78 am: Februar 12, 2009, 20:23:25 »
Hallo allerseits,

Also ich habe eine Frage zum "Actor Profile Information"-Script. Dieses Skript dient dazu, dass wenn man im Status-Menü eines Charakters
"Enter" drücken kann und dann in ein Menü mit zusätzlichen Informationen über den Actor kommt.

Actor Profile Information-Script:
Spoiler for Hiden:
#===============================================================
# ?         Actor Profile Information - CC_ExtendedActorInfo            ? VX ?
# ?                     Version 1.0.0 by Claimh                              ?
# ?                   Translation by Mr. Anonymous                           ?
#------------------------------------------------------------------------------
#  This script adds a character profile screen for extended actor information.
#   This screen is called from the status screen by pressing the "C" button
#   (by default). This information displayed on this screen is customized in
#   this script itself below (in the Customization block).
#==============================================================================
module Chara_Review
#==============================================================================#
#                             ? Customization ?                                #
#==============================================================================#
  # If you have more than 8 actors in your game, you may add additional lines
  #  to each of these fields.
#----------------------------------------------------------------------------
#   Call Screen Input Key
#----------------------------------------------------------------------------
  # This allows you to change the button/key pressed to call the extended
  #  actor information screen from the status screen. (Default: C)
  CHENGE_KEY = Input::C
  #--------------------------------------------------------------------------
  # ? Customize Age
  #--------------------------------------------------------------------------
  CHARA_AGE = {
   # Age is the first field to the right of the profile image.
   # ActorID => "Age"
     5 => "20",
     6 => "22",
     7 => "24",
     8 => "16"
  }
  #--------------------------------------------------------------------------
  # ? Customize Actor's Origin
  #--------------------------------------------------------------------------
  CHARA_FROM = {
   # "From" or Origin is the second field to the right of the profile image.
   # ActorID => "Place"
     5 => "Rei",
     6 => "Tsuin",
     7 => "Tsuin",
     8 => "Kouin"
  }
  #--------------------------------------------------------------------------
  # ? Customize Height
  #--------------------------------------------------------------------------
  CHARA_H = {
   # Height is the third field to the right of the profile image.
   # ActorID => "Height"
     5 => "5 Feet 8 Inches",
     6 => "4 Feet 9 Inches",
     7 => "5 Feet 1 Inch",
     8 => "5 Feet 4 Inches"
  }
  #--------------------------------------------------------------------------
  # ? Customize Weight
  #--------------------------------------------------------------------------
  CHARA_W = {
   # Weight is the fourth field to the right of the profile image.
   # ActorID => "Weight"
     5 => "125 Pounds",
     6 => "87 Pounds",
     7 => "93 Pounds",
     8 => "96 Pounds"
  }
  #--------------------------------------------------------------------------
  # ? Customize Profile Information
  #--------------------------------------------------------------------------
  CHARA_INFO = {
    # Profile Information is displayed beneath the actor's graphic file.
    # ActorID => "Information Text"
    5 => "Ryoku, is a brave strong warrior who always needs to save Kione. He is
    a man with great holy powers. In time portals he gets his Jikoku Sword with slots
    for the Jikoku Crystals to fit into. All the girls love Ryoku, for no real reason.",
    6 => "No one knows much about him, but he knows alot about them. Because
    of his weight and size he is able to move swiftly, but is also deadly with his
    hands. He seems to have a connection with Munaca, only talking to and helping her.",
    7 => "Munaca, is a some what shy girl with wind powers. She seems to know
    the mystery guy, she is confused about him and wants to know what goes on in
    his head. Her wind powers also get stronger when the people are in danger.",
    8 => "Kione, is a girl with the ability to manipulate water, she also loves
    the mystery guy who doesn`t even care about her. She is able to heal people,
    but isn`t very strong. She always near the mystery guy... Why does she bother."
  }
  #--------------------------------------------------------------------------
  # ? Customize Face/Profile Image
  #--------------------------------------------------------------------------
  # Image Type Toggle
  #  This toggle allows to use either the default Face graphic that is set up
  #   in the Actor tab in the database, or a custom image of your choosing.
  #  true = Custom images are used.
  #  false = The actor's face graphic is used.
  BSTUP = false
  # Custom Profile Graphics ("Graphics/Face" directory)(If BSTUP = true)
  BSTUP_FILE = {
    # ActorID => "Profile Image" (Without image format extension)
    #  You may also add more images for actors after the fourth line, if needed.
    5 => "actor1",
    6 => "actor1",
    7 => "actor1",
    8 => "actor1"
  }

#----------------------------------------------------------------------------
#   END Customization
#----------------------------------------------------------------------------
end
#==============================================================================
# ? Window_Charactor
#------------------------------------------------------------------------------
# ? Define Window
#==============================================================================
class Window_Charactor < Window_Base
  #--------------------------------------------------------------------------
  # ? Initialize Profile Window
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 544, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh(actor)
  end
  #--------------------------------------------------------------------------
  # ? Determine BSTUP Type
  #--------------------------------------------------------------------------
  def refresh(actor)
    self.contents.clear
    return if actor.nil?
    if Chara_Review::BSTUP
      refresh_bstup(actor)  # If BSTUP = true
    else
      refresh_face(actor)   # If BSTUP = false
    end
  end
  #--------------------------------------------------------------------------
  # ? Draw Parameters and Profile Image (BSTUP)
  #--------------------------------------------------------------------------
  def refresh_bstup(actor)
    draw_face_picture(Chara_Review::BSTUP_FILE[actor.id], 0, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(280, 30, 80, WLH, "Name:")
    self.contents.draw_text(280, 60, 80, WLH, "Age:")
    self.contents.draw_text(280, 90, 80, WLH, "From:")
    self.contents.draw_text(280, 120, 80, WLH, "Height:")
    self.contents.draw_text(280, 150, 80, WLH, "Weight:")
    self.contents.font.color = normal_color
    draw_actor_name(actor, 380,  30)
    self.contents.draw_text(380, 60, 80, WLH, Chara_Review::CHARA_AGE[actor.id])
    self.contents.draw_text(380, 90, 180, WLH, Chara_Review::CHARA_FROM[actor.id])
    self.contents.draw_text(380, 120 , 200, WLH, Chara_Review::CHARA_H[actor.id])
    self.contents.draw_text(380, 150, 250, WLH, Chara_Review::CHARA_W[actor.id])
    draw_enter_text(20, 300, 500, WLH, Chara_Review::CHARA_INFO[actor.id])
  end
  #--------------------------------------------------------------------------
  # ? Draw Parameters and Profile Image (FACE)
  #--------------------------------------------------------------------------
  def refresh_face(actor)
    draw_actor_face(actor, 8, 32)
    self.contents.font.color = system_color
    self.contents.draw_text(200, 30, 80, WLH, "")
    self.contents.draw_text(200, 60, 80, WLH, "Age:")
    self.contents.draw_text(200, 90, 80, WLH, "From:")
    self.contents.draw_text(200, 120, 80, WLH, "Height:")
    self.contents.draw_text(200, 150, 80, WLH, "Weight:")
    self.contents.font.color = normal_color
    draw_actor_name(actor, 300,  30)
    self.contents.draw_text(300, 60, 80, WLH, Chara_Review::CHARA_AGE[actor.id])
    self.contents.draw_text(300, 90, 180, WLH, Chara_Review::CHARA_FROM[actor.id])
    self.contents.draw_text(300, 120 , 200, WLH, Chara_Review::CHARA_H[actor.id])
    self.contents.draw_text(300, 150, 250, WLH, Chara_Review::CHARA_W[actor.id])
    draw_enter_text(20, 200, 500, WLH, Chara_Review::CHARA_INFO[actor.id])
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? Draw Entered Text
  #--------------------------------------------------------------------------
  def draw_enter_text(x, y, width, height, text)
    info_box = text.split(/\n/)
    for i in 0...info_box.size
      self.contents.draw_text( x, y+i*WLH, width, WLH, info_box)
      break if (y+i*WLH) > (self.height-WLH)
    end
  end
  #--------------------------------------------------------------------------
  # ? Draw Face Graphic(Graphics/Face)
  #--------------------------------------------------------------------------
  def draw_face_picture(file_name, x, y)
    bitmap = Cache.face(file_name)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y, bitmap, src_rect)
  end
end


#==============================================================================
# ? Scene_Charactor
#------------------------------------------------------------------------------
# ? Define Methods
#==============================================================================
class Scene_Charactor < Scene_Base
  #--------------------------------------------------------------------------
  # ? Initialize Actor
  #     actor_index : Actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # ? Create Menu Background
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @status_window = Window_Charactor.new(@actor)
  end
  #--------------------------------------------------------------------------
  # ? Dispose Status Window
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ? Return Scene
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Status.new(@actor_index)
  end
  #--------------------------------------------------------------------------
  # ? Next Actor
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Charactor.new(@actor_index)
  end
  #--------------------------------------------------------------------------
  # ? Previous Actor
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Charactor.new(@actor_index)
  end
  #--------------------------------------------------------------------------
  # ? Actor Profile Screne Inputs
  #--------------------------------------------------------------------------
  def update
    update_menu_background
    @status_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
    super
  end
end


#==============================================================================
# ? Scene_Status
#==============================================================================
class Scene_Status
  #--------------------------------------------------------------------------
  # ? Update Actor
  #--------------------------------------------------------------------------
  alias update_chara update
  def update
    if Input.trigger?(Chara_Review::CHENGE_KEY)
      Sound.play_decision
      $scene = Scene_Charactor.new(@actor_index)
    end
    update_chara
  end
end

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  The original untranslated version of this script can be found here:
#http://www4.plala.or.jp/findias/codecrush/material/rgss2/menu/1-menu_chara/menu_char_top.htmll
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_


Also wie man sieht kann man hier bestimmte Informationen über die Actor eingeben, wie zum Beispiel Herkunft, Alter usw.
Ich wollte in mein Spiel einfügen, dass die Werte wie zum Beispiel "Alter" in einer game_variable gespeichert werden und dass
man diese dann im Spiel über Änderung einer Variable im Spiel verändern kann. Also wenn ich zum Beispiel Variable "alter1" im
Spiel auf 20 setze wird es in dem Menü dann das Alter auch als 20 angezeigt.

Das Skript scheint nicht sehr kompliziert zu sein, aber da ich selbst nicht wirklicht gut Skripten kann, würde ich mich echt freuen,
wenn mir da jemand eine Lösung finden könnte.


Ich möcht das Skript auch verwenden, aber wenn ich das SPiel starte steht was von Fehler in Line 259 Syntax Error occured oda so. HELP
Sei so wie du bist und nicht wie die anderen dich wollen.
FF X Blitzballrekord:
Spoiler for Hiden:

Re: Hilfe zu Skripten.

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Hilfe zu Skripten.
« Antwort #79 am: Februar 12, 2009, 22:26:24 »
@Im not jesus
In Zeile 158 findest du diesen Ausschnitt:
Spoiler for Hiden:
@menu_item[1].blend_type = 0
    @menu_item[1].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_CONTINUE[0] )
    @menu_item[1].x = ( ( Graphics.width / 2 ) - ( @menu_item[1].bitmap.width / 2 ) )
    @menu_item[1].y = ( ( Graphics.height / 2 ) - ( @menu_item[1].bitmap.height / 2 ) )
   
    @menu_item[0].blend_type = 0
    @menu_item[0].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_NEW[0] )
    @menu_item[0].x = ( ( Graphics.width / 2 ) - ( @menu_item[0].bitmap.width / 2 ) )
    @menu_item[0].y = ( ( Graphics.height / 2 ) - ( @menu_item[0].bitmap.height / 2 )  ) - ( @menu_item[1].bitmap.height + padding )
   
    @menu_item[2].blend_type = 0
    @menu_item[2].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_QUIT[0] )
    @menu_item[2].x = ( ( Graphics.width / 2 ) - ( @menu_item[2].bitmap.width / 2 ) )
    @menu_item[2].y = ( ( Graphics.height / 2 ) - ( @menu_item[2].bitmap.height / 2 ) ) + ( @menu_item[1].bitmap.height + padding )

Furch das veränderen der y Koordinate kannst du, die Bilder tiefer beziehungsweise höher stellen. Und die x Koordinate bestimmt die Horizontale Position. Ich hab hie rein kleines Beispiel gemacht und die Bilder tiefergelegt.
Spoiler for Hiden:
   @menu_item[1].blend_type = 0
    @menu_item[1].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_CONTINUE[0] )
    @menu_item[1].x = ( ( Graphics.width / 2 ) - ( @menu_item[1].bitmap.width / 2 ) )
    @menu_item[1].y = ( 330 )
   
    @menu_item[0].blend_type = 0
    @menu_item[0].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_NEW[0] )
    @menu_item[0].x = ( ( Graphics.width / 2 ) - ( @menu_item[0].bitmap.width / 2 ) )
    @menu_item[0].y = (300 )
   
    @menu_item[2].blend_type = 0
    @menu_item[2].bitmap = Cache.system ( DeadlyDan_Title::IMAGE_QUIT[0] )
    @menu_item[2].x = ( ( Graphics.width / 2 ) - ( @menu_item[2].bitmap.width / 2 ) )
    @menu_item[2].y = (360)
Wenn du es selber veränderst achte darauf, dass Dan die Bilder anders angeordnet hat also nicht wie man in den Spoiler sehen kann sondern, 0,1,2.

MfG

Deity



Re: Hilfe zu Skripten.

RPGSasuke

  • Gast
Re: Hilfe zu Skripten.
« Antwort #80 am: Februar 16, 2009, 23:54:14 »
Also mein Problem handelt von BGMs. Ich möchte gerne bewirken,dass wenn ich (nur einige) BGMs abspiele,sie dann erst nach dem Ende weitere Events durchlassen und der Spieler auch sich bei dem Ablauf der Musik sich nicht bewegen kann. Dies soll aber, wie es schon in den Klammern stand, nich für ALLE BGMs gelten sondern nur die,die so sein müssen, also die die nicht, normal starten und die,die ich mit dem Skript brauche,dann mit dem Skriptevent. Ich weiß nicht,ob es so ein Skript schon gibt, aber sowas kann ich selber leider nicht vollbringen, da ich 0 Ahnung von Ruby und besonders dem Ruby Game Scripting System hab. Warum ich das brauche? Hier ist ein Beispiel:
Jemand spielt Klavier vor ein paar Leuten und sie sollen zuhören bis da halt das Stück zu Ende ist.

Es gibt natürlich eine Eventmöglichkeit: Ich rechne die ganze Länge in Frames um. Dann benutze ich den Wait-Befehl im Move Route-Event. Aber das Maximale ist 999 Frames. Deswegen rechne ich so,dass ich immer 999 Frames dazu rechne, bis der Rest kommt?????? Das ist mir zu aufwendig,da in meinem Spiel dies öfters wohl passieren wird deswegen möchte ich es als einfaches Skript haben, da ich mir sonst den Kopf zerbrechen würde.

Mfg RPGSasuke

Re: Hilfe zu Skripten.

Offline Kasaar

  • Epic Scripter !!
  • Eventmeister
  • ***
  • Beiträge: 305
  • Satanistischer Misantroph... noch Fragen? ]:)
Re: Hilfe zu Skripten.
« Antwort #81 am: Februar 19, 2009, 18:32:33 »
Du kannst auch mehrere Wait-events reinstellen ;) also z.b 3 mal wait(999frames)
Besucht mich auf


Und gebt Kommentare im Blog =)

Re: Hilfe zu Skripten.

Offline Seph

  • bLUbb?
  • Mr. MACK-Tile
  • ***
  • Beiträge: 224
Re: Hilfe zu Skripten.
« Antwort #82 am: Februar 20, 2009, 16:34:46 »
So ich wollt bei meinem Menü das Speichern ausblenden und der Post auf Seite 1 hat mir nicht viel gebracht da ich ein anderes Menü hab und es bei dem nich geklappt hat. Vllt bin ich ja nur zu dumm aber wär nett wenn mir jemand hilft.

Spoiler for Hiden:
=begin                 
                          BigEd781' Final Fantasy IX Menu
            Credit to PainHurt at rpgmakervx.net for most of the graphics
=end

module FF9_Config 
   
  # set this to 'true' if you would like to use a cusotm background image
  USE_CUSTOM_BACK = true
  # the name of the custom background image, without the file extension (no .png)
  BACK_NAME = 'StoneBackground'
  # if you set this to 'true', you must be using the enhanced
  # Window class script that I posted:  You can get that script here:
  # http://www.rpgmakervx.net/index.php?showtopic=8042&hl=
  # this will make the provided FF9 windowskin look really good.
  USE_TILED_WINDOW = false
 
  # When this is set to 'true', the menu cirsor will animate back and forth.
  # When set to 'false', it will stay in place
  ANIMATE_CURSOR = true
 
  # When set to 'true', four background panels are always drawn.
  # When set to 'false', a panel is only drawn for each party member
  DRAW_FOR_ALL = true
 
  # the name of the font used in the menu. 
  # use 'Font.default_name' for the default font.  Try 'Centaur' for a nice, smaller font.
  DEFAULT_FONT = Font.default_name
 
  # set this to true to enable the font above for all windows.
  # also sets the back_opacity to 255 for all windows. 
  # I recommend setting this to 'true' to maintain a consistent look.
  USE_FOR_ALL = true
 
  # the icon id for your gold window portion of the menu, 194 by default.
  GOLD_ICON_ID = 194
 
end

if FF9_Config::USE_FOR_ALL   
 
  Font.default_name = FF9_Config::DEFAULT_FONT
 
  class Window_Base < Window
   
    alias :eds_pre_ff9_menu_base_initialize :initialize
    def initialize(*args)
      eds_pre_ff9_menu_base_initialize(*args) 
      self.stretch = false if FF9_Config::USE_TILED_WINDOW
      self.back_opacity = 255
    end
   
  end
 
end

class Window_Base < Window
 
  CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228)
  CAPTION_HEIGHT = 12
  X_OFFSET = 16
  Y_OFFSET = -5
 
  alias :eds_pre_window_caption_intialize :initialize
  def initialize(*args)     
    eds_pre_window_caption_intialize(*args)   
    @caption_sprite = Sprite_Base.new(self.viewport)
    create_caption_bitmap(1, CAPTION_HEIGHT)       
    @caption_sprite.x = self.x + X_OFFSET
    @caption_sprite.y = self.y + Y_OFFSET
    @caption_sprite.z = self.z + 1
  end
 
  def x=(value)
    super
    @caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil?
  end
 
  def y=(value)
    super
    @caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil?
  end
 
  def z=(value)
    super
    @caption_sprite.z = value + 1 unless @caption_sprite.nil?
  end
 
  def caption=(text)
    return unless text.is_a?(String)
    return if text.empty?
    @caption = text
    width = @caption_sprite.bitmap.text_size(@caption).width
    create_caption_bitmap(width, CAPTION_HEIGHT)   
    draw_caption
  end 
 
  def create_caption_bitmap(w, h)
    @caption_sprite.bitmap = Bitmap.new(w, h)   
    @caption_sprite.bitmap.font.size = 12
    @caption_sprite.bitmap.font.color = CAPTION_COLOR
    @caption_sprite.bitmap.font.bold = true 
  end
 
  def draw_caption
    unless @caption.nil?
      h = @caption_sprite.bitmap.height
      w = @caption_sprite.bitmap.width
      rect = Rect.new( 0, h / 2, w, h / 4 )
      @caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96))     
      @caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption)     
    end
  end
 
  alias :eds_pre_caption_window_dispose :dispose
  def dispose
    eds_pre_caption_window_dispose
    @caption_sprite.dispose
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 32
  end   
 
end

class Window_TimeGold < Window_Base 
   
  def initialize(x, y) 
    width = find_window_width("9999999")
    width = 140 if width < 140
    super(x, y, width, WLH + 58)   
    self.back_opacity = 255
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.caption = "TIME & #{Vocab.gold}"
    @time_icon = Cache.picture('Timer') 
    @intern_frame_count = 0
    refresh
  end
 
  def draw_time
    sec = (Graphics.frame_count / 60) % 60
    min = (Graphics.frame_count / 3600) % 60
    hrs = Graphics.frame_count / 216000   
    self.contents.font.color = Color.new(255, 255, 255)   
    time = "%02d:%02d:%02d" % [hrs, min, sec]
    self.contents.draw_text(0, 0, self.contents.width, WLH, time, 2)   
  end 
 
  def refresh
    self.contents.clear
    self.contents.blt(0, 0, @time_icon, @time_icon.rect)
    draw_icon(FF9_Config::GOLD_ICON_ID, 2, WLH) 
    draw_currency_value($game_party.gold, 0, WLH, self.contents.width)
    draw_time
  end
 
  def draw_currency_value(value, x, y, width)
    gold_text = Vocab.gold
    cx = contents.text_size(gold_text[0,1]).width
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2)
    self.contents.font.color = system_color
    # just print the first character of Vocab::gold
    self.contents.draw_text(x, y, width, WLH, gold_text[0,1], 2)
  end
 
  def update
    super
    @intern_frame_count += 1
    return if (@intern_frame_count % 60) != 0         
    refresh
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 80
  end
 
end

class Window_MenuLocation < Window_Base
 
  def initialize(x, y)
    @map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
    width = find_window_width(@map_name)
    super(x, y, width, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.back_opacity = 255
    self.caption = "LOCATION"
    refresh
  end
 
  def refresh
    self.contents.clear   
    self.contents.draw_text(0, 0, self.contents.width, WLH,  @map_name, 1)
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 48
  end
 
end

class Window_Command < Window_Selectable
 
  alias :eds_pre_ff9_menu_win_command_init :initialize
  def initialize(*args)
    @font_name = Font.default_name   
    eds_pre_ff9_menu_win_command_init(*args)   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear   
    self.contents.font.name = @font_name
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def font_name=(name)
    @font_name = name   
  end
 
end

class Window_Uses < Window_Base 
 
  def initialize(right, y, item)   
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"
    w = 160
    x = right ? (544 - w) : 0   
    super(x, y, w, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def item=(item)   
    return unless item.is_a?(RPG::Item)
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"     
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_SkillUses < Window_Base 
 
  def initialize(right, y, actor, skill)   
    @remaining_text = make_info_string(actor, skill)
    w = 182
    x = right ? (544 - w) : 0       
    super(x, y, w, WLH + 32) 
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def make_info_string(actor, skill)
    return if actor.nil? || skill.nil?
    cost = actor.calc_mp_cost(skill)
    return "Unlimited" if cost < 1
    return "Remaining: #{actor.mp / cost}"
  end
 
  def set_skill(actor, skill)
    return if actor.nil? || skill.nil?
    return unless skill.is_a?(RPG::Skill)
    @remaining_text = make_info_string(actor, skill)   
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh   
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_MenuStatus < Window_Selectable
   
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 452, 352)     
    @bg_image = Cache.picture('FF9_MenuBar') 
    @arrow_image = Cache.picture('Pointer')
    create_arrow_sprites
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.opacity = 0   
    self.z = 99       
    self.active = false
    self.index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # * create_arrow_sprites
  #--------------------------------------------------------------------------
  def create_arrow_sprites 
    @arrow_sprites = []
    for i in 0..3
      @arrow_sprites << Sprite.new
      @arrow_sprites[i].bitmap = Bitmap.new(@arrow_image.width + 7, @arrow_image.height)
      @arrow_sprites[i].x = self.x
      @arrow_sprites[i].y = (i * 80) + self.y + 40     
      @arrow_sprites[i].z = 999       
    end
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    draw_background_windows if FF9_Config::DRAW_FOR_ALL
    for actor in $game_party.members
      x = 104
      y = actor.index * 80     
      y_offset = 6     
      draw_background_window(0, y) unless FF9_Config::DRAW_FOR_ALL
      draw_actor_face(actor, 19, y + 4, 73)
      draw_actor_name(actor, x, y + y_offset)
      draw_actor_class(actor, x + 125, y + y_offset) if actor.states.empty?
      draw_actor_level(actor, x, y + WLH * 1)     
      draw_actor_state(actor, x + 125, y + y_offset)
      draw_actor_hp(actor, x, ((y) + (WLH * 2) - 5))
      draw_actor_mp(actor, x + 125, ((y) + (WLH * 2) - 5))
    end
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def update_cursor             
    if @index < 0             
      #refactor into update arrow method
      @arrow_sprites.each { |sprite| sprite.bitmap.clear }
      return
    end
    @intern_frame_count += 1
    return unless (@intern_frame_count % 5) == 0
    if @sprite_last_draw_x >= 7     
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x <= 0
      @sprite_inc_x = 1
    end
    update_arrow_sprites
  end
  #--------------------------------------------------------------------------
  # * update_arrow_sprites
  #--------------------------------------------------------------------------
  def update_arrow_sprites   
    @arrow_sprites.each { |sprite| sprite.bitmap.clear }   
    if @index == 99   # all selected       
      return unless (@intern_frame_count % 10) == 0
      draw_arrow_sprites(@arrow_sprites, false)     
    else
      draw_arrow_sprites([@arrow_sprites[@index]], FF9_Config::ANIMATE_CURSOR)     
    end
  end
  #--------------------------------------------------------------------------
  # * draw_arrow_sprites
  #--------------------------------------------------------------------------
  def draw_arrow_sprites(sprites, animated=true)
    for sprite in sprites         
      image_x = animated ? @sprite_last_draw_x + @sprite_inc_x : 0
      @sprite_last_draw_x = image_x           
      sprite.bitmap.blt(image_x, 0, @arrow_image, @arrow_image.rect)
    end
  end
  #--------------------------------------------------------------------------
  # * y=
  #--------------------------------------------------------------------------
  def y=(value)
    super
    unless @arrow_sprites.nil?
      for i in 0..3
        @arrow_sprites[i].y = (i * 80) + value + 40
      end
    end
  end
  #--------------------------------------------------------------------------
  # * x=
  #--------------------------------------------------------------------------
  def x=(value)
    super
    unless @arrow_sprites.nil?
      @arrow_sprites.each { |sprite| sprite.x = value }
    end
  end
  #--------------------------------------------------------------------------
  # * draw_background_windows
  #--------------------------------------------------------------------------
  def draw_background_windows 
    self.contents.blt(0, 0, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 80, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 160, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 240, @bg_image, @bg_image.rect)   
  end 
  #--------------------------------------------------------------------------
  # * draw_background_window (single)
  #--------------------------------------------------------------------------
  def draw_background_window(x, y)
    self.contents.blt(x, y, @bg_image, @bg_image.rect)   
  end
  #--------------------------------------------------------------------------
  # * visible
  #--------------------------------------------------------------------------
  def visible=(value)
    super
    @arrow_sprites.each { |sprite| sprite.visible = value }
  end
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_win_stat_dispose :dispose
  def dispose
    eds_pre_ff9_win_stat_dispose
    @arrow_sprites.each { |sprite| sprite.dispose }
  end
 
  def enable_cursor?(rect=nil)
    # for compatibility with the improved command window
    return false
  end   
 
end

class Scene_Menu
     
  #--------------------------------------------------------------------------
  # * create_menu_background (only if USE_CUSTOM_BACK == true)
  #--------------------------------------------------------------------------
  if FF9_Config::USE_CUSTOM_BACK
   
    def create_menu_background
      @menuback_sprite = Sprite.new
      @menuback_sprite.bitmap = Cache.picture(FF9_Config::BACK_NAME)
      @menuback_sprite.color.set(16, 16, 16, 128)
      update_menu_background
    end
   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------   
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    # just changed the width of the window here
    @command_window = Window_Command.new(132, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.stretch = false if FF9_Config::USE_TILED_WINDOW
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, true)     # Disable save
    end     
    # new stuff here   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255
  end
  #--------------------------------------------------------------------------
  # * This method is intended to fix some compatibility problems
  #   that scripts run into when they change the command window
  #   in some way.  So, we let them override "create_command_window"
  #   and we simply don't call it from the "start" method.
  #   Instead, we call this method which does some extra checking.
  #--------------------------------------------------------------------------
  def eds_create_command_window
    create_command_window
    old_commands = @command_window.commands
    return if old_commands == [ Vocab::item,
                                Vocab::skill,
                                Vocab::equip,
                                Vocab::status,
                                Vocab::save,
                                Vocab::game_end ]

    # so we know that the default command window is not being used
    # we don't want to create another window, so we manually resize it
    # before the player can see. 
    long = ''
    # dynamically size the width based on the longest command
    old_commands.each { |command| long = command if command.length > long.length }
    # set the index to -1 so that the rectangle disappears.
    # if we don't do this, you can see the selection rectangle resize.
    @command_window.index = -1
    @command_window.width = @command_window.contents.text_size(long).width + 42
    @command_window.contents = Bitmap.new( @command_window.width - 32,
                                           @command_window.height - 32 )   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255       
    @command_window.refresh
    @command_window.index = @menu_index
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    #call this method for compatibility
    eds_create_command_window
    @gold_window = Window_TimeGold.new(372, 342)
    @gold_window.y -= @gold_window.height
    @gold_window.x = 528 - @gold_window.width
    @status_window = Window_MenuStatus.new(0, 12)
    @location_window = Window_MenuLocation.new(0, 0)
    @location_window.x = 528 - @location_window.width 
    @location_window.y = 398 - @location_window.height
  end
 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_menu_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_menu_terminate
    @location_window.dispose
  end
 
end

class Scene_Item < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_start :start
  def start       
    eds_pre_ff9_menu_scene_item_start
    @target_window.y = 58   
    @uses_window = Window_Uses.new(true, @help_window.height, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_win_stat_show_target_window :show_target_window
  def show_target_window(right) 
    @uses_window.item = @item_window.item
    @uses_window.visible = true   
    @item_window.visible = false   
    @item_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_item_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @item_window.visible = true       
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_item_determine_target
    @uses_window.item = @item_window.item
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

class Scene_Skill < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_start :start
  def start       
    eds_pre_ff9_menu_scene_skill_start
    @target_window.y = 58         
    @uses_window = Window_SkillUses.new(true, @help_window.height, nil, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  def show_target_window(right)
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
    @uses_window.visible = true
    @status_window.visible = false
    @skill_window.visible = false
    @skill_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_skill_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @skill_window.visible = true
    @status_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_skill_determine_target
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

Re: Hilfe zu Skripten.

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Hilfe zu Skripten.
« Antwort #83 am: Februar 20, 2009, 20:01:45 »
@Seph
Ich glaube das müsste gehen, da es bei mir funktioniert hat :)

Spoiler for Hiden:
=begin                 
                          BigEd781' Final Fantasy IX Menu
            Credit to PainHurt at rpgmakervx.net for most of the graphics
=end

module FF9_Config 
   
  # set this to 'true' if you would like to use a cusotm background image
  USE_CUSTOM_BACK = true
  # the name of the custom background image, without the file extension (no .png)
  BACK_NAME = 'StoneBackground'
  # if you set this to 'true', you must be using the enhanced
  # Window class script that I posted:  You can get that script here:
  # http://www.rpgmakervx.net/index.php?showtopic=8042&hl=
  # this will make the provided FF9 windowskin look really good.
  USE_TILED_WINDOW = false
 
  # When this is set to 'true', the menu cirsor will animate back and forth.
  # When set to 'false', it will stay in place
  ANIMATE_CURSOR = true
 
  # When set to 'true', four background panels are always drawn.
  # When set to 'false', a panel is only drawn for each party member
  DRAW_FOR_ALL = true
 
  # the name of the font used in the menu. 
  # use 'Font.default_name' for the default font.  Try 'Centaur' for a nice, smaller font.
  DEFAULT_FONT = Font.default_name
 
  # set this to true to enable the font above for all windows.
  # also sets the back_opacity to 255 for all windows. 
  # I recommend setting this to 'true' to maintain a consistent look.
  USE_FOR_ALL = true
 
  # the icon id for your gold window portion of the menu, 194 by default.
  GOLD_ICON_ID = 194
 
end

if FF9_Config::USE_FOR_ALL   
 
  Font.default_name = FF9_Config::DEFAULT_FONT
 
  class Window_Base < Window
   
    alias :eds_pre_ff9_menu_base_initialize :initialize
    def initialize(*args)
      eds_pre_ff9_menu_base_initialize(*args) 
      self.stretch = false if FF9_Config::USE_TILED_WINDOW
      self.back_opacity = 255
    end
   
  end
 
end

class Window_Base < Window
 
  CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228)
  CAPTION_HEIGHT = 12
  X_OFFSET = 16
  Y_OFFSET = -5
 
  alias :eds_pre_window_caption_intialize :initialize
  def initialize(*args)     
    eds_pre_window_caption_intialize(*args)   
    @caption_sprite = Sprite_Base.new(self.viewport)
    create_caption_bitmap(1, CAPTION_HEIGHT)       
    @caption_sprite.x = self.x + X_OFFSET
    @caption_sprite.y = self.y + Y_OFFSET
    @caption_sprite.z = self.z + 1
  end
 
  def x=(value)
    super
    @caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil?
  end
 
  def y=(value)
    super
    @caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil?
  end
 
  def z=(value)
    super
    @caption_sprite.z = value + 1 unless @caption_sprite.nil?
  end
 
  def caption=(text)
    return unless text.is_a?(String)
    return if text.empty?
    @caption = text
    width = @caption_sprite.bitmap.text_size(@caption).width
    create_caption_bitmap(width, CAPTION_HEIGHT)   
    draw_caption
  end 
 
  def create_caption_bitmap(w, h)
    @caption_sprite.bitmap = Bitmap.new(w, h)   
    @caption_sprite.bitmap.font.size = 12
    @caption_sprite.bitmap.font.color = CAPTION_COLOR
    @caption_sprite.bitmap.font.bold = true 
  end
 
  def draw_caption
    unless @caption.nil?
      h = @caption_sprite.bitmap.height
      w = @caption_sprite.bitmap.width
      rect = Rect.new( 0, h / 2, w, h / 4 )
      @caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96))     
      @caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption)     
    end
  end
 
  alias :eds_pre_caption_window_dispose :dispose
  def dispose
    eds_pre_caption_window_dispose
    @caption_sprite.dispose
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 32
  end   
 
end

class Window_TimeGold < Window_Base 
   
  def initialize(x, y) 
    width = find_window_width("9999999")
    width = 140 if width < 140
    super(x, y, width, WLH + 58)   
    self.back_opacity = 255
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.caption = "TIME & #{Vocab.gold}"
    @time_icon = Cache.picture('Timer') 
    @intern_frame_count = 0
    refresh
  end
 
  def draw_time
    sec = (Graphics.frame_count / 60) % 60
    min = (Graphics.frame_count / 3600) % 60
    hrs = Graphics.frame_count / 216000   
    self.contents.font.color = Color.new(255, 255, 255)   
    time = "%02d:%02d:%02d" % [hrs, min, sec]
    self.contents.draw_text(0, 0, self.contents.width, WLH, time, 2)   
  end 
 
  def refresh
    self.contents.clear
    self.contents.blt(0, 0, @time_icon, @time_icon.rect)
    draw_icon(FF9_Config::GOLD_ICON_ID, 2, WLH) 
    draw_currency_value($game_party.gold, 0, WLH, self.contents.width)
    draw_time
  end
 
  def draw_currency_value(value, x, y, width)
    gold_text = Vocab.gold
    cx = contents.text_size(gold_text[0,1]).width
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2)
    self.contents.font.color = system_color
    # just print the first character of Vocab::gold
    self.contents.draw_text(x, y, width, WLH, gold_text[0,1], 2)
  end
 
  def update
    super
    @intern_frame_count += 1
    return if (@intern_frame_count % 60) != 0         
    refresh
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 80
  end
 
end

class Window_MenuLocation < Window_Base
 
  def initialize(x, y)
    @map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
    width = find_window_width(@map_name)
    super(x, y, width, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.back_opacity = 255
    self.caption = "LOCATION"
    refresh
  end
 
  def refresh
    self.contents.clear   
    self.contents.draw_text(0, 0, self.contents.width, WLH,  @map_name, 1)
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 48
  end
 
end

class Window_Command < Window_Selectable
 
  alias :eds_pre_ff9_menu_win_command_init :initialize
  def initialize(*args)
    @font_name = Font.default_name   
    eds_pre_ff9_menu_win_command_init(*args)   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear   
    self.contents.font.name = @font_name
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def font_name=(name)
    @font_name = name   
  end
 
end

class Window_Uses < Window_Base 
 
  def initialize(right, y, item)   
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"
    w = 160
    x = right ? (544 - w) : 0   
    super(x, y, w, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def item=(item)   
    return unless item.is_a?(RPG::Item)
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"     
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_SkillUses < Window_Base 
 
  def initialize(right, y, actor, skill)   
    @remaining_text = make_info_string(actor, skill)
    w = 182
    x = right ? (544 - w) : 0       
    super(x, y, w, WLH + 32) 
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def make_info_string(actor, skill)
    return if actor.nil? || skill.nil?
    cost = actor.calc_mp_cost(skill)
    return "Unlimited" if cost < 1
    return "Remaining: #{actor.mp / cost}"
  end
 
  def set_skill(actor, skill)
    return if actor.nil? || skill.nil?
    return unless skill.is_a?(RPG::Skill)
    @remaining_text = make_info_string(actor, skill)   
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh   
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_MenuStatus < Window_Selectable
   
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 452, 352)     
    @bg_image = Cache.picture('FF9_MenuBar') 
    @arrow_image = Cache.picture('Pointer')
    create_arrow_sprites
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.opacity = 0   
    self.z = 99       
    self.active = false
    self.index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # * create_arrow_sprites
  #--------------------------------------------------------------------------
  def create_arrow_sprites 
    @arrow_sprites = []
    for i in 0..3
      @arrow_sprites << Sprite.new
      @arrow_sprites[i].bitmap = Bitmap.new(@arrow_image.width + 7, @arrow_image.height)
      @arrow_sprites[i].x = self.x
      @arrow_sprites[i].y = (i * 80) + self.y + 40     
      @arrow_sprites[i].z = 999       
    end
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    draw_background_windows if FF9_Config::DRAW_FOR_ALL
    for actor in $game_party.members
      x = 104
      y = actor.index * 80     
      y_offset = 6     
      draw_background_window(0, y) unless FF9_Config::DRAW_FOR_ALL
      draw_actor_face(actor, 19, y + 4, 73)
      draw_actor_name(actor, x, y + y_offset)
      draw_actor_class(actor, x + 125, y + y_offset) if actor.states.empty?
      draw_actor_level(actor, x, y + WLH * 1)     
      draw_actor_state(actor, x + 125, y + y_offset)
      draw_actor_hp(actor, x, ((y) + (WLH * 2) - 5))
      draw_actor_mp(actor, x + 125, ((y) + (WLH * 2) - 5))
    end
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def update_cursor             
    if @index < 0             
      #refactor into update arrow method
      @arrow_sprites.each { |sprite| sprite.bitmap.clear }
      return
    end
    @intern_frame_count += 1
    return unless (@intern_frame_count % 5) == 0
    if @sprite_last_draw_x >= 7     
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x <= 0
      @sprite_inc_x = 1
    end
    update_arrow_sprites
  end
  #--------------------------------------------------------------------------
  # * update_arrow_sprites
  #--------------------------------------------------------------------------
  def update_arrow_sprites   
    @arrow_sprites.each { |sprite| sprite.bitmap.clear }   
    if @index == 99   # all selected       
      return unless (@intern_frame_count % 10) == 0
      draw_arrow_sprites(@arrow_sprites, false)     
    else
      draw_arrow_sprites([@arrow_sprites[@index]], FF9_Config::ANIMATE_CURSOR)     
    end
  end
  #--------------------------------------------------------------------------
  # * draw_arrow_sprites
  #--------------------------------------------------------------------------
  def draw_arrow_sprites(sprites, animated=true)
    for sprite in sprites         
      image_x = animated ? @sprite_last_draw_x + @sprite_inc_x : 0
      @sprite_last_draw_x = image_x           
      sprite.bitmap.blt(image_x, 0, @arrow_image, @arrow_image.rect)
    end
  end
  #--------------------------------------------------------------------------
  # * y=
  #--------------------------------------------------------------------------
  def y=(value)
    super
    unless @arrow_sprites.nil?
      for i in 0..3
        @arrow_sprites[i].y = (i * 80) + value + 40
      end
    end
  end
  #--------------------------------------------------------------------------
  # * x=
  #--------------------------------------------------------------------------
  def x=(value)
    super
    unless @arrow_sprites.nil?
      @arrow_sprites.each { |sprite| sprite.x = value }
    end
  end
  #--------------------------------------------------------------------------
  # * draw_background_windows
  #--------------------------------------------------------------------------
  def draw_background_windows 
    self.contents.blt(0, 0, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 80, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 160, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 240, @bg_image, @bg_image.rect)   
  end 
  #--------------------------------------------------------------------------
  # * draw_background_window (single)
  #--------------------------------------------------------------------------
  def draw_background_window(x, y)
    self.contents.blt(x, y, @bg_image, @bg_image.rect)   
  end
  #--------------------------------------------------------------------------
  # * visible
  #--------------------------------------------------------------------------
  def visible=(value)
    super
    @arrow_sprites.each { |sprite| sprite.visible = value }
  end
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_win_stat_dispose :dispose
  def dispose
    eds_pre_ff9_win_stat_dispose
    @arrow_sprites.each { |sprite| sprite.dispose }
  end
 
  def enable_cursor?(rect=nil)
    # for compatibility with the improved command window
    return false
  end   
 
end

class Scene_Menu
     
  #--------------------------------------------------------------------------
  # * create_menu_background (only if USE_CUSTOM_BACK == true)
  #--------------------------------------------------------------------------
  if FF9_Config::USE_CUSTOM_BACK
   
    def create_menu_background
      @menuback_sprite = Sprite.new
      @menuback_sprite.bitmap = Cache.picture(FF9_Config::BACK_NAME)
      @menuback_sprite.color.set(16, 16, 16, 128)
      update_menu_background
    end
   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------   
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s6 = Vocab::game_end
    # just changed the width of the window here
    @command_window = Window_Command.new(132, [s1, s2, s3, s4,s6])
    @command_window.index = @menu_index
    @command_window.stretch = false if FF9_Config::USE_TILED_WINDOW
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end 
    # new stuff here   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255
  end
  #--------------------------------------------------------------------------
  # * This method is intended to fix some compatibility problems
  #   that scripts run into when they change the command window
  #   in some way.  So, we let them override "create_command_window"
  #   and we simply don't call it from the "start" method.
  #   Instead, we call this method which does some extra checking.
  #--------------------------------------------------------------------------
  def eds_create_command_window
    create_command_window
    old_commands = @command_window.commands
    return if old_commands == [ Vocab::item,
                                Vocab::skill,
                                Vocab::equip,
                                Vocab::status,
                                Vocab::game_end ]

    # so we know that the default command window is not being used
    # we don't want to create another window, so we manually resize it
    # before the player can see. 
    long = ''
    # dynamically size the width based on the longest command
    old_commands.each { |command| long = command if command.length > long.length }
    # set the index to -1 so that the rectangle disappears.
    # if we don't do this, you can see the selection rectangle resize.
    @command_window.index = -1
    @command_window.width = @command_window.contents.text_size(long).width + 42
    @command_window.contents = Bitmap.new( @command_window.width - 32,
                                           @command_window.height - 32 )   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255       
    @command_window.refresh
    @command_window.index = @menu_index
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    #call this method for compatibility
    eds_create_command_window
    @gold_window = Window_TimeGold.new(372, 342)
    @gold_window.y -= @gold_window.height
    @gold_window.x = 528 - @gold_window.width
    @status_window = Window_MenuStatus.new(0, 12)
    @location_window = Window_MenuLocation.new(0, 0)
    @location_window.x = 528 - @location_window.width 
    @location_window.y = 398 - @location_window.height
  end
 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_menu_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_menu_terminate
    @location_window.dispose
  end
 
end

class Scene_Item < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_start :start
  def start       
    eds_pre_ff9_menu_scene_item_start
    @target_window.y = 58   
    @uses_window = Window_Uses.new(true, @help_window.height, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_win_stat_show_target_window :show_target_window
  def show_target_window(right) 
    @uses_window.item = @item_window.item
    @uses_window.visible = true   
    @item_window.visible = false   
    @item_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_item_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @item_window.visible = true       
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_item_determine_target
    @uses_window.item = @item_window.item
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

class Scene_Skill < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_start :start
  def start       
    eds_pre_ff9_menu_scene_skill_start
    @target_window.y = 58         
    @uses_window = Window_SkillUses.new(true, @help_window.height, nil, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  def show_target_window(right)
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
    @uses_window.visible = true
    @status_window.visible = false
    @skill_window.visible = false
    @skill_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_skill_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @skill_window.visible = true
    @status_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_skill_determine_target
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

MfG

Deity



Re: Hilfe zu Skripten.

Offline Im Not Jesus

  • Eventmeister
  • ***
  • Beiträge: 384
  • Still not Jesus.
Re: Hilfe zu Skripten.
« Antwort #84 am: Februar 21, 2009, 01:42:45 »
alles klar, ich werds testen und adde später dazu, obs geklappt hat!
danke schonmal!

Re: Hilfe zu Skripten.

Offline Seph

  • bLUbb?
  • Mr. MACK-Tile
  • ***
  • Beiträge: 224
Re: Hilfe zu Skripten.
« Antwort #85 am: Februar 24, 2009, 13:58:46 »
@Seph
Ich glaube das müsste gehen, da es bei mir funktioniert hat :)

Spoiler for Hiden:
=begin                 
                          BigEd781' Final Fantasy IX Menu
            Credit to PainHurt at rpgmakervx.net for most of the graphics
=end

module FF9_Config 
   
  # set this to 'true' if you would like to use a cusotm background image
  USE_CUSTOM_BACK = true
  # the name of the custom background image, without the file extension (no .png)
  BACK_NAME = 'StoneBackground'
  # if you set this to 'true', you must be using the enhanced
  # Window class script that I posted:  You can get that script here:
  # http://www.rpgmakervx.net/index.php?showtopic=8042&hl=
  # this will make the provided FF9 windowskin look really good.
  USE_TILED_WINDOW = false
 
  # When this is set to 'true', the menu cirsor will animate back and forth.
  # When set to 'false', it will stay in place
  ANIMATE_CURSOR = true
 
  # When set to 'true', four background panels are always drawn.
  # When set to 'false', a panel is only drawn for each party member
  DRAW_FOR_ALL = true
 
  # the name of the font used in the menu. 
  # use 'Font.default_name' for the default font.  Try 'Centaur' for a nice, smaller font.
  DEFAULT_FONT = Font.default_name
 
  # set this to true to enable the font above for all windows.
  # also sets the back_opacity to 255 for all windows. 
  # I recommend setting this to 'true' to maintain a consistent look.
  USE_FOR_ALL = true
 
  # the icon id for your gold window portion of the menu, 194 by default.
  GOLD_ICON_ID = 194
 
end

if FF9_Config::USE_FOR_ALL   
 
  Font.default_name = FF9_Config::DEFAULT_FONT
 
  class Window_Base < Window
   
    alias :eds_pre_ff9_menu_base_initialize :initialize
    def initialize(*args)
      eds_pre_ff9_menu_base_initialize(*args) 
      self.stretch = false if FF9_Config::USE_TILED_WINDOW
      self.back_opacity = 255
    end
   
  end
 
end

class Window_Base < Window
 
  CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228)
  CAPTION_HEIGHT = 12
  X_OFFSET = 16
  Y_OFFSET = -5
 
  alias :eds_pre_window_caption_intialize :initialize
  def initialize(*args)     
    eds_pre_window_caption_intialize(*args)   
    @caption_sprite = Sprite_Base.new(self.viewport)
    create_caption_bitmap(1, CAPTION_HEIGHT)       
    @caption_sprite.x = self.x + X_OFFSET
    @caption_sprite.y = self.y + Y_OFFSET
    @caption_sprite.z = self.z + 1
  end
 
  def x=(value)
    super
    @caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil?
  end
 
  def y=(value)
    super
    @caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil?
  end
 
  def z=(value)
    super
    @caption_sprite.z = value + 1 unless @caption_sprite.nil?
  end
 
  def caption=(text)
    return unless text.is_a?(String)
    return if text.empty?
    @caption = text
    width = @caption_sprite.bitmap.text_size(@caption).width
    create_caption_bitmap(width, CAPTION_HEIGHT)   
    draw_caption
  end 
 
  def create_caption_bitmap(w, h)
    @caption_sprite.bitmap = Bitmap.new(w, h)   
    @caption_sprite.bitmap.font.size = 12
    @caption_sprite.bitmap.font.color = CAPTION_COLOR
    @caption_sprite.bitmap.font.bold = true 
  end
 
  def draw_caption
    unless @caption.nil?
      h = @caption_sprite.bitmap.height
      w = @caption_sprite.bitmap.width
      rect = Rect.new( 0, h / 2, w, h / 4 )
      @caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96))     
      @caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption)     
    end
  end
 
  alias :eds_pre_caption_window_dispose :dispose
  def dispose
    eds_pre_caption_window_dispose
    @caption_sprite.dispose
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 32
  end   
 
end

class Window_TimeGold < Window_Base 
   
  def initialize(x, y) 
    width = find_window_width("9999999")
    width = 140 if width < 140
    super(x, y, width, WLH + 58)   
    self.back_opacity = 255
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.caption = "TIME & #{Vocab.gold}"
    @time_icon = Cache.picture('Timer') 
    @intern_frame_count = 0
    refresh
  end
 
  def draw_time
    sec = (Graphics.frame_count / 60) % 60
    min = (Graphics.frame_count / 3600) % 60
    hrs = Graphics.frame_count / 216000   
    self.contents.font.color = Color.new(255, 255, 255)   
    time = "%02d:%02d:%02d" % [hrs, min, sec]
    self.contents.draw_text(0, 0, self.contents.width, WLH, time, 2)   
  end 
 
  def refresh
    self.contents.clear
    self.contents.blt(0, 0, @time_icon, @time_icon.rect)
    draw_icon(FF9_Config::GOLD_ICON_ID, 2, WLH) 
    draw_currency_value($game_party.gold, 0, WLH, self.contents.width)
    draw_time
  end
 
  def draw_currency_value(value, x, y, width)
    gold_text = Vocab.gold
    cx = contents.text_size(gold_text[0,1]).width
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2)
    self.contents.font.color = system_color
    # just print the first character of Vocab::gold
    self.contents.draw_text(x, y, width, WLH, gold_text[0,1], 2)
  end
 
  def update
    super
    @intern_frame_count += 1
    return if (@intern_frame_count % 60) != 0         
    refresh
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 80
  end
 
end

class Window_MenuLocation < Window_Base
 
  def initialize(x, y)
    @map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
    width = find_window_width(@map_name)
    super(x, y, width, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.back_opacity = 255
    self.caption = "LOCATION"
    refresh
  end
 
  def refresh
    self.contents.clear   
    self.contents.draw_text(0, 0, self.contents.width, WLH,  @map_name, 1)
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 48
  end
 
end

class Window_Command < Window_Selectable
 
  alias :eds_pre_ff9_menu_win_command_init :initialize
  def initialize(*args)
    @font_name = Font.default_name   
    eds_pre_ff9_menu_win_command_init(*args)   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear   
    self.contents.font.name = @font_name
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def font_name=(name)
    @font_name = name   
  end
 
end

class Window_Uses < Window_Base 
 
  def initialize(right, y, item)   
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"
    w = 160
    x = right ? (544 - w) : 0   
    super(x, y, w, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def item=(item)   
    return unless item.is_a?(RPG::Item)
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"     
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_SkillUses < Window_Base 
 
  def initialize(right, y, actor, skill)   
    @remaining_text = make_info_string(actor, skill)
    w = 182
    x = right ? (544 - w) : 0       
    super(x, y, w, WLH + 32) 
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def make_info_string(actor, skill)
    return if actor.nil? || skill.nil?
    cost = actor.calc_mp_cost(skill)
    return "Unlimited" if cost < 1
    return "Remaining: #{actor.mp / cost}"
  end
 
  def set_skill(actor, skill)
    return if actor.nil? || skill.nil?
    return unless skill.is_a?(RPG::Skill)
    @remaining_text = make_info_string(actor, skill)   
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh   
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_MenuStatus < Window_Selectable
   
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 452, 352)     
    @bg_image = Cache.picture('FF9_MenuBar') 
    @arrow_image = Cache.picture('Pointer')
    create_arrow_sprites
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.opacity = 0   
    self.z = 99       
    self.active = false
    self.index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # * create_arrow_sprites
  #--------------------------------------------------------------------------
  def create_arrow_sprites 
    @arrow_sprites = []
    for i in 0..3
      @arrow_sprites << Sprite.new
      @arrow_sprites[i].bitmap = Bitmap.new(@arrow_image.width + 7, @arrow_image.height)
      @arrow_sprites[i].x = self.x
      @arrow_sprites[i].y = (i * 80) + self.y + 40     
      @arrow_sprites[i].z = 999       
    end
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    draw_background_windows if FF9_Config::DRAW_FOR_ALL
    for actor in $game_party.members
      x = 104
      y = actor.index * 80     
      y_offset = 6     
      draw_background_window(0, y) unless FF9_Config::DRAW_FOR_ALL
      draw_actor_face(actor, 19, y + 4, 73)
      draw_actor_name(actor, x, y + y_offset)
      draw_actor_class(actor, x + 125, y + y_offset) if actor.states.empty?
      draw_actor_level(actor, x, y + WLH * 1)     
      draw_actor_state(actor, x + 125, y + y_offset)
      draw_actor_hp(actor, x, ((y) + (WLH * 2) - 5))
      draw_actor_mp(actor, x + 125, ((y) + (WLH * 2) - 5))
    end
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def update_cursor             
    if @index < 0             
      #refactor into update arrow method
      @arrow_sprites.each { |sprite| sprite.bitmap.clear }
      return
    end
    @intern_frame_count += 1
    return unless (@intern_frame_count % 5) == 0
    if @sprite_last_draw_x >= 7     
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x <= 0
      @sprite_inc_x = 1
    end
    update_arrow_sprites
  end
  #--------------------------------------------------------------------------
  # * update_arrow_sprites
  #--------------------------------------------------------------------------
  def update_arrow_sprites   
    @arrow_sprites.each { |sprite| sprite.bitmap.clear }   
    if @index == 99   # all selected       
      return unless (@intern_frame_count % 10) == 0
      draw_arrow_sprites(@arrow_sprites, false)     
    else
      draw_arrow_sprites([@arrow_sprites[@index]], FF9_Config::ANIMATE_CURSOR)     
    end
  end
  #--------------------------------------------------------------------------
  # * draw_arrow_sprites
  #--------------------------------------------------------------------------
  def draw_arrow_sprites(sprites, animated=true)
    for sprite in sprites         
      image_x = animated ? @sprite_last_draw_x + @sprite_inc_x : 0
      @sprite_last_draw_x = image_x           
      sprite.bitmap.blt(image_x, 0, @arrow_image, @arrow_image.rect)
    end
  end
  #--------------------------------------------------------------------------
  # * y=
  #--------------------------------------------------------------------------
  def y=(value)
    super
    unless @arrow_sprites.nil?
      for i in 0..3
        @arrow_sprites[i].y = (i * 80) + value + 40
      end
    end
  end
  #--------------------------------------------------------------------------
  # * x=
  #--------------------------------------------------------------------------
  def x=(value)
    super
    unless @arrow_sprites.nil?
      @arrow_sprites.each { |sprite| sprite.x = value }
    end
  end
  #--------------------------------------------------------------------------
  # * draw_background_windows
  #--------------------------------------------------------------------------
  def draw_background_windows 
    self.contents.blt(0, 0, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 80, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 160, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 240, @bg_image, @bg_image.rect)   
  end 
  #--------------------------------------------------------------------------
  # * draw_background_window (single)
  #--------------------------------------------------------------------------
  def draw_background_window(x, y)
    self.contents.blt(x, y, @bg_image, @bg_image.rect)   
  end
  #--------------------------------------------------------------------------
  # * visible
  #--------------------------------------------------------------------------
  def visible=(value)
    super
    @arrow_sprites.each { |sprite| sprite.visible = value }
  end
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_win_stat_dispose :dispose
  def dispose
    eds_pre_ff9_win_stat_dispose
    @arrow_sprites.each { |sprite| sprite.dispose }
  end
 
  def enable_cursor?(rect=nil)
    # for compatibility with the improved command window
    return false
  end   
 
end

class Scene_Menu
     
  #--------------------------------------------------------------------------
  # * create_menu_background (only if USE_CUSTOM_BACK == true)
  #--------------------------------------------------------------------------
  if FF9_Config::USE_CUSTOM_BACK
   
    def create_menu_background
      @menuback_sprite = Sprite.new
      @menuback_sprite.bitmap = Cache.picture(FF9_Config::BACK_NAME)
      @menuback_sprite.color.set(16, 16, 16, 128)
      update_menu_background
    end
   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------   
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s6 = Vocab::game_end
    # just changed the width of the window here
    @command_window = Window_Command.new(132, [s1, s2, s3, s4,s6])
    @command_window.index = @menu_index
    @command_window.stretch = false if FF9_Config::USE_TILED_WINDOW
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end 
    # new stuff here   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255
  end
  #--------------------------------------------------------------------------
  # * This method is intended to fix some compatibility problems
  #   that scripts run into when they change the command window
  #   in some way.  So, we let them override "create_command_window"
  #   and we simply don't call it from the "start" method.
  #   Instead, we call this method which does some extra checking.
  #--------------------------------------------------------------------------
  def eds_create_command_window
    create_command_window
    old_commands = @command_window.commands
    return if old_commands == [ Vocab::item,
                                Vocab::skill,
                                Vocab::equip,
                                Vocab::status,
                                Vocab::game_end ]

    # so we know that the default command window is not being used
    # we don't want to create another window, so we manually resize it
    # before the player can see. 
    long = ''
    # dynamically size the width based on the longest command
    old_commands.each { |command| long = command if command.length > long.length }
    # set the index to -1 so that the rectangle disappears.
    # if we don't do this, you can see the selection rectangle resize.
    @command_window.index = -1
    @command_window.width = @command_window.contents.text_size(long).width + 42
    @command_window.contents = Bitmap.new( @command_window.width - 32,
                                           @command_window.height - 32 )   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255       
    @command_window.refresh
    @command_window.index = @menu_index
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    #call this method for compatibility
    eds_create_command_window
    @gold_window = Window_TimeGold.new(372, 342)
    @gold_window.y -= @gold_window.height
    @gold_window.x = 528 - @gold_window.width
    @status_window = Window_MenuStatus.new(0, 12)
    @location_window = Window_MenuLocation.new(0, 0)
    @location_window.x = 528 - @location_window.width 
    @location_window.y = 398 - @location_window.height
  end
 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_menu_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_menu_terminate
    @location_window.dispose
  end
 
end

class Scene_Item < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_start :start
  def start       
    eds_pre_ff9_menu_scene_item_start
    @target_window.y = 58   
    @uses_window = Window_Uses.new(true, @help_window.height, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_win_stat_show_target_window :show_target_window
  def show_target_window(right) 
    @uses_window.item = @item_window.item
    @uses_window.visible = true   
    @item_window.visible = false   
    @item_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_item_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @item_window.visible = true       
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_item_determine_target
    @uses_window.item = @item_window.item
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

class Scene_Skill < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_start :start
  def start       
    eds_pre_ff9_menu_scene_skill_start
    @target_window.y = 58         
    @uses_window = Window_SkillUses.new(true, @help_window.height, nil, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  def show_target_window(right)
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
    @uses_window.visible = true
    @status_window.visible = false
    @skill_window.visible = false
    @skill_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_skill_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @skill_window.visible = true
    @status_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_skill_determine_target
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

MfG

Deity


Hat leider net geklappt, liegt vllt an einem meine anderen Scripte :/
Aber trotzdem danke für die Hilfe.
« Letzte Änderung: Februar 24, 2009, 13:59:01 von Seph »

Re: Hilfe zu Skripten.

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Hilfe zu Skripten.
« Antwort #86 am: Februar 24, 2009, 15:12:04 »
@Seph
Hast du vielleicht andere Menübasierendescripte, die hinter diesem Script eingefügt wurden? Da das letzte Script meistens die größte Wirkung hat solltest du das mal überprüfen.

MfG
Deity



Re: Hilfe zu Skripten.

Offline Seph

  • bLUbb?
  • Mr. MACK-Tile
  • ***
  • Beiträge: 224
Re: Hilfe zu Skripten.
« Antwort #87 am: Februar 25, 2009, 17:23:30 »
Hab nur das Tankentai ATB addon dass im Menü ein neues Feld hinzufügt für die ATB-EInstellugnen. Keine Ahnung obs daran liegt.
« Letzte Änderung: Februar 25, 2009, 17:23:40 von Seph »

Re: Hilfe zu Skripten.

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Hilfe zu Skripten.
« Antwort #88 am: Februar 25, 2009, 20:14:56 »
Hier bitte schön ich habe es an den ATB angepasst. Einzige Vorraussetzung für das funktionieren,
das Script hier muss hinter ATB Addon ( ATB 1.1b) eingefügt werden.
Spoiler for Hiden:
=begin                 
                          BigEd781' Final Fantasy IX Menu
            Credit to PainHurt at rpgmakervx.net for most of the graphics
=end

module FF9_Config 
   
  # set this to 'true' if you would like to use a cusotm background image
  USE_CUSTOM_BACK = true
  # the name of the custom background image, without the file extension (no .png)
  BACK_NAME = 'StoneBackground'
  # if you set this to 'true', you must be using the enhanced
  # Window class script that I posted:  You can get that script here:
  # http://www.rpgmakervx.net/index.php?showtopic=8042&hl=
  # this will make the provided FF9 windowskin look really good.
  USE_TILED_WINDOW = false
 
  # When this is set to 'true', the menu cirsor will animate back and forth.
  # When set to 'false', it will stay in place
  ANIMATE_CURSOR = true
 
  # When set to 'true', four background panels are always drawn.
  # When set to 'false', a panel is only drawn for each party member
  DRAW_FOR_ALL = true
 
  # the name of the font used in the menu. 
  # use 'Font.default_name' for the default font.  Try 'Centaur' for a nice, smaller font.
  DEFAULT_FONT = Font.default_name
 
  # set this to true to enable the font above for all windows.
  # also sets the back_opacity to 255 for all windows. 
  # I recommend setting this to 'true' to maintain a consistent look.
  USE_FOR_ALL = true
 
  # the icon id for your gold window portion of the menu, 194 by default.
  GOLD_ICON_ID = 194
 
end

if FF9_Config::USE_FOR_ALL   
 
  Font.default_name = FF9_Config::DEFAULT_FONT
 
  class Window_Base < Window
   
    alias :eds_pre_ff9_menu_base_initialize :initialize
    def initialize(*args)
      eds_pre_ff9_menu_base_initialize(*args) 
      self.stretch = false if FF9_Config::USE_TILED_WINDOW
      self.back_opacity = 255
    end
   
  end
 
end

class Window_Base < Window
 
  CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228)
  CAPTION_HEIGHT = 12
  X_OFFSET = 16
  Y_OFFSET = -5
 
  alias :eds_pre_window_caption_intialize :initialize
  def initialize(*args)     
    eds_pre_window_caption_intialize(*args)   
    @caption_sprite = Sprite_Base.new(self.viewport)
    create_caption_bitmap(1, CAPTION_HEIGHT)       
    @caption_sprite.x = self.x + X_OFFSET
    @caption_sprite.y = self.y + Y_OFFSET
    @caption_sprite.z = self.z + 1
  end
 
  def x=(value)
    super
    @caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil?
  end
 
  def y=(value)
    super
    @caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil?
  end
 
  def z=(value)
    super
    @caption_sprite.z = value + 1 unless @caption_sprite.nil?
  end
 
  def caption=(text)
    return unless text.is_a?(String)
    return if text.empty?
    @caption = text
    width = @caption_sprite.bitmap.text_size(@caption).width
    create_caption_bitmap(width, CAPTION_HEIGHT)   
    draw_caption
  end 
 
  def create_caption_bitmap(w, h)
    @caption_sprite.bitmap = Bitmap.new(w, h)   
    @caption_sprite.bitmap.font.size = 12
    @caption_sprite.bitmap.font.color = CAPTION_COLOR
    @caption_sprite.bitmap.font.bold = true 
  end
 
  def draw_caption
    unless @caption.nil?
      h = @caption_sprite.bitmap.height
      w = @caption_sprite.bitmap.width
      rect = Rect.new( 0, h / 2, w, h / 4 )
      @caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96))     
      @caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption)     
    end
  end
 
  alias :eds_pre_caption_window_dispose :dispose
  def dispose
    eds_pre_caption_window_dispose
    @caption_sprite.dispose
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 32
  end   
 
end

class Window_TimeGold < Window_Base 
   
  def initialize(x, y) 
    width = find_window_width("9999999")
    width = 140 if width < 140
    super(x, y, width, WLH + 58)   
    self.back_opacity = 255
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.caption = "TIME & #{Vocab.gold}"
    @time_icon = Cache.picture('Timer') 
    @intern_frame_count = 0
    refresh
  end
 
  def draw_time
    sec = (Graphics.frame_count / 60) % 60
    min = (Graphics.frame_count / 3600) % 60
    hrs = Graphics.frame_count / 216000   
    self.contents.font.color = Color.new(255, 255, 255)   
    time = "%02d:%02d:%02d" % [hrs, min, sec]
    self.contents.draw_text(0, 0, self.contents.width, WLH, time, 2)   
  end 
 
  def refresh
    self.contents.clear
    self.contents.blt(0, 0, @time_icon, @time_icon.rect)
    draw_icon(FF9_Config::GOLD_ICON_ID, 2, WLH) 
    draw_currency_value($game_party.gold, 0, WLH, self.contents.width)
    draw_time
  end
 
  def draw_currency_value(value, x, y, width)
    gold_text = Vocab.gold
    cx = contents.text_size(gold_text[0,1]).width
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2)
    self.contents.font.color = system_color
    # just print the first character of Vocab::gold
    self.contents.draw_text(x, y, width, WLH, gold_text[0,1], 2)
  end
 
  def update
    super
    @intern_frame_count += 1
    return if (@intern_frame_count % 60) != 0         
    refresh
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 80
  end
 
end

class Window_MenuLocation < Window_Base
 
  def initialize(x, y)
    @map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
    width = find_window_width(@map_name)
    super(x, y, width, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.back_opacity = 255
    self.caption = "LOCATION"
    refresh
  end
 
  def refresh
    self.contents.clear   
    self.contents.draw_text(0, 0, self.contents.width, WLH,  @map_name, 1)
  end
 
  def find_window_width(text)             
    return Bitmap.new(544, 416).text_size(text).width + 48
  end
 
end

class Window_Command < Window_Selectable
 
  alias :eds_pre_ff9_menu_win_command_init :initialize
  def initialize(*args)
    @font_name = Font.default_name   
    eds_pre_ff9_menu_win_command_init(*args)   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear   
    self.contents.font.name = @font_name
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def font_name=(name)
    @font_name = name   
  end
 
end

class Window_Uses < Window_Base 
 
  def initialize(right, y, item)   
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"
    w = 160
    x = right ? (544 - w) : 0   
    super(x, y, w, WLH + 32)   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def item=(item)   
    return unless item.is_a?(RPG::Item)
    @remaining_text = "Remaining: #{$game_party.item_number(item)}"     
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_SkillUses < Window_Base 
 
  def initialize(right, y, actor, skill)   
    @remaining_text = make_info_string(actor, skill)
    w = 182
    x = right ? (544 - w) : 0       
    super(x, y, w, WLH + 32) 
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    refresh
  end
 
  def make_info_string(actor, skill)
    return if actor.nil? || skill.nil?
    cost = actor.calc_mp_cost(skill)
    return "Unlimited" if cost < 1
    return "Remaining: #{actor.mp / cost}"
  end
 
  def set_skill(actor, skill)
    return if actor.nil? || skill.nil?
    return unless skill.is_a?(RPG::Skill)
    @remaining_text = make_info_string(actor, skill)   
    refresh
  end
 
  def visible=(value)
    super
    refresh if value
  end
 
  def refresh   
    self.contents.clear
    self.contents.draw_text(self.contents.rect, @remaining_text, 1)
  end
 
end

class Window_MenuStatus < Window_Selectable
   
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 452, 352)     
    @bg_image = Cache.picture('FF9_MenuBar') 
    @arrow_image = Cache.picture('Pointer')
    create_arrow_sprites
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0   
    self.stretch = false if FF9_Config::USE_TILED_WINDOW
    self.contents.font.name = FF9_Config::DEFAULT_FONT
    self.opacity = 0   
    self.z = 99       
    self.active = false
    self.index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # * create_arrow_sprites
  #--------------------------------------------------------------------------
  def create_arrow_sprites 
    @arrow_sprites = []
    for i in 0..3
      @arrow_sprites << Sprite.new
      @arrow_sprites[i].bitmap = Bitmap.new(@arrow_image.width + 7, @arrow_image.height)
      @arrow_sprites[i].x = self.x
      @arrow_sprites[i].y = (i * 80) + self.y + 40     
      @arrow_sprites[i].z = 999       
    end
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    draw_background_windows if FF9_Config::DRAW_FOR_ALL
    for actor in $game_party.members
      x = 104
      y = actor.index * 80     
      y_offset = 6     
      draw_background_window(0, y) unless FF9_Config::DRAW_FOR_ALL
      draw_actor_face(actor, 19, y + 4, 73)
      draw_actor_name(actor, x, y + y_offset)
      draw_actor_class(actor, x + 125, y + y_offset) if actor.states.empty?
      draw_actor_level(actor, x, y + WLH * 1)     
      draw_actor_state(actor, x + 125, y + y_offset)
      draw_actor_hp(actor, x, ((y) + (WLH * 2) - 5))
      draw_actor_mp(actor, x + 125, ((y) + (WLH * 2) - 5))
    end
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def update_cursor             
    if @index < 0             
      #refactor into update arrow method
      @arrow_sprites.each { |sprite| sprite.bitmap.clear }
      return
    end
    @intern_frame_count += 1
    return unless (@intern_frame_count % 5) == 0
    if @sprite_last_draw_x >= 7     
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x <= 0
      @sprite_inc_x = 1
    end
    update_arrow_sprites
  end
  #--------------------------------------------------------------------------
  # * update_arrow_sprites
  #--------------------------------------------------------------------------
  def update_arrow_sprites   
    @arrow_sprites.each { |sprite| sprite.bitmap.clear }   
    if @index == 99   # all selected       
      return unless (@intern_frame_count % 10) == 0
      draw_arrow_sprites(@arrow_sprites, false)     
    else
      draw_arrow_sprites([@arrow_sprites[@index]], FF9_Config::ANIMATE_CURSOR)     
    end
  end
  #--------------------------------------------------------------------------
  # * draw_arrow_sprites
  #--------------------------------------------------------------------------
  def draw_arrow_sprites(sprites, animated=true)
    for sprite in sprites         
      image_x = animated ? @sprite_last_draw_x + @sprite_inc_x : 0
      @sprite_last_draw_x = image_x           
      sprite.bitmap.blt(image_x, 0, @arrow_image, @arrow_image.rect)
    end
  end
  #--------------------------------------------------------------------------
  # * y=
  #--------------------------------------------------------------------------
  def y=(value)
    super
    unless @arrow_sprites.nil?
      for i in 0..3
        @arrow_sprites[i].y = (i * 80) + value + 40
      end
    end
  end
  #--------------------------------------------------------------------------
  # * x=
  #--------------------------------------------------------------------------
  def x=(value)
    super
    unless @arrow_sprites.nil?
      @arrow_sprites.each { |sprite| sprite.x = value }
    end
  end
  #--------------------------------------------------------------------------
  # * draw_background_windows
  #--------------------------------------------------------------------------
  def draw_background_windows 
    self.contents.blt(0, 0, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 80, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 160, @bg_image, @bg_image.rect)   
    self.contents.blt(0, 240, @bg_image, @bg_image.rect)   
  end 
  #--------------------------------------------------------------------------
  # * draw_background_window (single)
  #--------------------------------------------------------------------------
  def draw_background_window(x, y)
    self.contents.blt(x, y, @bg_image, @bg_image.rect)   
  end
  #--------------------------------------------------------------------------
  # * visible
  #--------------------------------------------------------------------------
  def visible=(value)
    super
    @arrow_sprites.each { |sprite| sprite.visible = value }
  end
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_win_stat_dispose :dispose
  def dispose
    eds_pre_ff9_win_stat_dispose
    @arrow_sprites.each { |sprite| sprite.dispose }
  end
 
  def enable_cursor?(rect=nil)
    # for compatibility with the improved command window
    return false
  end   
 
end

class Scene_Menu
     
  #--------------------------------------------------------------------------
  # * create_menu_background (only if USE_CUSTOM_BACK == true)
  #--------------------------------------------------------------------------
  if FF9_Config::USE_CUSTOM_BACK
   
    def create_menu_background
      @menuback_sprite = Sprite.new
      @menuback_sprite.bitmap = Cache.picture(FF9_Config::BACK_NAME)
      @menuback_sprite.color.set(16, 16, 16, 128)
      update_menu_background
    end
   
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------   
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = N02::ATB_CUSTOMIZE_NAME
    s6 = Vocab::game_end
    # just changed the width of the window here
    @command_window = Window_Command.new(132, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.stretch = false if FF9_Config::USE_TILED_WINDOW
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end 
    # new stuff here   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255
  end
  #--------------------------------------------------------------------------
  # * This method is intended to fix some compatibility problems
  #   that scripts run into when they change the command window
  #   in some way.  So, we let them override "create_command_window"
  #   and we simply don't call it from the "start" method.
  #   Instead, we call this method which does some extra checking.
  #--------------------------------------------------------------------------
  def eds_create_command_window
    create_command_window
    old_commands = @command_window.commands
    return if old_commands == [ Vocab::item,
                                Vocab::skill,
                                Vocab::equip,
                                Vocab::status,
                                Vocab::game_end ]

    # so we know that the default command window is not being used
    # we don't want to create another window, so we manually resize it
    # before the player can see. 
    long = ''
    # dynamically size the width based on the longest command
    old_commands.each { |command| long = command if command.length > long.length }
    # set the index to -1 so that the rectangle disappears.
    # if we don't do this, you can see the selection rectangle resize.
    @command_window.index = -1
    @command_window.width = @command_window.contents.text_size(long).width + 42
    @command_window.contents = Bitmap.new( @command_window.width - 32,
                                           @command_window.height - 32 )   
    @command_window.font_name = FF9_Config::DEFAULT_FONT
    @command_window.x = 528 - @command_window.width
    @command_window.y = 16
    @command_window.back_opacity = 255       
    @command_window.refresh
    @command_window.index = @menu_index
  end
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    #call this method for compatibility
    eds_create_command_window
    @gold_window = Window_TimeGold.new(372, 342)
    @gold_window.y -= @gold_window.height
    @gold_window.x = 528 - @gold_window.width
    @status_window = Window_MenuStatus.new(0, 12)
    @location_window = Window_MenuLocation.new(0, 0)
    @location_window.x = 528 - @location_window.width 
    @location_window.y = 398 - @location_window.height
  end
 
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_menu_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_menu_terminate
    @location_window.dispose
  end
 
end

class Scene_Item < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_start :start
  def start       
    eds_pre_ff9_menu_scene_item_start
    @target_window.y = 58   
    @uses_window = Window_Uses.new(true, @help_window.height, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_win_stat_show_target_window :show_target_window
  def show_target_window(right) 
    @uses_window.item = @item_window.item
    @uses_window.visible = true   
    @item_window.visible = false   
    @item_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_item_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @item_window.visible = true       
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_item_determine_target
    @uses_window.item = @item_window.item
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

class Scene_Skill < Scene_Base
 
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_start :start
  def start       
    eds_pre_ff9_menu_scene_skill_start
    @target_window.y = 58         
    @uses_window = Window_SkillUses.new(true, @help_window.height, nil, nil)
    @uses_window.visible = false
  end 
  #--------------------------------------------------------------------------
  # * OVERWRITTEN
  #   - right-align flag ignored
  #--------------------------------------------------------------------------
  def show_target_window(right)
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
    @uses_window.visible = true
    @status_window.visible = false
    @skill_window.visible = false
    @skill_window.active = false   
    @target_window.visible = true
    @target_window.active = true 
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * hide_target_window
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_hide_target_window :hide_target_window
  def hide_target_window
    eds_pre_ff9_menu_scene_skill_hide_target_window 
    @uses_window.visible = false unless @uses_window.nil?
    @skill_window.visible = true
    @status_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * determine_target
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_skill_determine_target :determine_target
  def determine_target   
    eds_pre_ff9_menu_scene_skill_determine_target
    @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill)
  end   
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :eds_pre_ff9_menu_scene_item_terminate :terminate
  def terminate
    eds_pre_ff9_menu_scene_item_terminate
    @uses_window.dispose
  end
 
end

MfG

Deity
« Letzte Änderung: Februar 25, 2009, 20:15:21 von Deity »



Re: Hilfe zu Skripten.

Offline Seph

  • bLUbb?
  • Mr. MACK-Tile
  • ***
  • Beiträge: 224
Re: Hilfe zu Skripten.
« Antwort #89 am: Februar 27, 2009, 14:24:56 »
Thx, funktioniert. Gute Arbeit :D

 


 Bild des Monats

rooftop party

Views: 3581
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal