Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Class changuing new command
- # By gerkrt/gerrtunk
- # Version: 1.3
- # License: MIT, credits
- # Date: 22/01/2011
- # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
- # script check here: http://usuarios.multimania.es/kisap/english_list.html
- #==============================================================================
- =begin
- -----INTRODUCTION-----
- This script adds a new command in battle and menu that functions to switch
- classes in menu or battle using skills. It also adds a simple class description
- window that is shown in the battle and menu.
- You can also configure font, vocabulary, and if you want to show sp or not.
- -----INSTRUCTIONS-----
- You have to define two basic things:
- 1- What skills are class changuing skills. To do this you have to modify
- this method:
- #--------------------------------------------------------------------------
- # * Class changing skills
- #--------------------------------------------------------------------------
- def self.cambia_clases(skill_id)
- case skill_id
- # If skill id 1---> Return class 3
- when 1; return 3
- when 6; return 1
- else; return 0
- end
- end
- You can add any number of new lines like when 6; return 1. The syntax is:
- skill id 1 changue to class 3
- when 1; return 3
- 2- You have to define class descriptions.
- #--------------------------------------------------------------------------
- # * Class descriptions
- #--------------------------------------------------------------------------
- def self.descripcion_clase(class_id)
- case class_id
- # Class id 1----------> Returns description
- when 3; return "Bonus \n ·Great aglity \n" +
- " ·It consumes less sp" +
- "\n Handicaps \n ·Bad for range attacks"
- else; return "Error. The class dont exist"
- end
- end
- This is somewhat harder. Now the 3 is the class that you are defining and we
- are now creating a description for it.
- You have to write the bonus and handicaps using two text marks. These marks
- tell the script that he is drawing bonus or handicaps so it can use one
- or other font color, for example.
- The marks are defined in these variables:
- Class_bonus = "Bonus \n"
- Class_handicaps = " Handicaps \n"
- Then you have to return a text that have class bonus after the bonus mark
- and class handicaps after the handicaps mark. So imagine that you want to write:
- Bonus
- ·Great aglity
- ·It consumes less sp
- Handicaps
- ·Bad for range attacks
- You have to write in the return:
- when 3; return "Bonus \n ·Great aglity \n" +
- " ·It consumes less sp" +
- "\n Handicaps \n ·Bad for range attacks"
- Also, else; return "Error. The class dont exist" These shows an error message when
- the class dont exist.
- 3- Note that this script dont changue the classes for you. You have to create
- a common event for such skills to changue they and add the animation you want or
- whatever.
- -----OTHER THINGS----
- You can control de font size, color and bold for normal, bonus or handicap text.
- Set bold to false if you dont want it.
- The hard thing to understand is the color. You have to set the values rgb + alpha.
- Handicap_font_color = Color.new(r,g,b,a)
- Note that the handicap and bonus fonts are applied to the starting words Bonus
- and Handicaps only.
- For last, you can set the command name that is the description of the command
- you are adding and if you turn off show_sp makig it = false it wont draw
- the class changuing skills sp.
- ------SYNTAX AND TEXT FORMAT NOTES------
- -Never erase the else in the methods.
- -You must respect the "" for the text
- -The spaces are also characters so you can use this to align better your text.
- Also the spaces are fixed in the mark workds, so, if you write them or the \n
- you will have to respect that.
- -The \n character means newline. It will draw the next text in a newline and you
- have to write \n for each line.
- -Rpg Maker XP sucks for long lines so you have to understand this syntax of the +:
- when 3; return "Bonus \n ·Great aglity \n" +
- " ·It consumes less sp" +
- "\n Handicaps \n ·Bad for range attacks"
- The + concatenates two or more phrases so they convert to one. The nice thing
- is that also after the + you can create a newline so its more organitzated.
- Anyway you can do this like you want. You can also write these lines in a better
- editor and jst paste it here.
- =end
- module Wep
- Command_name = "Special"
- Show_sp = true
- Class_bonus = "Bonus \n"
- Class_handicaps = " Handicaps \n"
- # Bonus font
- Bonus_font_bold = true
- Bonus_font_size = 25
- Bonus_font_color = Color.new(192, 224, 255, 255)
- # Handicap font
- Handicap_font_bold = true
- Handicap_font_size = 25
- Handicap_font_color = Color.new(255, 255, 64, 255)
- # Normal font
- Normal_font_bold = false
- Normal_font_size = 25
- Normal_font_color = Color.new(255,255,255,255)
- #--------------------------------------------------------------------------
- # * Class descriptions
- #--------------------------------------------------------------------------
- def self.descripcion_clase(class_id)
- case class_id
- # Class id 1----------> Returns description
- when 3; return "Bonus \n ·Great aglity \n" +
- " ·It consumes less sp" +
- "\n Handicaps \n ·Bad for range attacks"
- else; return "Error. The class dont exist"
- end
- end
- #--------------------------------------------------------------------------
- # * Class changing skills
- #--------------------------------------------------------------------------
- def self.cambia_clases(skill_id)
- case skill_id
- # If skill id 1---> Return class 3
- when 1; return 3
- when 6; return 1
- else; return 0
- end
- end
- end
- #==============================================================================
- # ** Window_OrbeRM
- #------------------------------------------------------------------------------
- # Esta ventana muestra los OrbeRM a equipar
- #==============================================================================
- class Window_OrbeRM < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor : personaje del cual estas examinando sus orbeRM
- #--------------------------------------------------------------------------
- def initialize(actor)
- # X Y Amplitud Altura respectivamente. Valores para el menu principal.
- super(0, 64, 270, 416)
- @actor = actor
- @column_max = 1
- refresh
- $scene.activar_descripcion(Wep.cambia_clases(skill.id))
- self.index = 0
- # Si esta en la batalla modifica la posicion, tamaño y transparencia.
- if $game_temp.in_battle
- # La mueve hacia arriva del todo.
- self.y = 0
- # Reduce su altura
- self.height = 320
- # Cambia la transparencia del fondo
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # * Acquiring Skill
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Modifica la id de la clase a describir en la ventana de descripcion
- $scene.activar_descripcion(Wep.cambia_clases(skill.id))
- # If cursor is movable
- if self.active and @item_max > 0 and @index >= 0
- # If pressing down on the directional buttons
- if Input.repeat?(Input::DOWN)
- # If column count is 1 and directional button was pressed down with no
- # repeat, or if cursor position is more to the front than
- # (item count - column count)
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
- @index < @item_max - @column_max
- # Move cursor down
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + @column_max) % @item_max
- $scene.refrescar_descripcion
- end
- end
- # If the up directional button was pressed
- if Input.repeat?(Input::UP)
- # If column count is 1 and directional button was pressed up with no
- # repeat, or if cursor position is more to the back than column count
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- # Move cursor up
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- # Refresca ventana para dibujar una unica vez la descripcion
- $scene.refrescar_descripcion
- end
- end
- # If the right directional button was pressed
- if Input.repeat?(Input::RIGHT)
- # If column count is 2 or more, and cursor position is closer to front
- # than (item count -1)
- if @column_max >= 2 and @index < @item_max - 1
- # Move cursor right
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- # Refresca ventana para dibujar una unica vez la descripcion
- $scene.refrescar_descripcion
- end
- end
- # If the left directional button was pressed
- if Input.repeat?(Input::LEFT)
- # If column count is 2 or more, and cursor position is more back than 0
- if @column_max >= 2 and @index > 0
- # Move cursor left
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- # Refresca ventana para dibujar una unica vez la descripcion
- $scene.refrescar_descripcion
- end
- end
- # If R button was pressed
- if Input.repeat?(Input::R)
- # If bottom row being displayed is more to front than bottom data row
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # Move cursor 1 page back
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- # Refresca ventana para dibujar una unica vez la descripcion
- $scene.refrescar_descripcion
- end
- end
- # If L button was pressed
- if Input.repeat?(Input::L)
- # If top row being displayed is more to back than 0
- if self.top_row > 0
- # Move cursor 1 page forward
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- # Refresca ventana para dibujar una unica vez la descripcion
- $scene.refrescar_descripcion
- end
- end
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...@actor.skills.size
- skill = $data_skills[@actor.skills[i]]
- # Comprueva si la habilidad es cambia-clases
- class_id = Wep.cambia_clases(skill.id)
- if class_id != 0
- if skill != nil
- # Si lo es la añade al array de orbesRM
- @data.push(skill)
- end
- end
- end
- # If item count is not 0, make a bit map and draw all items
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2) if Wep::Show_sp
- end
- end
- #==============================================================================
- # ** Window_DescripcionClase
- #------------------------------------------------------------------------------
- # Esta ventana muestra informacion sobre la clase (OrbeRM)
- #==============================================================================
- class Window_DescripcionClase < Window_Base
- attr_accessor :class_id
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- # X Y Amplitud Altura respectivamente. Valores para el menu principal.
- super(270, 64, 370, 416)
- self.contents = Bitmap.new(width-32, height-32)
- @class_id
- @s1 = Wep::Class_bonus # Palabra para la linea de ventajas
- @s2 = Wep::Class_handicaps # Palabra para la liea de desventajas
- # Cuidado. El programa buscara exactamente la palabra que escribas.
- # Esto incluye tanto espacios en blanco o el mismo caracter de saltar linea \n
- self.z = 254
- # Si esta en la batalla modifica la posicion, tamaño y transparencia.
- if $game_temp.in_battle
- # La situa arriva del todo
- self.y = 0
- # Reduce su altura
- self.height = 320
- # Cambia la transparencia del fondo
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # * comprovar_linea ( Comprueva si la linea es alguno de las palabras
- # definidas y cambia su estilo.)
- #--------------------------------------------------------------------------
- def comprovar_linea(linea)
- # Si son bonificaciones
- if linea == @s1
- # Cambia los atributos de la fuente
- self.contents.font.bold = Wep::Bonus_font_bold
- self.contents.font.size = Wep::Bonus_font_size
- self.contents.font.color = Wep::Bonus_font_color
- # Si son handicaps
- elsif linea == @s2
- # Cambia los atributos de la fuente
- self.contents.font.bold = Wep::Handicap_font_bold
- self.contents.font.size = Wep::Handicap_font_size
- self.contents.font.color = Wep::Handicap_font_color
- # Si no se esta en batalla suma +2 al indice para dejar espacio entre los bloques
- if not $game_temp.in_battle
- @i+=2
- end
- # Si se ha cambiado algun atributo de la fuente
- elsif self.contents.font.bold != false or self.contents.font.color != normal_color or self.contents.font.size != Font.default_size
- # Revierte los cambios en la fuente para dibujarla normal
- self.contents.font.bold = Wep::Normal_font_bold
- self.contents.font.size = Wep::Normal_font_size
- self.contents.font.color = Wep::Normal_font_color
- end
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- descripcion = Wep.descripcion_clase(@class_id)
- @i = 0
- # Dibuja las lineas segun el algoritmo
- descripcion.each_line {|linea| comprovar_linea(linea) ; self.contents.draw_text(0, 32*@i, self.contents.width, 32, linea) ;@i+=1 }
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs skill screen processing.
- #==============================================================================
- class Scene_OrbeRM
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor_index : actor index
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Get actor
- @actor = $game_party.actors[@actor_index]
- # Crea ventana de descripcion
- @ventana_descripcion = Window_DescripcionClase.new
- # Make help window, status window, and skill window
- #@help_window = Window_Help.new
- @status_window = Window_SkillStatus.new(@actor)
- @status_window.y = 0
- @skill_window = Window_OrbeRM.new(@actor)
- @ventana_descripcion.refresh
- # Associate help window
- #@skill_window.help_window = @help_window
- # Make target window (set to invisible / inactive)
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- #@help_window.dispose
- @status_window.dispose
- @skill_window.dispose
- @target_window.dispose
- @ventana_descripcion.dispose
- end
- #--------------------------------------------------------------------------
- # * Refrescar ventana descripcion optimizada
- #--------------------------------------------------------------------------
- def refrescar_descripcion
- @ventana_descripcion.refresh
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- #@help_window.update
- @status_window.update
- @skill_window.update
- @target_window.update
- # Si la ventana de descripcion esta visible, actualizarla.
- if @ventana_descripcion.visible
- @ventana_descripcion.update
- end
- # If skill window is active: call update_skill
- if @skill_window.active
- update_skill
- return
- end
- # If skill target is active: call update_target
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (if skill window is active)
- #--------------------------------------------------------------------------
- def update_skill
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(1)
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Get currently selected data on the skill window
- @skill = @skill_window.skill
- # If unable to use
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # If effect scope is ally
- if @skill.scope >= 3
- # Activate target window
- @skill_window.active = false
- @target_window.x = (@skill_window.index + 1) % 2 * 304
- @target_window.visible = true
- @target_window.active = true
- # Set cursor position to effect scope (single / all)
- if @skill.scope == 4 || @skill.scope == 6
- @target_window.index = -1
- elsif @skill.scope == 7
- @target_window.index = @actor_index - 10
- else
- @target_window.index = 0
- end
- # If effect scope is other than ally
- else
- # If common event ID is valid
- if @skill.common_event_id > 0
- # Common event call reservation
- $game_temp.common_event_id = @skill.common_event_id
- # Play use skill SE
- $game_system.se_play(@skill.menu_se)
- # Use up SP
- @actor.sp -= @skill.sp_cost
- # Remake each window content
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- # If R button was pressed
- if Input.trigger?(Input::R)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To next actor
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # Switch to different skill screen
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- # If L button was pressed
- if Input.trigger?(Input::L)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To previous actor
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # Switch to different skill screen
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Activar descripcion
- # Modifica la id de la clase a describir en la ventana de descripcion
- #--------------------------------------------------------------------------
- def activar_descripcion(class_id)
- @ventana_descripcion.class_id = class_id
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when target window is active)
- #--------------------------------------------------------------------------
- def update_target
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Erase target window
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # If unable to use because SP ran out
- unless @actor.skill_can_use?(@skill.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # If target is all
- if @target_window.index == -1
- # Apply skill use effects to entire party
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # If target is user
- if @target_window.index <= -2
- # Apply skill use effects to target actor
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # If single target
- if @target_window.index >= 0
- # Apply skill use effects to target actor
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # If skill was used
- if used
- # Play skill use SE
- $game_system.se_play(@skill.menu_se)
- # Use up SP
- @actor.sp -= @skill.sp_cost
- # Remake each window content
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # If entire party is dead
- if $game_party.all_dead?
- # Switch to game over screen
- $scene = Scene_Gameover.new
- return
- end
- # If command event ID is valid
- if @skill.common_event_id > 0
- # Command event call reservation
- $game_temp.common_event_id = @skill.common_event_id
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- # If skill wasn't used
- unless used
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle (part 3)
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Frame Update (actor command phase)
- #--------------------------------------------------------------------------
- def update_phase3
- # If enemy arrow is enabled
- if @enemy_arrow != nil
- update_phase3_enemy_select
- # If actor arrow is enabled
- elsif @actor_arrow != nil
- update_phase3_actor_select
- # If skill window is enabled
- elsif @skill_window != nil
- update_phase3_skill_select
- # If orbeRM window is enabled
- elsif @orberm_window != nil
- update_phase3_orberm_select
- # If item window is enabled
- elsif @item_window != nil
- update_phase3_item_select
- # If actor command window is enabled
- elsif @actor_command_window.active
- update_phase3_basic_command
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (actor command phase : orbeRM selection)
- #--------------------------------------------------------------------------
- def update_phase3_orberm_select
- # Make OrbeRM window visible
- @orberm_window.visible = true
- # Update OrbeRM window
- @orberm_window.update
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # End skill selection
- end_orberm_select
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Get currently selected data on the orbeRM window
- @orberm = @orberm_window.skill
- # If it can't be used
- if @orberm == nil or not @active_battler.skill_can_use?(@orberm.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Set action ##################################33333 IMP !!!!!
- @active_battler.current_action.skill_id = @orberm.id
- # Make skill window invisible
- @orberm_window.visible = false
- # If effect scope is single enemy
- if @orberm.scope == 1
- # Start enemy selection
- start_enemy_select
- # If effect scope is single ally
- elsif @orberm.scope == 3 or @orberm.scope == 5
- # Start actor selection
- start_actor_select
- # If effect scope is not single
- else
- # End skill selection
- end_orberm_select
- # Go to command input for next actor
- phase3_next_actor
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Start OrbeRM Selection
- #--------------------------------------------------------------------------
- def start_orberm_select
- # Crea ventana de descripcion
- @ventana_descripcion = Window_DescripcionClase.new
- # Make OrbeRM window
- @orberm_window = Window_OrbeRM.new(@active_battler)
- refrescar_descripcion
- # Desactiva temporalmente ventana de ayuda
- @help_window.visible = false
- # Disable actor command window
- @actor_command_window.active = false
- @actor_command_window.visible = false
- end
- #--------------------------------------------------------------------------
- # * End OrbeRM selection
- #--------------------------------------------------------------------------
- def end_orberm_select
- # Dispose of orbeRM window
- @orberm_window.dispose
- @ventana_descripcion.dispose
- @orberm_window = nil
- @ventana_descripcion = nil
- # Hide help window
- @help_window.visible = false
- # Enable actor command window
- @actor_command_window.active = true
- @actor_command_window.visible = true
- end
- end
- #==============================================================================
- # ** Scene_Battle (part 1)
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Initialize each kind of temporary battle data
- $game_temp.in_battle = true
- $game_temp.battle_turn = 0
- $game_temp.battle_event_flags.clear
- $game_temp.battle_abort = false
- $game_temp.battle_main_phase = false
- $game_temp.battleback_name = $game_map.battleback_name
- $game_temp.forcing_battler = nil
- # Initialize battle event interpreter
- $game_system.battle_interpreter.setup(nil, 0)
- # Prepare troop
- @troop_id = $game_temp.battle_troop_id
- $game_troop.setup(@troop_id)
- # Make actor command window
- s1 = $data_system.words.attack
- s2 = $data_system.words.skill
- s3 = Wep::Command_name
- s4 = $data_system.words.guard
- s5 = $data_system.words.item
- @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
- @actor_command_window.y = 128
- @actor_command_window.back_opacity = 160
- @actor_command_window.active = false
- @actor_command_window.visible = false
- # Make other windows
- @party_command_window = Window_PartyCommand.new
- @help_window = Window_Help.new
- @help_window.back_opacity = 160
- @help_window.visible = false
- @status_window = Window_BattleStatus.new
- @message_window = Window_Message.new
- # Crea ventana de descripcion
- # @ventana_descripcion = Window_DescripcionClase.new(x=320, y=128, amplitud=320, altura=352)
- # @ventana_descripcion.visible = false
- # Make sprite set
- @spriteset = Spriteset_Battle.new
- # Initialize wait count
- @wait_count = 0
- # Execute transition
- if $data_system.battle_transition == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $data_system.battle_transition)
- end
- # Start pre-battle phase
- start_phase1
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Refresh map
- $game_map.refresh
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @actor_command_window.dispose
- @party_command_window.dispose
- @help_window.dispose
- @status_window.dispose
- @message_window.dispose
- if @skill_window != nil
- @skill_window.dispose
- end
- if @orberm_window != nil
- @orberm.dispose
- end
- if @ventana_descripcion != nil
- @ventana_descripcion.dispose
- end
- if @item_window != nil
- @item_window.dispose
- end
- if @result_window != nil
- @result_window.dispose
- end
- # Dispose of sprite set
- @spriteset.dispose
- # If switching to title screen
- if $scene.is_a?(Scene_Title)
- # Fade out screen
- Graphics.transition
- Graphics.freeze
- end
- # If switching from battle test to any screen other than game over screen
- if $BTEST and not $scene.is_a?(Scene_Gameover)
- $scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # * Activar descripcion
- # Modifica la id de la clase a describir en la ventana de descripcion
- #--------------------------------------------------------------------------
- def activar_descripcion(class_id)
- @ventana_descripcion.class_id = class_id
- end
- #--------------------------------------------------------------------------
- # * Refrescar ventana descripcion optimizada
- #--------------------------------------------------------------------------
- def refrescar_descripcion
- @ventana_descripcion.refresh
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # If battle event is running
- if $game_system.battle_interpreter.running?
- # Update interpreter
- $game_system.battle_interpreter.update
- # If a battler which is forcing actions doesn't exist
- if $game_temp.forcing_battler == nil
- # If battle event has finished running
- unless $game_system.battle_interpreter.running?
- # Rerun battle event set up if battle continues
- unless judge
- setup_battle_event
- end
- end
- # If not after battle phase
- if @phase != 5
- # Refresh status window
- @status_window.refresh
- end
- end
- end
- # Update system (timer) and screen
- $game_system.update
- $game_screen.update
- # If timer has reached 0
- if $game_system.timer_working and $game_system.timer == 0
- # Abort battle
- $game_temp.battle_abort = true
- end
- # Update windows
- @help_window.update
- @party_command_window.update
- @actor_command_window.update
- @status_window.update
- @message_window.update
- if @ventana_descripcion != nil
- @ventana_descripcion.update
- end
- # Update sprite set
- @spriteset.update
- # If transition is processing
- if $game_temp.transition_processing
- # Clear transition processing flag
- $game_temp.transition_processing = false
- # Execute transition
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # If message window is showing
- if $game_temp.message_window_showing
- return
- end
- # If effect is showing
- if @spriteset.effect?
- return
- end
- # If game over
- if $game_temp.gameover
- # Switch to game over screen
- $scene = Scene_Gameover.new
- return
- end
- # If returning to title screen
- if $game_temp.to_title
- # Switch to title screen
- $scene = Scene_Title.new
- return
- end
- # If battle is aborted
- if $game_temp.battle_abort
- # Return to BGM used before battle started
- $game_system.bgm_play($game_temp.map_bgm)
- # Battle ends
- battle_end(1)
- return
- end
- # If waiting
- if @wait_count > 0
- # Decrease wait count
- @wait_count -= 1
- return
- end
- # If battler forcing an action doesn't exist,
- # and battle event is running
- if $game_temp.forcing_battler == nil and
- $game_system.battle_interpreter.running?
- return
- end
- # Branch according to phase
- case @phase
- when 1 # pre-battle phase
- update_phase1
- when 2 # party command phase
- update_phase2
- when 3 # actor command phase
- update_phase3
- when 4 # main phase
- update_phase4
- when 5 # after battle phase
- update_phase5
- end
- end
- end
- #==============================================================================
- # ** Window_Skill
- #------------------------------------------------------------------------------
- # This window displays usable skills on the skill and battle screens.
- #==============================================================================
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...@actor.skills.size
- skill = $data_skills[@actor.skills[i]]
- # Comprueva que la habilidad no sea cambia-clases
- class_id = Wep.cambia_clases(skill.id)
- if class_id == 0
- # Añade las habilidades no cambia-clases
- if skill != nil
- @data.push(skill)
- end
- end
- end
- # If item count is not 0, make a bit map and draw all items
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs menu screen processing.
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs menu screen processing.
- #==============================================================================
- class Scene_Menu
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs menu screen processing.
- #==============================================================================
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Make command window
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "Status"
- s5 = Wep::Command_name
- s6 = "Save"
- s7 = "Exit"
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- # If number of party members is 0
- if $game_party.actors.size == 0
- # Disable items, skills, equipment, and status
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # If save is forbidden
- if $game_system.save_disabled
- # Disable save
- @command_window.disable_item(5)
- end
- # Make play time window
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 256
- # Make steps window
- @steps_window = Window_Steps.new
- @steps_window.x = 0
- @steps_window.y = 352
- # Make gold window
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- # Make status window
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @command_window.dispose
- @playtime_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when command window is active)
- #--------------------------------------------------------------------------
- def update_command
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # If command other than save or end game, and party members = 0
- if $game_party.actors.size == 0 and @command_window.index < 4
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Branch by command window cursor position
- case @command_window.index
- when 0 # item
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to item screen
- $scene = Scene_Item.new
- when 1 # skill
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2 # equipment
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3 # status
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4 # newCommand
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Make status window active
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 5 # save
- # If saving is forbidden
- if $game_system.save_disabled
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to save screen
- $scene = Scene_Save.new
- when 6 # end game
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to end game screen
- $scene = Scene_End.new
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when status window is active)
- #--------------------------------------------------------------------------
- def update_status
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Make command window active
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Branch by command window cursor position
- case @command_window.index
- when 1 # skill
- # If this actor's action limit is 2 or more
- if $game_party.actors[@status_window.index].restriction >= 2
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to skill screen
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # equipment
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to equipment screen
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # status
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to status screen
- $scene = Scene_Status.new(@status_window.index)
- when 4 # newCommand
- # If this actor's action limit is 2 or more
- if $game_party.actors[@status_window.index].restriction >= 2
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Canvia a la escena de OrbeRM
- $scene = Scene_OrbeRM.new(@status_window.index)
- return
- end
- end
- end
- end
- #==============================================================================
- # ** Window_Steps
- #------------------------------------------------------------------------------
- # This window displays step count on the menu screen.
- #==============================================================================
- class Window_Steps < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement