Change windowskin in battle

Hi,

Can anyone make a script so I can change the windowskin in battles only?

So that I can use one windowskin for text and dialog and menus (basically overworld stuff) and another windowskin for battles.
Put this instead of Window_Base.
  1.  
  2. BATTLE_WINDOWSKIN = nil
  3.  
  4. #==============================================================================
  5. # ** Window_Base
  6. #------------------------------------------------------------------------------
  7. #  This class is for all in-game windows.
  8. #==============================================================================
  9.  
  10. class Window_Base < Window
  11.   #--------------------------------------------------------------------------
  12.   # * Object Initialization
  13.   #     x      : window x-coordinate
  14.   #     y      : window y-coordinate
  15.   #     width  : window width
  16.   #     height : window height
  17.   #--------------------------------------------------------------------------
  18.   def initialize(x, y, width, height)
  19.     super()
  20.     @windowskin_name = $game_system.windowskin_name
  21.     self.windowskin = RPG::Cache.windowskin(($scene.is_a?(Scene_Battle) and BATTLE_WINDOWSKIN) ? BATTLE_WINDOWSKIN : @windowskin_name)
  22.     self.x = x
  23.     self.y = y
  24.     self.width = width
  25.     self.height = height
  26.     self.z = 100
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # * Dispose
  30.   #--------------------------------------------------------------------------
  31.   def dispose
  32.     # Dispose if window contents bit map is set
  33.     if self.contents != nil
  34.       self.contents.dispose
  35.     end
  36.     super
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # * Get Text Color
  40.   #     n : text color number (0-7)
  41.   #--------------------------------------------------------------------------
  42.   def text_color(n)
  43.     case n
  44.     when 0
  45.       return Color.new(255, 255, 255, 255)
  46.     when 1
  47.       return Color.new(128, 128, 255, 255)
  48.     when 2
  49.       return Color.new(255, 128, 128, 255)
  50.     when 3
  51.       return Color.new(128, 255, 128, 255)
  52.     when 4
  53.       return Color.new(128, 255, 255, 255)
  54.     when 5
  55.       return Color.new(255, 128, 255, 255)
  56.     when 6
  57.       return Color.new(255, 255, 128, 255)
  58.     when 7
  59.       return Color.new(192, 192, 192, 255)
  60.     else
  61.       normal_color
  62.     end
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # * Get Normal Text Color
  66.   #--------------------------------------------------------------------------
  67.   def normal_color
  68.     return Color.new(255, 255, 255, 255)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # * Get Disabled Text Color
  72.   #--------------------------------------------------------------------------
  73.   def disabled_color
  74.     return Color.new(255, 255, 255, 128)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # * Get System Text Color
  78.   #--------------------------------------------------------------------------
  79.   def system_color
  80.     return Color.new(192, 224, 255, 255)
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # * Get Crisis Text Color
  84.   #--------------------------------------------------------------------------
  85.   def crisis_color
  86.     return Color.new(255, 255, 64, 255)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # * Get Knockout Text Color
  90.   #--------------------------------------------------------------------------
  91.   def knockout_color
  92.     return Color.new(255, 64, 0)
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * Frame Update
  96.   #--------------------------------------------------------------------------
  97.   def update
  98.     super
  99.     # Reset if windowskin was changed
  100.     if $game_system.windowskin_name != @windowskin_name
  101.       @windowskin_name = $game_system.windowskin_name
  102.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # * Draw Graphic
  107.   #     actor : actor
  108.   #     x     : draw spot x-coordinate
  109.   #     y     : draw spot y-coordinate
  110.   #--------------------------------------------------------------------------
  111.   def draw_actor_graphic(actor, x, y)
  112.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  113.     cw = bitmap.width / 4
  114.     ch = bitmap.height / 4
  115.     src_rect = Rect.new(0, 0, cw, ch)
  116.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # * Draw Name
  120.   #     actor : actor
  121.   #     x     : draw spot x-coordinate
  122.   #     y     : draw spot y-coordinate
  123.   #--------------------------------------------------------------------------
  124.   def draw_actor_name(actor, x, y)
  125.     self.contents.font.color = normal_color
  126.     self.contents.draw_text(x, y, 120, 32, actor.name)
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # * Draw Class
  130.   #     actor : actor
  131.   #     x     : draw spot x-coordinate
  132.   #     y     : draw spot y-coordinate
  133.   #--------------------------------------------------------------------------
  134.   def draw_actor_class(actor, x, y)
  135.     self.contents.font.color = normal_color
  136.     self.contents.draw_text(x, y, 236, 32, actor.class_name)
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # * Draw Level
  140.   #     actor : actor
  141.   #     x     : draw spot x-coordinate
  142.   #     y     : draw spot y-coordinate
  143.   #--------------------------------------------------------------------------
  144.   def draw_actor_level(actor, x, y)
  145.     self.contents.font.color = system_color
  146.     self.contents.draw_text(x, y, 32, 32, "Lv")
  147.     self.contents.font.color = normal_color
  148.     self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # * Make State Text String for Drawing
  152.   #     actor       : actor
  153.   #     width       : draw spot width
  154.   #     need_normal : Whether or not [normal] is needed (true / false)
  155.   #--------------------------------------------------------------------------
  156.   def make_battler_state_text(battler, width, need_normal)
  157.     # Get width of brackets
  158.     brackets_width = self.contents.text_size("[]").width
  159.     # Make text string for state names
  160.     text = ""
  161.     for i in battler.states
  162.       if $data_states[i].rating >= 1
  163.         if text == ""
  164.           text = $data_states[i].name
  165.         else
  166.           new_text = text + "/" + $data_states[i].name
  167.           text_width = self.contents.text_size(new_text).width
  168.           if text_width > width - brackets_width
  169.             break
  170.           end
  171.           text = new_text
  172.         end
  173.       end
  174.     end
  175.     # If text string for state names is empty, make it [normal]
  176.     if text == ""
  177.       if need_normal
  178.         text = "[Normal]"
  179.       end
  180.     else
  181.       # Attach brackets
  182.       text = "[" + text + "]"
  183.     end
  184.     # Return completed text string
  185.     return text
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # * Draw State
  189.   #     actor : actor
  190.   #     x     : draw spot x-coordinate
  191.   #     y     : draw spot y-coordinate
  192.   #     width : draw spot width
  193.   #--------------------------------------------------------------------------
  194.   def draw_actor_state(actor, x, y, width = 120)
  195.     text = make_battler_state_text(actor, width, true)
  196.     self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  197.     self.contents.draw_text(x, y, width, 32, text)
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # * Draw EXP
  201.   #     actor : actor
  202.   #     x     : draw spot x-coordinate
  203.   #     y     : draw spot y-coordinate
  204.   #--------------------------------------------------------------------------
  205.   def draw_actor_exp(actor, x, y)
  206.     self.contents.font.color = system_color
  207.     self.contents.draw_text(x, y, 24, 32, "E")
  208.     self.contents.font.color = normal_color
  209.     self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
  210.     self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
  211.     self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # * Draw HP
  215.   #     actor : actor
  216.   #     x     : draw spot x-coordinate
  217.   #     y     : draw spot y-coordinate
  218.   #     width : draw spot width
  219.   #--------------------------------------------------------------------------
  220.   def draw_actor_hp(actor, x, y, width = 144)
  221.     # Draw "HP" text string
  222.     self.contents.font.color = system_color
  223.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  224.     # Calculate if there is draw space for MaxHP
  225.     if width - 32 >= 108
  226.       hp_x = x + width - 108
  227.       flag = true
  228.     elsif width - 32 >= 48
  229.       hp_x = x + width - 48
  230.       flag = false
  231.     end
  232.     # Draw HP
  233.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  234.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  235.     self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  236.     # Draw MaxHP
  237.     if flag
  238.       self.contents.font.color = normal_color
  239.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  240.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Draw SP
  245.   #     actor : actor
  246.   #     x     : draw spot x-coordinate
  247.   #     y     : draw spot y-coordinate
  248.   #     width : draw spot width
  249.   #--------------------------------------------------------------------------
  250.   def draw_actor_sp(actor, x, y, width = 144)
  251.     # Draw "SP" text string
  252.     self.contents.font.color = system_color
  253.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  254.     # Calculate if there is draw space for MaxHP
  255.     if width - 32 >= 108
  256.       sp_x = x + width - 108
  257.       flag = true
  258.     elsif width - 32 >= 48
  259.       sp_x = x + width - 48
  260.       flag = false
  261.     end
  262.     # Draw SP
  263.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  264.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  265.     self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  266.     # Draw MaxSP
  267.     if flag
  268.       self.contents.font.color = normal_color
  269.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  270.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  271.     end
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # * Draw Parameter
  275.   #     actor : actor
  276.   #     x     : draw spot x-coordinate
  277.   #     y     : draw spot y-coordinate
  278.   #     type  : parameter type (0-6)
  279.   #--------------------------------------------------------------------------
  280.   def draw_actor_parameter(actor, x, y, type)
  281.     case type
  282.     when 0
  283.       parameter_name = $data_system.words.atk
  284.       parameter_value = actor.atk
  285.     when 1
  286.       parameter_name = $data_system.words.pdef
  287.       parameter_value = actor.pdef
  288.     when 2
  289.       parameter_name = $data_system.words.mdef
  290.       parameter_value = actor.mdef
  291.     when 3
  292.       parameter_name = $data_system.words.str
  293.       parameter_value = actor.str
  294.     when 4
  295.       parameter_name = $data_system.words.dex
  296.       parameter_value = actor.dex
  297.     when 5
  298.       parameter_name = $data_system.words.agi
  299.       parameter_value = actor.agi
  300.     when 6
  301.       parameter_name = $data_system.words.int
  302.       parameter_value = actor.int
  303.     end
  304.     self.contents.font.color = system_color
  305.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  306.     self.contents.font.color = normal_color
  307.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # * Draw Item Name
  311.   #     item : item
  312.   #     x    : draw spot x-coordinate
  313.   #     y    : draw spot y-coordinate
  314.   #--------------------------------------------------------------------------
  315.   def draw_item_name(item, x, y)
  316.     if item == nil
  317.       return
  318.     end
  319.     bitmap = RPG::Cache.icon(item.icon_name)
  320.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  321.     self.contents.font.color = normal_color
  322.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  323.   end
  324. end
  325.  
Expand to see the code.

Right at the top of the script, change nil to the name of the windowskin to use in battles in quotes.
Thanks!

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