Class changuing new command

Class changuing new command
Version:2
By: gerkrt/gerrtunk

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.


Screenshots

Image
Spanish version, testing in Doble Filo game.

Script

Get a more updated one here: http://usuarios.multimania.es/kisap/english_list.html

  1.  
  2. #==============================================================================
  3. # Class changuing new command
  4. # By gerkrt/gerrtunk
  5. # Version: 1.3
  6. # License: MIT, credits
  7. # Date: 22/01/2011
  8. # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
  9. # script check here: http://usuarios.multimania.es/kisap/english_list.html
  10. #==============================================================================
  11.  
  12. =begin
  13.  
  14. -----INTRODUCTION-----
  15.  
  16. This script adds a new command in battle and menu that functions to switch
  17. classes in menu or battle using skills. It also adds a simple class description
  18. window that is shown in the battle and menu.
  19. You can also configure font, vocabulary, and if you want to show sp or not.
  20.  
  21. -----INSTRUCTIONS-----
  22.  
  23. You have to define two basic things:
  24.  
  25. 1- What skills are class changuing skills. To do this you have to modify
  26. this method:
  27.  
  28.   #--------------------------------------------------------------------------
  29.   # * Class changing skills
  30.   #--------------------------------------------------------------------------
  31.   def self.cambia_clases(skill_id)
  32.     case skill_id
  33.       # If skill id 1--->  Return class 3
  34.       when 1; return 3
  35.       when 6; return 1
  36.       else; return 0
  37.     end
  38.   end
  39.  
  40. You can add any number of new lines like when 6; return 1. The syntax is:
  41.  
  42. skill id 1 changue to class 3
  43.  
  44. when 1; return 3
  45.  
  46. 2- You have to define class descriptions.
  47.   #--------------------------------------------------------------------------
  48.   # * Class descriptions
  49.   #--------------------------------------------------------------------------
  50.   def self.descripcion_clase(class_id)
  51.     case class_id
  52.     # Class id  1---------->  Returns description
  53.     when 3; return "Bonus \n ·Great aglity \n" +
  54.     " ·It consumes less sp" +
  55.      "\n Handicaps \n ·Bad for range attacks"
  56.       else; return "Error. The class dont exist"
  57.     end  
  58.   end
  59.  
  60. This is somewhat harder. Now the 3 is the class that you are defining and we
  61. are now creating a description for it.
  62.  
  63. You have to write the bonus and handicaps using two text marks. These marks
  64. tell the script that he is drawing bonus or handicaps so it can use one
  65. or other font color, for example.
  66.  
  67. The marks are defined in these variables:
  68.   Class_bonus = "Bonus \n"              
  69.   Class_handicaps = " Handicaps \n"        
  70.  
  71. Then you have to return a text that have class bonus after the bonus mark
  72. and class handicaps after the handicaps mark. So imagine that you want to write:
  73.  
  74. Bonus
  75.   ·Great aglity
  76.   ·It consumes less sp
  77. Handicaps
  78.   ·Bad for range attacks
  79.  
  80. You have to write in the return:
  81.  
  82. when 3; return "Bonus \n ·Great aglity \n" +
  83. " ·It consumes less sp" +
  84.  "\n Handicaps \n ·Bad for range attacks"
  85.  
  86. Also, else; return "Error. The class dont exist" These shows an error message when
  87. the class dont exist.
  88.  
  89. 3- Note that this script dont changue the classes for you. You have to create
  90. a common event for such skills to changue they and add the animation you want or
  91. whatever.
  92.  
  93. -----OTHER THINGS----
  94.  
  95. You can control de font size, color and bold for normal, bonus or handicap text.
  96. Set bold to false if you dont want it.
  97.  
  98. The hard thing to understand is the color. You have to set the values rgb + alpha.
  99.     Handicap_font_color = Color.new(r,g,b,a)
  100. Note that the handicap and bonus fonts are applied to the starting words Bonus
  101. and Handicaps only.
  102.  
  103. For last, you can set the command name that is the description of the command
  104. you are adding and if you turn off show_sp makig it = false it wont draw
  105. the class changuing skills sp.
  106.  
  107. ------SYNTAX AND TEXT FORMAT NOTES------
  108.  
  109. -Never erase the else in the methods.
  110. -You must respect the "" for the text
  111. -The spaces are also characters so you can use this to align better your text.
  112. Also the spaces are fixed in the mark workds, so, if you write them or the \n
  113. you will have to respect that.
  114. -The \n character means newline. It will draw the next text in a newline and you
  115. have to write \n for each line.
  116.  
  117. -Rpg Maker XP sucks for long lines so you have to understand this syntax of the +:
  118.         when 3; return "Bonus \n ·Great aglity \n" +
  119.         " ·It consumes less sp" +
  120.         "\n Handicaps \n ·Bad for range attacks"
  121. The + concatenates two or more phrases so they convert to one. The nice thing
  122. is that also after the + you can create a newline so its more organitzated.
  123.  
  124. Anyway you can do this like you want. You can also write these lines in a better
  125. editor and jst paste it here.
  126.  
  127. =end
  128.  
  129. module Wep
  130.   Command_name = "Special"
  131.   Show_sp = true
  132.   Class_bonus = "Bonus \n"              
  133.   Class_handicaps = " Handicaps \n"      
  134.  
  135.     # Bonus font
  136.     Bonus_font_bold = true
  137.     Bonus_font_size = 25
  138.     Bonus_font_color = Color.new(192, 224, 255, 255)
  139.     # Handicap font
  140.     Handicap_font_bold = true
  141.     Handicap_font_size = 25
  142.     Handicap_font_color = Color.new(255, 255, 64, 255)
  143.     # Normal font
  144.     Normal_font_bold = false
  145.     Normal_font_size = 25
  146.     Normal_font_color = Color.new(255,255,255,255)
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # * Class descriptions
  150.   #--------------------------------------------------------------------------
  151.   def self.descripcion_clase(class_id)
  152.     case class_id
  153.     # Class id  1---------->  Returns description
  154.         when 3; return "Bonus \n ·Great aglity \n" +
  155.         " ·It consumes less sp" +
  156.         "\n Handicaps \n ·Bad for range attacks"
  157.         else; return "Error. The class dont exist"
  158.     end  
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # * Class changing skills
  162.   #--------------------------------------------------------------------------
  163.   def self.cambia_clases(skill_id)
  164.     case skill_id
  165.       # If skill id 1--->  Return class 3
  166.       when 1; return 3
  167.       when 6; return 1
  168.       else; return 0
  169.     end
  170.   end
  171.  
  172. end
  173.  
  174. #==============================================================================
  175. # ** Window_OrbeRM
  176. #------------------------------------------------------------------------------
  177. #  Esta ventana muestra los OrbeRM a equipar
  178. #==============================================================================
  179.  
  180. class Window_OrbeRM < Window_Selectable
  181.   #--------------------------------------------------------------------------
  182.   # * Object Initialization
  183.   #     actor : personaje del cual estas examinando sus orbeRM
  184.   #--------------------------------------------------------------------------
  185.   def initialize(actor)
  186.     #     X  Y Amplitud Altura respectivamente. Valores para el menu principal.
  187.     super(0, 64, 270, 416)
  188.     @actor = actor
  189.     @column_max = 1
  190.     refresh
  191.     $scene.activar_descripcion(Wep.cambia_clases(skill.id))
  192.     self.index = 0
  193.     # Si esta en la batalla modifica la posicion, tamaño y transparencia.
  194.     if $game_temp.in_battle
  195.       # La mueve hacia arriva del todo.
  196.       self.y = 0
  197.       # Reduce su altura
  198.       self.height = 320
  199.       # Cambia la transparencia del fondo
  200.       self.back_opacity = 160
  201.     end
  202.   end
  203.  
  204.   #--------------------------------------------------------------------------
  205.   # * Acquiring Skill
  206.   #--------------------------------------------------------------------------
  207.   def skill
  208.     return @data[self.index]
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # * Frame Update
  212.   #--------------------------------------------------------------------------
  213.   def update
  214.     # Modifica la id de la clase a describir en la ventana de descripcion
  215.     $scene.activar_descripcion(Wep.cambia_clases(skill.id))
  216.    
  217.     # If cursor is movable
  218.     if self.active and @item_max > 0 and @index >= 0
  219.       # If pressing down on the directional buttons
  220.       if Input.repeat?(Input::DOWN)
  221.         # If column count is 1 and directional button was pressed down with no
  222.         # repeat, or if cursor position is more to the front than
  223.         # (item count - column count)
  224.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  225.            @index < @item_max - @column_max
  226.           # Move cursor down
  227.           $game_system.se_play($data_system.cursor_se)
  228.           @index = (@index + @column_max) % @item_max
  229.           $scene.refrescar_descripcion
  230.         end
  231.       end
  232.       # If the up directional button was pressed
  233.       if Input.repeat?(Input::UP)
  234.         # If column count is 1 and directional button was pressed up with no
  235.         # repeat, or if cursor position is more to the back than column count
  236.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  237.            @index >= @column_max
  238.           # Move cursor up
  239.           $game_system.se_play($data_system.cursor_se)
  240.           @index = (@index - @column_max + @item_max) % @item_max
  241.           # Refresca ventana para dibujar una unica vez la descripcion
  242.           $scene.refrescar_descripcion
  243.         end
  244.       end
  245.       # If the right directional button was pressed
  246.       if Input.repeat?(Input::RIGHT)
  247.         # If column count is 2 or more, and cursor position is closer to front
  248.         # than (item count -1)
  249.         if @column_max >= 2 and @index < @item_max - 1
  250.           # Move cursor right
  251.           $game_system.se_play($data_system.cursor_se)
  252.           @index += 1
  253.           # Refresca ventana para dibujar una unica vez la descripcion
  254.           $scene.refrescar_descripcion
  255.         end
  256.       end
  257.       # If the left directional button was pressed
  258.       if Input.repeat?(Input::LEFT)
  259.         # If column count is 2 or more, and cursor position is more back than 0
  260.         if @column_max >= 2 and @index > 0
  261.           # Move cursor left
  262.           $game_system.se_play($data_system.cursor_se)
  263.           @index -= 1
  264.           # Refresca ventana para dibujar una unica vez la descripcion
  265.           $scene.refrescar_descripcion
  266.         end
  267.       end
  268.       # If R button was pressed
  269.       if Input.repeat?(Input::R)
  270.         # If bottom row being displayed is more to front than bottom data row
  271.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  272.           # Move cursor 1 page back
  273.           $game_system.se_play($data_system.cursor_se)
  274.           @index = [@index + self.page_item_max, @item_max - 1].min
  275.           self.top_row += self.page_row_max
  276.           # Refresca ventana para dibujar una unica vez la descripcion
  277.           $scene.refrescar_descripcion
  278.         end
  279.       end
  280.       # If L button was pressed
  281.       if Input.repeat?(Input::L)
  282.         # If top row being displayed is more to back than 0
  283.         if self.top_row > 0
  284.           # Move cursor 1 page forward
  285.           $game_system.se_play($data_system.cursor_se)
  286.           @index = [@index - self.page_item_max, 0].max
  287.           self.top_row -= self.page_row_max
  288.           # Refresca ventana para dibujar una unica vez la descripcion
  289.           $scene.refrescar_descripcion
  290.         end
  291.       end
  292.     end
  293.     # Update cursor rectangle
  294.     update_cursor_rect
  295.   end
  296.  
  297.   #--------------------------------------------------------------------------
  298.   # * Refresh
  299.   #--------------------------------------------------------------------------
  300.   def refresh
  301.     if self.contents != nil
  302.       self.contents.dispose
  303.       self.contents = nil
  304.     end
  305.     @data = []
  306.     for i in [email hidden]
  307.       skill = $data_skills[@actor.skills[i]]
  308.        # Comprueva si la habilidad es cambia-clases
  309.           class_id = Wep.cambia_clases(skill.id)
  310.             if class_id != 0
  311.               if skill != nil
  312.                # Si lo es la añade al array de orbesRM
  313.                @data.push(skill)
  314.               end
  315.             end
  316.     end
  317.     # If item count is not 0, make a bit map and draw all items
  318.     @item_max = @data.size
  319.     if @item_max > 0
  320.       self.contents = Bitmap.new(width - 32, row_max * 32)
  321.       for i in 0...@item_max
  322.         draw_item(i)
  323.       end
  324.     end
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # * Draw Item
  328.   #     index : item number
  329.   #--------------------------------------------------------------------------
  330.   def draw_item(index)
  331.     skill = @data[index]
  332.     if @actor.skill_can_use?(skill.id)
  333.       self.contents.font.color = normal_color
  334.     else
  335.       self.contents.font.color = disabled_color
  336.     end
  337.     x = 4
  338.     y = index * 32
  339.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  340.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  341.     bitmap = RPG::Cache.icon(skill.icon_name)
  342.     opacity = self.contents.font.color == normal_color ? 255 : 128
  343.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  344.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  345.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2) if Wep::Show_sp
  346.  
  347.   end
  348. end
  349.  
  350. #==============================================================================
  351. # ** Window_DescripcionClase
  352. #------------------------------------------------------------------------------
  353. #  Esta ventana muestra informacion sobre la clase (OrbeRM)
  354. #==============================================================================
  355. class Window_DescripcionClase < Window_Base
  356.   attr_accessor :class_id
  357.   #--------------------------------------------------------------------------
  358.   # * Object Initialization
  359.   #--------------------------------------------------------------------------
  360.   def initialize
  361.     #     X   Y  Amplitud Altura respectivamente. Valores para el menu principal.
  362.     super(270, 64, 370, 416)
  363.     self.contents = Bitmap.new(width-32, height-32)
  364.     @class_id
  365.     @s1 = Wep::Class_bonus             # Palabra para la linea de ventajas
  366.     @s2 = Wep::Class_handicaps        # Palabra para la liea de desventajas
  367.     # Cuidado. El programa buscara exactamente la palabra que escribas.
  368.     # Esto incluye tanto espacios en blanco o el mismo caracter de saltar linea \n
  369.     self.z = 254
  370.     # Si esta en la batalla modifica la posicion, tamaño y transparencia.
  371.     if $game_temp.in_battle
  372.       # La situa arriva del todo
  373.       self.y = 0
  374.       # Reduce su altura
  375.       self.height = 320
  376.       # Cambia la transparencia del fondo
  377.       self.back_opacity = 160
  378.     end
  379.   end
  380.  
  381.   #--------------------------------------------------------------------------
  382.   # * comprovar_linea ( Comprueva si la linea es alguno de las palabras
  383.   #   definidas y cambia su estilo.)
  384.   #--------------------------------------------------------------------------
  385.   def comprovar_linea(linea)
  386.       # Si son bonificaciones
  387.       if linea == @s1
  388.             # Cambia los atributos de la fuente
  389.             self.contents.font.bold = Wep::Bonus_font_bold
  390.             self.contents.font.size = Wep::Bonus_font_size
  391.             self.contents.font.color = Wep::Bonus_font_color
  392.       # Si son handicaps
  393.       elsif linea == @s2
  394.             # Cambia los atributos de la fuente
  395.             self.contents.font.bold = Wep::Handicap_font_bold
  396.             self.contents.font.size = Wep::Handicap_font_size
  397.             self.contents.font.color = Wep::Handicap_font_color
  398.             # Si no se esta en batalla suma +2 al indice para dejar espacio entre los bloques
  399.             if not $game_temp.in_battle
  400.               @i+=2
  401.             end
  402.       # Si se ha cambiado algun atributo de la fuente
  403.       elsif self.contents.font.bold != false or self.contents.font.color != normal_color or self.contents.font.size !=  Font.default_size
  404.            # Revierte los cambios en la fuente para dibujarla normal
  405.             self.contents.font.bold = Wep::Normal_font_bold
  406.             self.contents.font.size = Wep::Normal_font_size
  407.             self.contents.font.color = Wep::Normal_font_color
  408.       end
  409.     end
  410.    
  411.   #--------------------------------------------------------------------------
  412.   # * Refresh
  413.   #--------------------------------------------------------------------------
  414.   def refresh
  415.     self.contents.clear
  416.     descripcion = Wep.descripcion_clase(@class_id)
  417.     @i = 0
  418.     # Dibuja las lineas segun el algoritmo
  419.     descripcion.each_line {|linea| comprovar_linea(linea) ;  self.contents.draw_text(0, 32*@i, self.contents.width, 32, linea) ;@i+=1 }
  420.   end
  421. end
  422.  
  423. #==============================================================================
  424. # ** Scene_Skill
  425. #------------------------------------------------------------------------------
  426. #  This class performs skill screen processing.
  427. #==============================================================================
  428.  
  429. class Scene_OrbeRM
  430.   #--------------------------------------------------------------------------
  431.   # * Object Initialization
  432.   #     actor_index : actor index
  433.   #--------------------------------------------------------------------------
  434.   def initialize(actor_index = 0, equip_index = 0)
  435.     @actor_index = actor_index
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # * Main Processing
  439.   #--------------------------------------------------------------------------
  440.   def main
  441.     # Get actor
  442.     @actor = $game_party.actors[@actor_index]
  443.     # Crea ventana de descripcion
  444.     @ventana_descripcion = Window_DescripcionClase.new
  445.     # Make help window, status window, and skill window
  446.     #@help_window = Window_Help.new
  447.     @status_window = Window_SkillStatus.new(@actor)
  448.     @status_window.y = 0
  449.     @skill_window = Window_OrbeRM.new(@actor)
  450.     @ventana_descripcion.refresh
  451.     # Associate help window
  452.     #@skill_window.help_window = @help_window
  453.     # Make target window (set to invisible / inactive)
  454.     @target_window = Window_Target.new
  455.     @target_window.visible = false
  456.     @target_window.active = false
  457.     # Execute transition
  458.     Graphics.transition
  459.     # Main loop
  460.     loop do
  461.       # Update game screen
  462.       Graphics.update
  463.       # Update input information
  464.       Input.update
  465.       # Frame update
  466.       update
  467.       # Abort loop if screen is changed
  468.       if $scene != self
  469.         break
  470.       end
  471.     end
  472.     # Prepare for transition
  473.     Graphics.freeze
  474.     # Dispose of windows
  475.     #@help_window.dispose
  476.     @status_window.dispose
  477.     @skill_window.dispose
  478.     @target_window.dispose
  479.     @ventana_descripcion.dispose
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # * Refrescar ventana descripcion optimizada
  483.   #--------------------------------------------------------------------------
  484.   def refrescar_descripcion
  485.     @ventana_descripcion.refresh
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # * Frame Update
  489.   #--------------------------------------------------------------------------
  490.   def update
  491.     # Update windows
  492.     #@help_window.update
  493.     @status_window.update
  494.     @skill_window.update
  495.     @target_window.update
  496.     # Si la ventana de descripcion esta visible, actualizarla.
  497.     if @ventana_descripcion.visible
  498.       @ventana_descripcion.update
  499.     end
  500.     # If skill window is active: call update_skill
  501.     if @skill_window.active
  502.       update_skill
  503.       return
  504.     end
  505.     # If skill target is active: call update_target
  506.     if @target_window.active
  507.       update_target
  508.       return
  509.     end
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # * Frame Update (if skill window is active)
  513.   #--------------------------------------------------------------------------
  514.   def update_skill
  515.     # If B button was pressed
  516.     if Input.trigger?(Input::B)
  517.       # Play cancel SE
  518.       $game_system.se_play($data_system.cancel_se)
  519.       # Switch to menu screen
  520.       $scene = Scene_Menu.new(1)
  521.       return
  522.     end
  523.     # If C button was pressed
  524.     if Input.trigger?(Input::C)
  525.       # Get currently selected data on the skill window
  526.       @skill = @skill_window.skill
  527.       # If unable to use
  528.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  529.         # Play buzzer SE
  530.         $game_system.se_play($data_system.buzzer_se)
  531.         return
  532.       end
  533.       # Play decision SE
  534.       $game_system.se_play($data_system.decision_se)
  535.       # If effect scope is ally
  536.       if @skill.scope >= 3
  537.         # Activate target window
  538.         @skill_window.active = false
  539.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  540.         @target_window.visible = true
  541.         @target_window.active = true
  542.         # Set cursor position to effect scope (single / all)
  543.         if @skill.scope == 4 || @skill.scope == 6
  544.           @target_window.index = -1
  545.         elsif @skill.scope == 7
  546.           @target_window.index = @actor_index - 10
  547.         else
  548.           @target_window.index = 0
  549.         end
  550.       # If effect scope is other than ally
  551.       else
  552.         # If common event ID is valid
  553.         if @skill.common_event_id > 0
  554.           # Common event call reservation
  555.           $game_temp.common_event_id = @skill.common_event_id
  556.           # Play use skill SE
  557.           $game_system.se_play(@skill.menu_se)
  558.           # Use up SP
  559.           @actor.sp -= @skill.sp_cost
  560.           # Remake each window content
  561.           @status_window.refresh
  562.           @skill_window.refresh
  563.           @target_window.refresh
  564.           # Switch to map screen
  565.           $scene = Scene_Map.new
  566.           return
  567.         end
  568.       end
  569.       return
  570.     end
  571.     # If R button was pressed
  572.     if Input.trigger?(Input::R)
  573.       # Play cursor SE
  574.       $game_system.se_play($data_system.cursor_se)
  575.       # To next actor
  576.       @actor_index += 1
  577.       @actor_index %= $game_party.actors.size
  578.       # Switch to different skill screen
  579.       $scene = Scene_Skill.new(@actor_index)
  580.       return
  581.     end
  582.     # If L button was pressed
  583.     if Input.trigger?(Input::L)
  584.       # Play cursor SE
  585.       $game_system.se_play($data_system.cursor_se)
  586.       # To previous actor
  587.       @actor_index += $game_party.actors.size - 1
  588.       @actor_index %= $game_party.actors.size
  589.       # Switch to different skill screen
  590.       $scene = Scene_Skill.new(@actor_index)
  591.       return
  592.     end
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # * Activar descripcion
  596.   # Modifica la id de la clase a describir en la ventana de descripcion
  597.   #--------------------------------------------------------------------------
  598.   def activar_descripcion(class_id)
  599.     @ventana_descripcion.class_id = class_id
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # * Frame Update (when target window is active)
  603.   #--------------------------------------------------------------------------
  604.   def update_target
  605.     # If B button was pressed
  606.     if Input.trigger?(Input::B)
  607.       # Play cancel SE
  608.       $game_system.se_play($data_system.cancel_se)
  609.       # Erase target window
  610.       @skill_window.active = true
  611.       @target_window.visible = false
  612.       @target_window.active = false
  613.       return
  614.     end
  615.     # If C button was pressed
  616.     if Input.trigger?(Input::C)
  617.       # If unable to use because SP ran out
  618.       unless @actor.skill_can_use?(@skill.id)
  619.         # Play buzzer SE
  620.         $game_system.se_play($data_system.buzzer_se)
  621.         return
  622.       end
  623.       # If target is all
  624.       if @target_window.index == -1
  625.         # Apply skill use effects to entire party
  626.         used = false
  627.         for i in $game_party.actors
  628.           used |= i.skill_effect(@actor, @skill)
  629.         end
  630.       end
  631.       # If target is user
  632.       if @target_window.index <= -2
  633.         # Apply skill use effects to target actor
  634.         target = $game_party.actors[@target_window.index + 10]
  635.         used = target.skill_effect(@actor, @skill)
  636.       end
  637.       # If single target
  638.       if @target_window.index >= 0
  639.         # Apply skill use effects to target actor
  640.         target = $game_party.actors[@target_window.index]
  641.         used = target.skill_effect(@actor, @skill)
  642.       end
  643.       # If skill was used
  644.       if used
  645.         # Play skill use SE
  646.         $game_system.se_play(@skill.menu_se)
  647.         # Use up SP
  648.         @actor.sp -= @skill.sp_cost
  649.         # Remake each window content
  650.         @status_window.refresh
  651.         @skill_window.refresh
  652.         @target_window.refresh
  653.         # If entire party is dead
  654.         if $game_party.all_dead?
  655.           # Switch to game over screen
  656.           $scene = Scene_Gameover.new
  657.           return
  658.         end
  659.         # If command event ID is valid
  660.         if @skill.common_event_id > 0
  661.           # Command event call reservation
  662.           $game_temp.common_event_id = @skill.common_event_id
  663.           # Switch to map screen
  664.           $scene = Scene_Map.new
  665.           return
  666.         end
  667.       end
  668.       # If skill wasn't used
  669.       unless used
  670.         # Play buzzer SE
  671.         $game_system.se_play($data_system.buzzer_se)
  672.       end
  673.       return
  674.     end
  675.   end
  676. end
  677.  
  678. #==============================================================================
  679. # ** Scene_Battle (part 3)
  680. #------------------------------------------------------------------------------
  681. #  This class performs battle screen processing.
  682. #==============================================================================
  683.  
  684. class Scene_Battle
  685.  
  686.   #--------------------------------------------------------------------------
  687.   # * Frame Update (actor command phase)
  688.   #--------------------------------------------------------------------------
  689.   def update_phase3
  690.     # If enemy arrow is enabled
  691.     if @enemy_arrow != nil
  692.       update_phase3_enemy_select
  693.     # If actor arrow is enabled
  694.     elsif @actor_arrow != nil
  695.       update_phase3_actor_select
  696.     # If skill window is enabled
  697.     elsif @skill_window != nil
  698.       update_phase3_skill_select
  699.     # If orbeRM window is enabled
  700.     elsif @orberm_window != nil
  701.       update_phase3_orberm_select
  702.     # If item window is enabled
  703.     elsif @item_window != nil
  704.       update_phase3_item_select
  705.     # If actor command window is enabled
  706.     elsif @actor_command_window.active
  707.       update_phase3_basic_command
  708.     end
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------
  712.   # * Frame Update (actor command phase : orbeRM selection)
  713.   #--------------------------------------------------------------------------
  714.   def update_phase3_orberm_select
  715.     # Make OrbeRM window visible
  716.     @orberm_window.visible = true
  717.     # Update OrbeRM window
  718.     @orberm_window.update
  719.     # If B button was pressed
  720.     if Input.trigger?(Input::B)
  721.       # Play cancel SE
  722.       $game_system.se_play($data_system.cancel_se)
  723.       # End skill selection
  724.       end_orberm_select
  725.       return
  726.     end
  727.     # If C button was pressed
  728.     if Input.trigger?(Input::C)
  729.       # Get currently selected data on the orbeRM window
  730.       @orberm = @orberm_window.skill
  731.       # If it can't be used
  732.       if @orberm == nil or not @active_battler.skill_can_use?(@orberm.id)
  733.         # Play buzzer SE
  734.         $game_system.se_play($data_system.buzzer_se)
  735.         return
  736.       end
  737.       # Play decision SE
  738.       $game_system.se_play($data_system.decision_se)
  739.       # Set action            ##################################33333 IMP !!!!!
  740.       @active_battler.current_action.skill_id = @orberm.id
  741.       # Make skill window invisible
  742.       @orberm_window.visible = false
  743.       # If effect scope is single enemy
  744.       if @orberm.scope == 1
  745.         # Start enemy selection
  746.         start_enemy_select
  747.       # If effect scope is single ally
  748.       elsif @orberm.scope == 3 or @orberm.scope == 5
  749.         # Start actor selection
  750.         start_actor_select
  751.       # If effect scope is not single
  752.       else
  753.         # End skill selection
  754.         end_orberm_select
  755.         # Go to command input for next actor
  756.         phase3_next_actor
  757.       end
  758.       return
  759.     end
  760.   end
  761.  
  762.   #--------------------------------------------------------------------------
  763.   # * Start OrbeRM Selection
  764.   #--------------------------------------------------------------------------
  765.   def start_orberm_select
  766.     # Crea ventana de descripcion
  767.     @ventana_descripcion = Window_DescripcionClase.new
  768.     # Make OrbeRM window
  769.     @orberm_window = Window_OrbeRM.new(@active_battler)
  770.     refrescar_descripcion
  771.     # Desactiva temporalmente ventana de ayuda
  772.     @help_window.visible = false
  773.     # Disable actor command window
  774.     @actor_command_window.active = false
  775.     @actor_command_window.visible = false
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # * End OrbeRM selection
  779.   #--------------------------------------------------------------------------
  780.   def end_orberm_select
  781.     # Dispose of orbeRM window
  782.     @orberm_window.dispose
  783.     @ventana_descripcion.dispose
  784.     @orberm_window = nil
  785.     @ventana_descripcion = nil
  786.     # Hide help window
  787.     @help_window.visible = false
  788.     # Enable actor command window
  789.     @actor_command_window.active = true
  790.     @actor_command_window.visible = true
  791.   end
  792. end
  793.  
  794. #==============================================================================
  795. # ** Scene_Battle (part 1)
  796. #------------------------------------------------------------------------------
  797. #  This class performs battle screen processing.
  798. #==============================================================================
  799.  
  800. class Scene_Battle
  801.   #--------------------------------------------------------------------------
  802.   # * Main Processing
  803.   #--------------------------------------------------------------------------
  804.   def main
  805.     # Initialize each kind of temporary battle data
  806.     $game_temp.in_battle = true
  807.     $game_temp.battle_turn = 0
  808.     $game_temp.battle_event_flags.clear
  809.     $game_temp.battle_abort = false
  810.     $game_temp.battle_main_phase = false
  811.     $game_temp.battleback_name = $game_map.battleback_name
  812.     $game_temp.forcing_battler = nil
  813.     # Initialize battle event interpreter
  814.     $game_system.battle_interpreter.setup(nil, 0)
  815.     # Prepare troop
  816.     @troop_id = $game_temp.battle_troop_id
  817.     $game_troop.setup(@troop_id)
  818.     # Make actor command window
  819.     s1 = $data_system.words.attack
  820.     s2 = $data_system.words.skill
  821.     s3 = Wep::Command_name
  822.     s4 = $data_system.words.guard
  823.     s5 = $data_system.words.item
  824.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
  825.     @actor_command_window.y = 128
  826.     @actor_command_window.back_opacity = 160
  827.     @actor_command_window.active = false
  828.     @actor_command_window.visible = false
  829.     # Make other windows
  830.     @party_command_window = Window_PartyCommand.new
  831.     @help_window = Window_Help.new
  832.     @help_window.back_opacity = 160
  833.     @help_window.visible = false
  834.     @status_window = Window_BattleStatus.new
  835.     @message_window = Window_Message.new
  836.     # Crea ventana de descripcion
  837.     # @ventana_descripcion = Window_DescripcionClase.new(x=320, y=128, amplitud=320, altura=352)
  838.     # @ventana_descripcion.visible = false
  839.     # Make sprite set
  840.     @spriteset = Spriteset_Battle.new
  841.     # Initialize wait count
  842.     @wait_count = 0
  843.     # Execute transition
  844.     if $data_system.battle_transition == ""
  845.       Graphics.transition(20)
  846.     else
  847.       Graphics.transition(40, "Graphics/Transitions/" +
  848.         $data_system.battle_transition)
  849.     end
  850.     # Start pre-battle phase
  851.     start_phase1
  852.     # Main loop
  853.     loop do
  854.       # Update game screen
  855.       Graphics.update
  856.       # Update input information
  857.       Input.update
  858.       # Frame update
  859.       update
  860.       # Abort loop if screen is changed
  861.       if $scene != self
  862.         break
  863.       end
  864.     end
  865.     # Refresh map
  866.     $game_map.refresh
  867.     # Prepare for transition
  868.     Graphics.freeze
  869.     # Dispose of windows
  870.     @actor_command_window.dispose
  871.     @party_command_window.dispose
  872.     @help_window.dispose
  873.     @status_window.dispose
  874.     @message_window.dispose
  875.     if @skill_window != nil
  876.       @skill_window.dispose
  877.     end
  878.     if @orberm_window != nil
  879.       @orberm.dispose
  880.     end
  881.     if @ventana_descripcion != nil
  882.       @ventana_descripcion.dispose
  883.     end
  884.     if @item_window != nil
  885.       @item_window.dispose
  886.     end
  887.     if @result_window != nil
  888.       @result_window.dispose
  889.     end
  890.     # Dispose of sprite set
  891.     @spriteset.dispose
  892.     # If switching to title screen
  893.     if $scene.is_a?(Scene_Title)
  894.       # Fade out screen
  895.       Graphics.transition
  896.       Graphics.freeze
  897.     end
  898.     # If switching from battle test to any screen other than game over screen
  899.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  900.       $scene = nil
  901.     end
  902.   end
  903.  
  904.   #--------------------------------------------------------------------------
  905.   # * Activar descripcion
  906.   # Modifica la id de la clase a describir en la ventana de descripcion
  907.   #--------------------------------------------------------------------------
  908.   def activar_descripcion(class_id)
  909.     @ventana_descripcion.class_id = class_id
  910.   end
  911.   #--------------------------------------------------------------------------
  912.   # * Refrescar ventana descripcion optimizada
  913.   #--------------------------------------------------------------------------
  914.   def refrescar_descripcion
  915.     @ventana_descripcion.refresh
  916.   end
  917.   #--------------------------------------------------------------------------
  918.   # * Frame Update
  919.   #--------------------------------------------------------------------------
  920.   def update
  921.     # If battle event is running
  922.     if $game_system.battle_interpreter.running?
  923.       # Update interpreter
  924.       $game_system.battle_interpreter.update
  925.       # If a battler which is forcing actions doesn't exist
  926.       if $game_temp.forcing_battler == nil
  927.         # If battle event has finished running
  928.         unless $game_system.battle_interpreter.running?
  929.           # Rerun battle event set up if battle continues
  930.           unless judge
  931.             setup_battle_event
  932.           end
  933.         end
  934.         # If not after battle phase
  935.         if @phase != 5
  936.           # Refresh status window
  937.           @status_window.refresh
  938.         end
  939.       end
  940.     end
  941.     # Update system (timer) and screen
  942.     $game_system.update
  943.     $game_screen.update
  944.     # If timer has reached 0
  945.     if $game_system.timer_working and $game_system.timer == 0
  946.       # Abort battle
  947.       $game_temp.battle_abort = true
  948.     end
  949.     # Update windows
  950.     @help_window.update
  951.     @party_command_window.update
  952.     @actor_command_window.update
  953.     @status_window.update
  954.     @message_window.update
  955.     if @ventana_descripcion != nil
  956.       @ventana_descripcion.update
  957.     end
  958.     # Update sprite set
  959.     @spriteset.update
  960.     # If transition is processing
  961.     if $game_temp.transition_processing
  962.       # Clear transition processing flag
  963.       $game_temp.transition_processing = false
  964.       # Execute transition
  965.       if $game_temp.transition_name == ""
  966.         Graphics.transition(20)
  967.       else
  968.         Graphics.transition(40, "Graphics/Transitions/" +
  969.           $game_temp.transition_name)
  970.       end
  971.     end
  972.     # If message window is showing
  973.     if $game_temp.message_window_showing
  974.       return
  975.     end
  976.     # If effect is showing
  977.     if @spriteset.effect?
  978.       return
  979.     end
  980.     # If game over
  981.     if $game_temp.gameover
  982.       # Switch to game over screen
  983.       $scene = Scene_Gameover.new
  984.       return
  985.     end
  986.     # If returning to title screen
  987.     if $game_temp.to_title
  988.       # Switch to title screen
  989.       $scene = Scene_Title.new
  990.       return
  991.     end
  992.     # If battle is aborted
  993.     if $game_temp.battle_abort
  994.       # Return to BGM used before battle started
  995.       $game_system.bgm_play($game_temp.map_bgm)
  996.       # Battle ends
  997.       battle_end(1)
  998.       return
  999.     end
  1000.     # If waiting
  1001.     if @wait_count > 0
  1002.       # Decrease wait count
  1003.       @wait_count -= 1
  1004.       return
  1005.     end
  1006.     # If battler forcing an action doesn't exist,
  1007.     # and battle event is running
  1008.     if $game_temp.forcing_battler == nil and
  1009.        $game_system.battle_interpreter.running?
  1010.       return
  1011.     end
  1012.     # Branch according to phase
  1013.     case @phase
  1014.     when 1  # pre-battle phase
  1015.       update_phase1
  1016.     when 2  # party command phase
  1017.       update_phase2
  1018.     when 3  # actor command phase
  1019.       update_phase3
  1020.     when 4  # main phase
  1021.       update_phase4
  1022.     when 5  # after battle phase
  1023.       update_phase5
  1024.     end
  1025.   end
  1026. end
  1027.  
  1028. #==============================================================================
  1029. # ** Window_Skill
  1030. #------------------------------------------------------------------------------
  1031. #  This window displays usable skills on the skill and battle screens.
  1032. #==============================================================================
  1033.  
  1034. class Window_Skill < Window_Selectable
  1035.  
  1036.   #--------------------------------------------------------------------------
  1037.   # * Refresh
  1038.   #--------------------------------------------------------------------------
  1039.   def refresh
  1040.     if self.contents != nil
  1041.       self.contents.dispose
  1042.       self.contents = nil
  1043.     end
  1044.     @data = []
  1045.     for i in [email hidden]
  1046.       skill = $data_skills[@actor.skills[i]]
  1047.        # Comprueva que la habilidad no sea cambia-clases
  1048.           class_id = Wep.cambia_clases(skill.id)
  1049.             if class_id == 0
  1050.               # Añade las habilidades no cambia-clases
  1051.                 if skill != nil
  1052.                   @data.push(skill)
  1053.                 end
  1054.             end
  1055.  
  1056.     end
  1057.     # If item count is not 0, make a bit map and draw all items
  1058.     @item_max = @data.size
  1059.     if @item_max > 0
  1060.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1061.       for i in 0...@item_max
  1062.         draw_item(i)
  1063.       end
  1064.     end
  1065.   end
  1066. end
  1067.  
  1068. #==============================================================================
  1069. # ** Scene_Menu
  1070. #------------------------------------------------------------------------------
  1071. #  This class performs menu screen processing.
  1072. #==============================================================================
  1073. # ** Scene_Menu
  1074. #------------------------------------------------------------------------------
  1075. #  This class performs menu screen processing.
  1076. #==============================================================================
  1077. class Scene_Menu
  1078. #==============================================================================
  1079. # ** Scene_Menu
  1080. #------------------------------------------------------------------------------
  1081. #  This class performs menu screen processing.
  1082. #==============================================================================
  1083.   #--------------------------------------------------------------------------
  1084.   # * Main Processing
  1085.   #--------------------------------------------------------------------------
  1086.   def main
  1087.     # Make command window
  1088.     s1 = $data_system.words.item
  1089.     s2 = $data_system.words.skill
  1090.     s3 = $data_system.words.equip
  1091.     s4 = "Status"
  1092.     s5 = Wep::Command_name
  1093.     s6 = "Save"
  1094.     s7 = "Exit"
  1095.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  1096.     @command_window.index = @menu_index
  1097.     # If number of party members is 0
  1098.     if $game_party.actors.size == 0
  1099.       # Disable items, skills, equipment, and status
  1100.       @command_window.disable_item(0)
  1101.       @command_window.disable_item(1)
  1102.       @command_window.disable_item(2)
  1103.       @command_window.disable_item(3)
  1104.     end
  1105.     # If save is forbidden
  1106.     if $game_system.save_disabled
  1107.       # Disable save
  1108.       @command_window.disable_item(5)
  1109.     end
  1110.     # Make play time window
  1111.     @playtime_window = Window_PlayTime.new
  1112.     @playtime_window.x = 0
  1113.     @playtime_window.y = 256
  1114.     # Make steps window
  1115.     @steps_window = Window_Steps.new
  1116.     @steps_window.x = 0
  1117.     @steps_window.y = 352
  1118.     # Make gold window
  1119.     @gold_window = Window_Gold.new
  1120.     @gold_window.x = 0
  1121.     @gold_window.y = 416
  1122.     # Make status window
  1123.     @status_window = Window_MenuStatus.new
  1124.     @status_window.x = 160
  1125.     @status_window.y = 0
  1126.     # Execute transition
  1127.     Graphics.transition
  1128.     # Main loop
  1129.     loop do
  1130.       # Update game screen
  1131.       Graphics.update
  1132.       # Update input information
  1133.       Input.update
  1134.       # Frame update
  1135.       update
  1136.       # Abort loop if screen is changed
  1137.       if $scene != self
  1138.         break
  1139.       end
  1140.     end
  1141.     # Prepare for transition
  1142.     Graphics.freeze
  1143.     # Dispose of windows
  1144.     @command_window.dispose
  1145.     @playtime_window.dispose
  1146.     @steps_window.dispose
  1147.     @gold_window.dispose
  1148.     @status_window.dispose
  1149.   end
  1150.   #--------------------------------------------------------------------------
  1151.   # * Frame Update (when command window is active)
  1152.   #--------------------------------------------------------------------------
  1153.   def update_command
  1154.     # If B button was pressed
  1155.     if Input.trigger?(Input::B)
  1156.       # Play cancel SE
  1157.       $game_system.se_play($data_system.cancel_se)
  1158.       # Switch to map screen
  1159.       $scene = Scene_Map.new
  1160.       return
  1161.     end
  1162.     # If C button was pressed
  1163.     if Input.trigger?(Input::C)
  1164.       # If command other than save or end game, and party members = 0
  1165.       if $game_party.actors.size == 0 and @command_window.index < 4
  1166.         # Play buzzer SE
  1167.         $game_system.se_play($data_system.buzzer_se)
  1168.         return
  1169.       end
  1170.       # Branch by command window cursor position
  1171.       case @command_window.index
  1172.       when 0  # item
  1173.         # Play decision SE
  1174.         $game_system.se_play($data_system.decision_se)
  1175.         # Switch to item screen
  1176.         $scene = Scene_Item.new
  1177.       when 1  # skill
  1178.         # Play decision SE
  1179.         $game_system.se_play($data_system.decision_se)
  1180.         # Make status window active
  1181.         @command_window.active = false
  1182.         @status_window.active = true
  1183.         @status_window.index = 0
  1184.       when 2  # equipment
  1185.         # Play decision SE
  1186.         $game_system.se_play($data_system.decision_se)
  1187.         # Make status window active
  1188.         @command_window.active = false
  1189.         @status_window.active = true
  1190.         @status_window.index = 0
  1191.       when 3  # status
  1192.         # Play decision SE
  1193.         $game_system.se_play($data_system.decision_se)
  1194.         # Make status window active
  1195.         @command_window.active = false
  1196.         @status_window.active = true
  1197.         @status_window.index = 0
  1198.       when 4  # newCommand
  1199.         # Play decision SE
  1200.         $game_system.se_play($data_system.decision_se)
  1201.         # Make status window active
  1202.         @command_window.active = false
  1203.         @status_window.active = true
  1204.         @status_window.index = 0
  1205.       when 5  # save
  1206.         # If saving is forbidden
  1207.         if $game_system.save_disabled
  1208.           # Play buzzer SE
  1209.           $game_system.se_play($data_system.buzzer_se)
  1210.           return
  1211.         end
  1212.         # Play decision SE
  1213.         $game_system.se_play($data_system.decision_se)
  1214.         # Switch to save screen
  1215.         $scene = Scene_Save.new
  1216.       when 6  # end game
  1217.         # Play decision SE
  1218.         $game_system.se_play($data_system.decision_se)
  1219.         # Switch to end game screen
  1220.         $scene = Scene_End.new
  1221.       end
  1222.       return
  1223.     end
  1224.   end
  1225.   #--------------------------------------------------------------------------
  1226.   # * Frame Update (when status window is active)
  1227.   #--------------------------------------------------------------------------
  1228.   def update_status
  1229.     # If B button was pressed
  1230.     if Input.trigger?(Input::B)
  1231.       # Play cancel SE
  1232.       $game_system.se_play($data_system.cancel_se)
  1233.       # Make command window active
  1234.       @command_window.active = true
  1235.       @status_window.active = false
  1236.       @status_window.index = -1
  1237.       return
  1238.     end
  1239.     # If C button was pressed
  1240.     if Input.trigger?(Input::C)
  1241.       # Branch by command window cursor position
  1242.       case @command_window.index
  1243.       when 1  # skill
  1244.         # If this actor's action limit is 2 or more
  1245.         if $game_party.actors[@status_window.index].restriction >= 2
  1246.           # Play buzzer SE
  1247.           $game_system.se_play($data_system.buzzer_se)
  1248.           return
  1249.         end
  1250.         # Play decision SE
  1251.         $game_system.se_play($data_system.decision_se)
  1252.         # Switch to skill screen
  1253.         $scene = Scene_Skill.new(@status_window.index)
  1254.       when 2  # equipment
  1255.         # Play decision SE
  1256.         $game_system.se_play($data_system.decision_se)
  1257.         # Switch to equipment screen
  1258.         $scene = Scene_Equip.new(@status_window.index)
  1259.       when 3  # status
  1260.         # Play decision SE
  1261.         $game_system.se_play($data_system.decision_se)
  1262.         # Switch to status screen
  1263.         $scene = Scene_Status.new(@status_window.index)
  1264.       when 4  # newCommand
  1265.         # If this actor's action limit is 2 or more
  1266.         if $game_party.actors[@status_window.index].restriction >= 2
  1267.           # Play buzzer SE
  1268.           $game_system.se_play($data_system.buzzer_se)
  1269.           return
  1270.         end
  1271.         # Play decision SE
  1272.         $game_system.se_play($data_system.decision_se)
  1273.         # Canvia a la escena de OrbeRM
  1274.         $scene = Scene_OrbeRM.new(@status_window.index)
  1275.       return
  1276.       end    
  1277.     end
  1278.   end
  1279. end
  1280.  
  1281. #==============================================================================
  1282. # ** Window_Steps
  1283. #------------------------------------------------------------------------------
  1284. #  This window displays step count on the menu screen.
  1285. #==============================================================================
  1286.  
  1287. class Window_Steps < Window_Base
  1288.   #--------------------------------------------------------------------------
  1289.   # * Object Initialization
  1290.   #--------------------------------------------------------------------------
  1291.   def initialize
  1292.     super(0, 0, 160, 64)
  1293.     self.contents = Bitmap.new(width - 32, height - 32)
  1294.     refresh
  1295.   end
  1296. end
  1297.  
Expand to see the code.



Instructions

Nothing special. Just insert it before main.

Authors notes

All my scripts are in development and im open to suggestions, critics, bugs, etc.



pd: yes, 4 scripts released in one day! i have the record? XDDDDDDDDD

tomorrow two more, im quitting of scripting and im terminating all the scripts that i had started...

im not going to stop programing but releasing updates or new scripts, on now i will be 100% with my projects. Im not translating they to spanish anymore, also...(bfff...)

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=73527