Jump to content
Sign in to follow this  
minth

[SOLVED] Battle Window Script

Recommended Posts

Posted (edited)

Good evening, you all.

I am working in a Battle Window script and it's almost completed. But I have a problem, I want make a movable Actor Command window.

Like that:.

Spoiler

 

Although I have the video's script, it doesn't worked. Here the script:.

Spoiler

LNX 11 XP Style Script.txt

(I put the script in txt format, because it has +5000 lines).

After that, I also tried to use Moghunter's script, but I failed...

Here the script:.

 

Then, can you guys help me with my script? Because, I tried to modify my script countless times, but it isn't working...

Here my script (I am modifying Ventwig's script):.

Spoiler

#===============================================================================
# * Nova Battle Display VTS
#-------------------------------------------------------------------------------
# By Ventwig (changed by minth)
# Version 1.05 - January 1 2012
# For RPGMaker VX Ace
#===============================================================================
# * Description:
#-------------------------------------------------------------------------------
# This script changes the display in-battle.
# The command windows are changed to a horizontal display, while faces and
# bars are displayed to the left. When that actor is selected, their bars
# grow, so you know where you're looking! The skill selection window
# is edited, too. See for yourself!
#===============================================================================
# * Compatability:
#-------------------------------------------------------------------------------
# Probably highly incompatible with things because of the amount of
# things I re-wrote in the battle scene. Ask me for compatability patches!
# Works with Jet's Sideview/efeberk's behind-view patch
# Works with Neo Gauge Ultimate Ace
#===============================================================================
# * Instructions: Put in materials, above main. Almost Plug and Play
#===============================================================================
# Please give Credit to Ventwig if you would like to use one of my scripts!
# Use it commericial or non-commercial, and feel free to tell me if you're using
# it commercially!
# You may edit my scripts, just don't claim as your own!
#===============================================================================
# * NOTES:
#-------------------------------------------------------------------------------
# Recommended with Jet's Simple Sideview "Behind View" patch by efeberk
# The overall effect together is simple and amazing in my opinion.
# These are my recommended settings:
#   FIELD_POS = [175, 350]
#   FIELD_SPACING = [80, 0]
#===============================================================================
# * My notes (minth):
#-------------------------------------------------------------------------------
# This script is working in the 640x480 resolution. If you need, change the
# script's configurations.
# Thanks to Traverse for Battle Layout
#===============================================================================
# * Customization:
#-------------------------------------------------------------------------------
module NEOBT_VTS
  #This is probably the biggest customization option.
  #Determines whether or not TP bars will be drawn. T/F
  USE_TP = true
end
#===============================================================================
# NO TOUCHEY! DA REST IS MAIIIIIIIIIIIIIIIIIIINNNEEEEE!
#=============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Get Maximum Number of Battle Members
  #--------------------------------------------------------------------------
  def max_battle_members
    return 4
  end
end
 
 
class Window_BattleStatus < Window_Selectable  
  #--------------------------------------------------------------------------
  # * Starts Up The Window
  #--------------------------------------------------------------------------
  def initialize
    #Draws window (character)
    super(0,0,670,540)
    self.z = 0
    self.opacity = 0 #(invisible)
    @x, @y = 0, 390 #(character)
    @party_size = $game_party.all_members.size
    battle_hud
    @long_index = self.index
    self.openness = 0 #auto opening
  end
  #--------------------------------------------------------------------------
  # * Draws The HUD
  #--------------------------------------------------------------------------
  def battle_hud
    if $game_party.all_members.size >0
      @actor = $game_party.members[0]
      @actor_hp = @actor.hp
      @actor_mp = @actor.mp
      @actor_tp = @actor.tp
      draw_actor_face(@actor, @x+20, @y-10, enabled = true)
      draw_actor_icons(@actor, @x+25, @y-10+10)
      if self.index == 0
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor, @x+90, @y-10+0,80)
        end
        draw_actor_hp(@actor, @x+20, @y-10+65,150)
        draw_actor_mp(@actor, @x+20, @y-10+80,150)
      else
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor, @x+90, @y-10+0,50)
        end
        draw_actor_hp(@actor, @x+20, @y-10+65)
        draw_actor_mp(@actor, @x+20, @y-10+80)
      end
    end
    if $game_party.all_members.size >1
      @actor2 = $game_party.members[1]
      @actor2_hp = @actor2.hp
      @actor2_mp = @actor2.mp
      @actor2_tp = @actor2.tp
      draw_actor_face(@actor2, @x+10+160, @y-10, enabled = true)
      draw_actor_icons(@actor2, @x+15+160, @y-10)
      if self.index == 1
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor2, @x+80+160, @y-10+0,80)
        end
        draw_actor_hp(@actor2, @x+20+150, @y-10+65,150)
        draw_actor_mp(@actor2, @x+20+150, @y-10+80,150)
      else
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor2, @x+80+160, @y-10+0,50)
        end
        draw_actor_hp(@actor2, @x+20+150, @y-10+65)
        draw_actor_mp(@actor2, @x+20+150, @y-10+80)
      end
    end
    if $game_party.all_members.size >2
      @actor3 = $game_party.members[2]
      @actor3_hp = @actor3.hp
      @actor3_mp = @actor3.mp
      @actor3_tp = @actor3.tp
      draw_actor_face(@actor3, @x+10+310, @y-10, enabled = true)
      draw_actor_icons(@actor3, @x+15+310, @y-10+10)
      if self.index == 2
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor3, @x+80+310, @y-10+0,80)
        end
        draw_actor_hp(@actor3, @x+20+300, @y-10+65,150)
        draw_actor_mp(@actor3, @x+20+300, @y-10+80,150)
      else
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor3, @x+80+310, @y-10+0,50)
        end
        draw_actor_hp(@actor3, @x+20+300, @y-10+65)
        draw_actor_mp(@actor3, @x+20+300, @y-10+80)
      end
    end
    if $game_party.all_members.size >3
      @actor4 = $game_party.members[3]
      @actor4_hp = @actor4.hp
      @actor4_mp = @actor4.mp
      @actor4_tp = @actor4.tp
      draw_actor_face(@actor4, @x+10+460, @y-10, enabled = true)
      draw_actor_icons(@actor4, @x+10+460, @y-10+10)
      if self.index == 3
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor4, @x+80+460, @y-10+0,80)
        end
        draw_actor_hp(@actor4, @x+20+450, @y-10+65,150)
        draw_actor_mp(@actor4, @x+20+450, @y-10+80,150)
      else
        if NEOBT_VTS::USE_TP == true
          draw_actor_tp(@actor4, @x+80+460, @y-10+0,50)
        end
        draw_actor_hp(@actor4, @x+20+450, @y-10+65)
        draw_actor_mp(@actor4, @x+20+450, @y-10+80)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # * Edits Sizing of the Selection Box
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new
    rect.width = 0 #200
    rect.height = 0 #100
    rect.x = 0 #10
    rect.y = 0 #40 + index / col_max * 125
    rect
  end
  
  
  #--------------------------------------------------------------------------
  # * Refresh/Redraw
  #--------------------------------------------------------------------------   
  def refresh
    contents.clear
    battle_hud
    @party_size = $game_party.all_members.size
    @long_index = self.index
  end    
  
  #--------------------------------------------------------------------------
  # * Updates (Tells when to refresh)
  #--------------------------------------------------------------------------
  def update
    super
    if @party_size != $game_party.all_members.size
      refresh
    end
    if @party_size > 0
      if $game_party.members[0].hp != @actor_hp  or $game_party.members[0].mp != @actor_mp or $game_party.members[0].tp != @actor_tp
        refresh
      end
    end
    if @party_size > 1
      if $game_party.members[1].hp != @actor2_hp or $game_party.members[1].mp != @actor2_mp or $game_party.members[1].tp != @actor2_tp 
        refresh
      end
    end  
    if @party_size > 2
      if $game_party.members[2].hp != @actor3_hp or $game_party.members[2].mp != @actor3_mp or $game_party.members[2].tp != @actor3_tp 
        refresh
      end
    end
        if @party_size > 3
      if $game_party.members[3].hp != @actor4_hp or $game_party.members[3].mp != @actor4_mp or $game_party.members[3].tp != @actor4_tp 
        refresh
      end
    end
    if self.index != @long_index
      refresh
    end
  end
end  
 
class Window_BattleActor < Window_BattleStatus
  #--------------------------------------------------------------------------
  # * Shows the Window
  #--------------------------------------------------------------------------
  def show
    if @info_viewport
      width_remain = Graphics.width - width
      self.arrows_visible = false
      self.opacity = 255
      self.x = 0 #-23+210
      self.y = 73
      self.z = 150
      self.width = Graphics.width/2
      self.height = Graphics.height - 70-50
      @info_viewport.rect.width = width_remain
      select(0)
    end
    super
  end
  
  #--------------------------------------------------------------------------
  # * Draws the HUD (don't touch)
  #--------------------------------------------------------------------------
  def battle_hud
    if $game_party.all_members.size >0
      @actor = $game_party.members[0]
      @actor_hp = @actor.hp
      @actor_mp = @actor.mp
      @actor_tp = @actor.tp
      draw_actor_name(@actor, @x+10, @y-30)
      if self.index == 0
        draw_actor_hp(@actor, @x+20, @y-30+25,150)
        draw_actor_mp(@actor, @x+20, @y-30+40,150)
      else
        draw_actor_hp(@actor, @x+20, @y-30+25)
        draw_actor_mp(@actor, @x+20, @y-30+40)
      end
    end
    if $game_party.all_members.size >1
      @actor2 = $game_party.members[1]
      @actor2_hp = @actor2.hp
      @actor2_mp = @actor2.mp
      @actor2_tp = @actor2.tp
      draw_actor_name(@actor2, @x+10+75, @y-30)
      if self.index == 1
        draw_actor_hp(@actor2, @x+20+75, @y-30+25,150)
        draw_actor_mp(@actor2, @x+20+75, @y-30+40,150)
      else
        draw_actor_hp(@actor2, @x+20+75, @y-30+25)
        draw_actor_mp(@actor2, @x+20+75, @y-30+40)
      end
    end
    if $game_party.all_members.size >2
      @actor3 = $game_party.members[2]
      @actor3_hp = @actor3.hp
      @actor3_mp = @actor3.mp
      @actor3_tp = @actor3.tp
      draw_actor_name(@actor3, @x+10+150, @y-30)
      if self.index == 2
        draw_actor_hp(@actor3, @x+20+150, @y-30+25,150)
        draw_actor_mp(@actor3, @x+20+150, @y-30+40,150)
      else
        draw_actor_hp(@actor3, @x+20+150, @y-30+25)
        draw_actor_mp(@actor3, @x+20+150, @y-30+40)
      end
    end
    if $game_party.all_members.size >3
      @actor4 = $game_party.members[3]
      @actor4_hp = @actor4.hp
      @actor4_mp = @actor4.mp
      @actor4_tp = @actor4.tp
      draw_actor_name(@actor4, @x+10+300, @y-30)
      if self.index == 3
        draw_actor_hp(@actor4, @x+20+300, @y-30+25,150)
        draw_actor_mp(@actor4, @x+20+300, @y-30+40,150)
      else
        draw_actor_hp(@actor4, @x+20+300, @y-30+25)
        draw_actor_mp(@actor4, @x+20+300,@y-30+40)
      end
    end
  end
  def item_rect(index)
    rect = Rect.new
    rect.width = 0 #200
    rect.height = 0 #70
    rect.x = 0 #10
    rect.y = 0 #40 + index / col_max * 
    rect
  end
end
 
class Window_SkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Sets to 1 Row Per Column
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
end

class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Sets to 1 Row Per Column
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
end

class Window_BattleEnemy < Window_Selectable
 #--------------------------------------------------------------------------
  # * Object Initialization
  #     info_viewport : Viewport for displaying information
  #--------------------------------------------------------------------------
  def initialize(info_viewport)
    super(0, info_viewport.rect.y, window_width, fitting_height(3)) # put 4 in fitting_height for 2 rows per column
    refresh
    self.visible = false
    @info_viewport = info_viewport
    self.y = 90 # 2 rows per column = 80
    self.height = 100 # put # for 2 rows per column
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 120 # 2 rows per column = 240
  end
  #--------------------------------------------------------------------------
  # * 1 (or 2) Row(s) per Column
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    $game_troop.alive_members.size
  end
  #--------------------------------------------------------------------------
  # * Get Enemy Object
  #--------------------------------------------------------------------------
  def enemy
    $game_troop.alive_members[@index]
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    change_color(normal_color)
    name = $game_troop.alive_members[index].name
    draw_text(item_rect_for_text(index), name)
  end
  #--------------------------------------------------------------------------
  # * Show Window
  #--------------------------------------------------------------------------
  def show
    if @info_viewport
      width_remain = Graphics.width - width
      self.x = 270 # 2 rows per column = 210
      @info_viewport.rect.width = width_remain
      select(0)
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Hide Window
  #--------------------------------------------------------------------------
  def hide
    @info_viewport.rect.width = Graphics.width if @info_viewport
    super
  end
end


 
class Window_Party_New_Command < Window_Command 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    self.openness = 0
    deactivate
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 128
  end
  #--------------------------------------------------------------------------
  # * Get Number of Lines to Show
  #--------------------------------------------------------------------------
  def visible_line_number
    return 4
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Vocab::fight,  :fight)
    add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  end
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup
    clear_command_list
    make_command_list
    refresh
    select(0)
    activate
    open
  end
end

class Window_Actor_New_Command < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    self.openness = 0
    deactivate
    @actor = nil
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 128
  end
  #--------------------------------------------------------------------------
  # * Get Number of Lines to Show
  #--------------------------------------------------------------------------
  def visible_line_number
    return 4
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    return unless @actor
    add_attack_command
    add_skill_commands
    add_guard_command
    add_item_command
  end
  #--------------------------------------------------------------------------
  # * Add Attack Command to List
  #--------------------------------------------------------------------------
  def add_attack_command
    add_command(Vocab::attack, :attack, @actor.attack_usable?)
  end
  #--------------------------------------------------------------------------
  # * Add Skill Command to List
  #--------------------------------------------------------------------------
  def add_skill_commands
    @actor.added_skill_types.sort.each do |stype_id|
      name = $data_system.skill_types[stype_id]
      add_command(name, :skill, true, stype_id)
    end
  end
  #--------------------------------------------------------------------------
  # * Add Guard Command to List
  #--------------------------------------------------------------------------
  def add_guard_command
    add_command(Vocab::guard, :guard, @actor.guard_usable?)
  end
  #--------------------------------------------------------------------------
  # * Add Item Command to List
  #--------------------------------------------------------------------------
  def add_item_command
    add_command(Vocab::item, :item)
  end
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(actor)
    @actor = actor
    clear_command_list
    make_command_list
    refresh
    select(0)
    activate
    open
  end
end


 
class Scene_Battle < Scene_Base 
  #--------------------------------------------------------------------------
  # * Get Maximum Number of Battle Members
  #--------------------------------------------------------------------------
  alias neobt_vts_status_create_status_window create_status_window
  def create_status_window
    neobt_vts_status_create_status_window
    create_info_viewport
    @status_window = Window_BattleStatus.new
    @status_window.x = 128
  end  
  
  #--------------------------------------------------------------------------
  # * Edits and Adds both viewports
  #--------------------------------------------------------------------------
  def create_info_viewport
    @info_viewport = Viewport.new
    @info_viewport.rect.y = Graphics.height - 48
    @info_viewport.rect.height = Graphics.height + 200
    @info_viewport.z = 100
    @info_viewport.ox = 0
    
    @sinfo_viewport = Viewport.new # don't change that
    @sinfo_viewport.rect.x = 10
    @sinfo_viewport.rect.y = -35
    @sinfo_viewport.rect.height = Graphics.height + 200
    @sinfo_viewport.z = 0
    @sinfo_viewport.ox = 140 
    @status_window.viewport = @sinfo_viewport
  end
  
  #--------------------------------------------------------------------------
  # * Removes The Viewport Movements
  #--------------------------------------------------------------------------
  def update_info_viewport
  end
  #--------------------------------------------------------------------------
  # * Edits Party Command Window
  #--------------------------------------------------------------------------
  def create_party_command_window
    @party_command_window = Window_Party_New_Command.new
    @party_command_window.x = 280
    @party_command_window.height = 75
    @party_command_window.y = Graphics.height - 260
    @party_command_window.width = 100
    @party_command_window.set_handler(:fight,  method(:command_fight))
    @party_command_window.set_handler(:escape, method(:command_escape))
    @party_command_window.unselect
  end
  
  #--------------------------------------------------------------------------
  # * Edits Actor Command Window * movable
  #--------------------------------------------------------------------------
  def create_actor_command_window
    @actor_command_window = Window_Actor_New_Command.new
    @actor_command_window.viewport = nil
    
    if $game_party.target_actor = $game_party.members[0]
      @actor_command_window.x = 40
    else
      @actor_command_window.x = 0
    end
    if $game_party.target_actor = $game_party.members[1]
      @actor_command_window.x = 100
    else
      @actor_command_window.x = 10
    end
    if $game_party.target_actor = $game_party.members[2]
      @actor_command_window.x = 160
    else
      @actor_command_window.x = 20
    end
    if $game_party.target_actor = $game_party.members[3]  ## atinged
      @actor_command_window.x = 300
    else
      @actor_command_window.x = 30
    end
    
    
    @actor_command_window.height = 100
    @actor_command_window.y = Graphics.height - 270
    @actor_command_window.width = 110
    
    @actor_command_window.set_handler(:attack, method(:command_attack))
    @actor_command_window.set_handler(:skill,  method(:command_skill))
    @actor_command_window.set_handler(:guard,  method(:command_guard))
    @actor_command_window.set_handler(:item,   method(:command_item))
    @actor_command_window.set_handler(:cancel, method(:prior_command))
  end
  
  #--------------------------------------------------------------------------
  # * Moves Skill Window
  #--------------------------------------------------------------------------
  alias neobt_vts_create_skill_window create_skill_window
  def create_skill_window
    neobt_vts_create_skill_window
    @skill_window.x = Graphics.width/5.5
    @skill_window.width = Graphics.width/1.5
    @skill_window.height = Graphics.height/4
  end
  #--------------------------------------------------------------------------
  # * Moves Item Window
  #--------------------------------------------------------------------------
  alias neobt_vts_create_item_window create_item_window
  def create_item_window
    neobt_vts_create_item_window
    @item_window.x = Graphics.width/5.5
    @item_window.width = Graphics.width/1.5
    @item_window.height = Graphics.height/4
  end
end

class Window_Base < Window  
  #--------------------------------------------------------------------------
  # * Battle Layout (if you don't want layout, delete it)
  #--------------------------------------------------------------------------
  alias_method :winbase_init_traverse_050421, :initialize
  def initialize(x, y, width, height)
    winbase_init_traverse_050421(x, y, width, height)
    if SceneManager.scene_is?(Scene_Battle)
      self.windowskin = Cache.system("Window_Battle") # Put your windowskin here
      # The main window color (Database) need be in (0,0,0) (for the custom window's color works)
    else
      self.windowskin = Cache.system("Window")
    end
  end
end


#===============================================================================
# * End Of Script
#===============================================================================

 

 

EDIT: I already fix my problem.

Edited by minth

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted