khanhdu

Character Control

Dec 5th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.53 KB | None | 0 0
  1. #==============================================================================
  2. # ** Victor Engine - Character Control
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2012.01.04 > First release
  8. #  v 1.01 - 2012.01.07 > Added Compatibility with Visual Equipment
  9. #  v 1.02 - 2012.01.14 > Fixed the positive sign on some Regular Expressions
  10. #  v 1.03 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  11. #  v 1.04 - 2012.07.25 > Fixed Compatibility with Visual Equipment and
  12. #                      > Diagonal Movement
  13. #  v 1.05 - 2012.08.02 > Compatibility with Basic Module 1.27
  14. #------------------------------------------------------------------------------
  15. #  This script allows to control character chaset animations. You can set
  16. # different graphis for walking, dashing and jumping, also you can display
  17. # pose animations with simple comment call. This allows to animate characters
  18. # on the map without the need of long Move Route event commands.
  19. #------------------------------------------------------------------------------
  20. # Compatibility
  21. #   Requires the script 'Victor Engine - Basic Module' v 1.27 or higher
  22. #   If used with 'Victor Engine - Multi Frames' place this bellow it.
  23. #   If used with 'Victor Engine - Visual Equip' place this bellow it.
  24. #   If used with 'Victor Engine - Diagonal Movement' place this bellow it.
  25. #
  26. # * Overwrite methods
  27. #   class Game_CharacterBase
  28. #     def update_animation
  29. #
  30. # * Alias methods
  31. #   class Game_CharacterBase
  32. #     def update_animation
  33. #     def init_public_members
  34. #     def init_private_members
  35. #     def update_anime_count
  36. #     def update_anime_pattern
  37. #     def move_straight(d, turn_ok = true)
  38. #     def move_diagonal(horz, vert)
  39. #     def update_move
  40. #     def update_jump
  41. #     def update_stop
  42. #
  43. #   class Game_Interpreter
  44. #     def comment_call
  45. #
  46. #   class Sprite_Character < Sprite_Base
  47. #     def graphic_changed?
  48. #     def update_character_info
  49. #     def set_bitmap_name
  50. #     def set_bitmap_position
  51. #
  52. #------------------------------------------------------------------------------
  53. # Comment calls note tags:
  54. #  Tags to be used in events comment box, works like a script call.
  55. #
  56. #  <actor change pose>      <event change pose>
  57. #  settings                 settings    
  58. #  </actor change pose>     </event change pose>
  59. #   Display a custom pose, the pose overide any other pose being currently
  60. #   played, add the following values to the settings. The ID must be added,
  61. #   other values are optional.
  62. #     id: x     : actor index or event ID
  63. #     name: "x" : pose sufix name. ("sufix")
  64. #     loop      : pose animation loop, if added the pose will repeat.
  65. #     lock      : position lock, can't move while playing the pose.
  66. #     walk      : walking pose, if not set the pose will stop if walk.
  67. #     speed: x  : pose animation speed, higher values makes the animation slow.
  68. #     frame: x  : number of frams, can't exceed the max frames of the charset.
  69. #
  70. #  <actor add pose>      <event add pose>
  71. #  settings              settings    
  72. #  </actor add pose>     </event add pose>
  73. #   Display a custom pose, the pose won't be displayed immediately, if there is
  74. #   another pose being displayed, it will wait it finish before, you can
  75. #   add multiple poses at once to make a long animation, add the following
  76. #   values to the settings. The ID must be added, other values are optional.
  77. #     id: x     : actor index or event ID
  78. #     name: "x" : pose sufix name. ("sufix")
  79. #     loop      : pose animation loop, if added the pose will repeat.
  80. #     lock      : position lock, can't move while playing the pose.
  81. #     walk      : walking pose, if not set the pose will stop if walk.
  82. #     speed: x  : pose animation speed, higher values makes the animation slow.
  83. #     frame: x  : number of frams, can't exceed the max frames of the charset.
  84. #
  85. #  <actor idle stance i: "x">   <event idle stance i: "x">
  86. #  <actor walk stance i: "x">   <event walk stance i: "x">
  87. #  <actor dash stance i: "x">   <event dash stance i: "x">
  88. #  <actor jump stance i: "x">   <event jump stance i: "x">
  89. #   Change the stance for one of the default pose for the actor or event.
  90. #     i : actor index or event ID
  91. #     x : pose sufix name ("sufix")
  92. #
  93. #  <actor clear stances: i>   <event clear stances: i>
  94. #   Clear all changed stances for the actor or event
  95. #     i : actor index or event ID
  96. #
  97. #  <actor clear pose: i>   <event clear pose: i>
  98. #   Clear halts the current pose exhibition and clear all pose waiting to be
  99. #   played.
  100. #     i : actor index or event ID
  101. #
  102. #------------------------------------------------------------------------------
  103. # Additional instructions:
  104. #  
  105. #  To properly display the poses you will need a character with the poses.
  106. #  You will need to make a new charset, with the same filename + the sufix.
  107. #
  108. #  So if you have a chaset named "Actor1", you will need a charset named
  109. #  "Actor1[wlk]" (or whatever you set as the Walk sufix) if you want
  110. #  a custom walking pose.
  111. #
  112. #  If a pose graphic don't exist, it will use the default graphic.
  113. #
  114. #  If you make a pose loops, it will be displayed continuously until something
  115. #  force it to stop. It may be a movement (only if the settings doesn't include
  116. #  the 'walk' option), a pose change, or clear pose.
  117. #
  118. #  Due to the animated frame, the charset may be off the tile center, you
  119. #  can solve that by adding [x*] or [y*] to the filename, where * is a number
  120. #  positive or negative,that way the position will be adjusted. it must be
  121. #  added before any other sufix
  122. #
  123. #  if used with 'Victor Engine - Diagonal Movement' the diagonal movement
  124. #  sufix must come before the pose sufix.
  125. #
  126. #  The general order for the sufixes is: filename[x*][y*][diag][pose]
  127. #
  128. #==============================================================================
  129.  
  130. #==============================================================================
  131. # ** Victor Engine
  132. #------------------------------------------------------------------------------
  133. #   Setting module for the Victor Engine
  134. #==============================================================================
  135.  
  136. module Victor_Engine
  137.   #--------------------------------------------------------------------------
  138.   # * Default waling pose sufix
  139.   #--------------------------------------------------------------------------
  140.   VE_DEFAULT_WALK_SUFIX = "[wlk]"
  141.   #--------------------------------------------------------------------------
  142.   # * Default dashing pose sufix
  143.   #--------------------------------------------------------------------------
  144.   VE_DEFAULT_DASH_SUFIX = "[dsh]"
  145.   #--------------------------------------------------------------------------
  146.   # * Default jumping pose sufix
  147.   #--------------------------------------------------------------------------
  148.   VE_DEFAULT_JUMP_SUFIX = "[jmp]"
  149.   #--------------------------------------------------------------------------
  150.   # * required
  151.   #   This method checks for the existance of the basic module and other
  152.   #   VE scripts required for this script to work, don't edit this
  153.   #--------------------------------------------------------------------------
  154.   def self.required(name, req, version, type = nil)
  155.     if !$imported[:ve_basic_module]
  156.       msg = "The script '%s' requires the script\n"
  157.       msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  158.       msg += "Go to http://victorscripts.wordpress.com/ to download this script."
  159.       msgbox(sprintf(msg, self.script_name(name), version))
  160.       exit
  161.     else
  162.       self.required_script(name, req, version, type)
  163.     end
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # * script_name
  167.   #   Get the script name base on the imported value, don't edit this
  168.   #--------------------------------------------------------------------------
  169.   def self.script_name(name, ext = "VE")
  170.     name = name.to_s.gsub("_", " ").upcase.split
  171.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  172.     name.join(" ")
  173.   end
  174. end
  175.  
  176. $imported ||= {}
  177. $imported[:ve_character_control] = 1.05
  178. Victor_Engine.required(:ve_character_control, :ve_basic_module, 1.27, :above)
  179.  
  180. #==============================================================================
  181. # ** Game_CharacterBase
  182. #------------------------------------------------------------------------------
  183. #  This class deals with characters. Common to all characters, stores basic
  184. # data, such as coordinates and graphics. It's used as a superclass of the
  185. # Game_Character class.
  186. #==============================================================================
  187.  
  188. class Game_CharacterBase
  189.   #--------------------------------------------------------------------------
  190.   # * Public Instance Variables
  191.   #--------------------------------------------------------------------------
  192.   attr_reader   :pose_sufix
  193.   attr_accessor :pose_list
  194.   attr_accessor :idle_stance
  195.   attr_accessor :walk_stance
  196.   attr_accessor :dash_stance
  197.   attr_accessor :jump_stance
  198.   #--------------------------------------------------------------------------
  199.   # * Overwrite method: update_animation
  200.   #--------------------------------------------------------------------------
  201.   def update_animation
  202.     update_anime_count
  203.     if (@pose_speed != 0 && @anime_count > @pose_speed) ||
  204.        (@pose_speed == 0 && @anime_count > 18 - real_move_speed * 2)
  205.       update_anime_pattern
  206.       @anime_count = 0
  207.       change_pose(idle_stance) if @pattern == 0 && @playing_pose && !@pose_loop
  208.     end
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # * Alias method: init_public_members
  212.   #--------------------------------------------------------------------------
  213.   alias :init_public_members_ve_character_control :init_public_members
  214.   def init_public_members
  215.     init_public_members_ve_character_control
  216.     @pose_list  = []
  217.     @pose_sufix = ""
  218.     clear_stances
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # * Alias method: init_private_members
  222.   #--------------------------------------------------------------------------
  223.   alias :init_private_members_ve_character_control :init_private_members
  224.   def init_private_members
  225.     init_private_members_ve_character_control
  226.     change_pose(idle_stance)
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # * Alias method: update_anime_count
  230.   #--------------------------------------------------------------------------
  231.   alias :update_anime_count_ve_character_control :update_anime_count
  232.   def update_anime_count
  233.     if @playing_pose
  234.       @anime_count += 1.5
  235.     else
  236.       update_anime_count_ve_character_control
  237.     end
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # * Alias method: update_anime_pattern
  241.   #--------------------------------------------------------------------------
  242.   alias :update_anime_pattern_ve_character_control :update_anime_pattern
  243.   def update_anime_pattern
  244.     if @playing_pose
  245.       @pattern = (@pattern + 1) % [frames, @pose_frame].min
  246.     else
  247.       update_anime_pattern_ve_character_control
  248.     end
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # * Alias method: move_straight
  252.   #--------------------------------------------------------------------------
  253.   alias :move_straight_ve_character_control :move_straight
  254.   def move_straight(d, turn_ok = true)
  255.     return if @pose_lock
  256.     move_straight_ve_character_control(d, turn_ok)
  257.     set_fixed_direction if @pose_direction
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # * Alias method: move_diagonal
  261.   #--------------------------------------------------------------------------
  262.   alias :move_diagonal_ve_character_control :move_diagonal
  263.   def move_diagonal(horz, vert)
  264.     return if @pose_lock
  265.     move_diagonal_ve_character_control(horz, vert)
  266.     set_fixed_direction if @pose_direction
  267.   end
  268.   #--------------------------------------------------------------------------
  269.   # * Alias method: update_move
  270.   #--------------------------------------------------------------------------
  271.   alias :update_move_ve_character_control :update_move
  272.   def update_move
  273.     moving_pose
  274.     update_move_ve_character_control
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # * Alias method: update_jump
  278.   #--------------------------------------------------------------------------
  279.   alias :update_jump_ve_character_control :update_jump
  280.   def update_jump
  281.     jumping_pose
  282.     update_jump_ve_character_control
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # * Alias method: update_stop
  286.   #--------------------------------------------------------------------------
  287.   alias :update_stop_ve_character_control :update_stop
  288.   def update_stop
  289.     update_stop_ve_character_control
  290.     resting_pose
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # * New method: resting_pose
  294.   #--------------------------------------------------------------------------
  295.   def resting_pose
  296.     return if @stop_count <= 1 || @playing_pose
  297.     change_pose(idle_stance) if pose_sufix != idle_stance
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # * New method: jumping_pose
  301.   #--------------------------------------------------------------------------
  302.   def jumping_pose
  303.     return if @pose_lock || @pose_walk
  304.     change_pose(jump_stance) if pose_sufix != jump_stance
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # * New method: moving_pose
  308.   #--------------------------------------------------------------------------
  309.   def moving_pose
  310.     return if @pose_lock || @pose_walk
  311.     @pose_list.clear
  312.     change_pose(walk_stance) if pose_sufix != walk_stance && !dash?
  313.     change_pose(dash_stance) if pose_sufix != dash_stance && dash?
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # * New method: change_pose
  317.   #--------------------------------------------------------------------------
  318.   def change_pose(sufix)
  319.     @playing_pose = false
  320.     reset_fixed_pose if @pose_direction
  321.     value = {sufix: sufix, anim: 0, speed: 0, frame: frames}
  322.     update_pose(value)
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # * New method: reset_pose_index
  326.   #--------------------------------------------------------------------------
  327.   def reset_pose_index
  328.     @character_index = @real_index
  329.     @pose_index = nil
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # * New method: reset_fixed_pose
  333.   #--------------------------------------------------------------------------
  334.   def reset_fixed_pose
  335.     @direction = @real_direction
  336.     @diagonal  = @real_diagonal if $imported[:ve_diagonal_move]
  337.     @current_direction = @direction - 2 if $imported[:ve_roatation_turn]
  338.     @final_direction   = @direction - 2 if $imported[:ve_roatation_turn]
  339.     update_direction if $imported[:ve_roatation_turn]
  340.     @pose_direction = nil
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # * New method: update_pose
  344.   #--------------------------------------------------------------------------
  345.   def update_pose(pose = default_pose.dup)
  346.     pose = get_next_pose(pose)
  347.     @pose_sufix = pose[:sufix]
  348.     @pose_speed = pose[:speed]
  349.     @pose_frame = pose[:frame]
  350.     @pose_walk  = pose[:walk]
  351.     @pose_loop  = pose[:loop]
  352.     @pose_lock  = pose[:lock] && @playing_pose
  353.     @pose_direction = pose[:line] * 2 if pose[:line]
  354.     @real_direction = @direction
  355.     @real_diagonal  = @diagonal if $imported[:ve_diagonal_move]
  356.     @anime_count    = 0 unless move_pose?
  357.     @pattern        = @playing_pose ? 0 : @original_pattern
  358.     set_fixed_direction if @pose_direction
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # * New method: set_fixed_direction
  362.   #--------------------------------------------------------------------------
  363.   def set_fixed_direction
  364.     @direction = @pose_direction
  365.     @diagonal  = 0 if $imported[:ve_diagonal_move]
  366.     @current_direction = @direction - 2 if $imported[:ve_roatation_turn]
  367.     @final_direction   = @direction - 2 if $imported[:ve_roatation_turn]
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # * New method: get_next_pose
  371.   #--------------------------------------------------------------------------
  372.   def get_next_pose(pose)
  373.     if pose == default_pose && !@pose_list.empty?
  374.       pose = @pose_list.shift
  375.       @playing_pose = true
  376.     end
  377.     pose
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # * New method: move_pose?
  381.   #--------------------------------------------------------------------------
  382.   def move_pose?
  383.     [walk_stance, dash_stance, jump_stance].include?(pose_sufix)
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # * New method: default_pose
  387.   #--------------------------------------------------------------------------
  388.   def default_pose
  389.     {sufix: @idle_stance, anim: 0, speed: 0, frame: frames}
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * New method: start_pose
  393.   #--------------------------------------------------------------------------
  394.   def start_pose(pose)
  395.     clear_poses
  396.     @pose_list.push(pose)
  397.     update_pose
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * New method: add_pose
  401.   #--------------------------------------------------------------------------
  402.   def add_pose(pose)
  403.     @pose_list.push(pose)
  404.     update_pose unless @playing_pose
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # * New method: clear_poses
  408.   #--------------------------------------------------------------------------
  409.   def clear_poses
  410.     @pose_list.clear
  411.     change_pose(idle_stance)
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # * New method: clear_stances
  415.   #--------------------------------------------------------------------------
  416.   def clear_stances
  417.     @idle_stance = ""
  418.     @walk_stance = VE_DEFAULT_WALK_SUFIX
  419.     @dash_stance = VE_DEFAULT_DASH_SUFIX
  420.     @jump_stance = VE_DEFAULT_JUMP_SUFIX
  421.   end
  422. end
  423.  
  424. #==============================================================================
  425. # ** Game_Interpreter
  426. #------------------------------------------------------------------------------
  427. #  An interpreter for executing event commands. This class is used within the
  428. # Game_Map, Game_Troop, and Game_Event classes.
  429. #==============================================================================
  430.  
  431. class Game_Interpreter
  432.   #--------------------------------------------------------------------------
  433.   # * Alias method: comment_call
  434.   #--------------------------------------------------------------------------
  435.   alias :comment_call_ve_character_control :comment_call
  436.   def comment_call
  437.     call_clear_pose("EVENT")
  438.     call_clear_pose("ACTOR")
  439.     call_change_stance("EVENT")
  440.     call_change_stance("ACTOR")
  441.     call_change_pose("EVENT", "ADD POSE")
  442.     call_change_pose("ACTOR", "ADD POSE")
  443.     call_change_pose("EVENT", "CHANGE POSE")
  444.     call_change_pose("ACTOR", "CHANGE POSE")
  445.     comment_call_ve_character_control
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # * New method: call_clear_pose
  449.   #--------------------------------------------------------------------------
  450.   def call_clear_pose(type)
  451.     note.scan(/<#{type} CLEAR POSE: (\d+)>/i) do
  452.       subject = $game_map.events[$1.to_i] if type == "EVENT"
  453.       subject = $game_map.actors[$1.to_i] if type == "ACTOR"
  454.       next unless subject
  455.       subject.clear_poses
  456.     end
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # * New method: call_clear_stances
  460.   #--------------------------------------------------------------------------
  461.   def call_clear_stances(type)
  462.     note.scan(/<#{type} CLEAR STANCES: (\d+)>/i) do
  463.       subject = $game_map.events[$1.to_i] if type == "EVENT"
  464.       subject = $game_map.actors[$1.to_i] if type == "ACTOR"
  465.       next unless subject
  466.       subject.clear_stances
  467.     end
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # * New method: call_change_stance
  471.   #--------------------------------------------------------------------------
  472.   def call_change_stance(type)
  473.     regexp = /<#{type} (\w+) STANCE (\d+): #{get_filename}>/i
  474.     note.scan(regexp) do |move, id, value|
  475.       subject = $game_map.events[id.to_i] if type == "EVENT"
  476.       subject = $game_map.actors[id.to_i] if type == "ACTOR"
  477.       next unless subject
  478.       subject.idle_stance = value if move.upcase == "IDLE"
  479.       subject.walk_stance = value if move.upcase == "WALK"
  480.       subject.dash_stance = value if move.upcase == "DASH"
  481.       subject.jump_stance = value if move.upcase == "JUMP"
  482.     end
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # * New method: call_change_pose
  486.   #--------------------------------------------------------------------------
  487.   def call_change_pose(type, add)
  488.     note.scan(get_all_values("#{type} #{add}")) do
  489.       value = $1.dup
  490.       if value =~ /ID: (\d+)/i
  491.         subject = $game_map.events[$1.to_i] if type == "EVENT"
  492.         subject = $game_map.actors[$1.to_i] if type == "ACTOR"
  493.         next unless subject
  494.         stance = subject.idle_stance
  495.         pose   = {}
  496.         pose[:sufix] = value =~ /NAME: #{get_filename}/i ? $1 : stance
  497.         pose[:loop]  = value =~ /LOOP/i
  498.         pose[:lock]  = value =~ /LOCK/i
  499.         pose[:walk]  = value =~ /WALK/i
  500.         pose[:speed] = value =~ /SPEED: (\d+)/i   ? $1.to_i : 0
  501.         pose[:line]  = value =~ /LINE: ([1234])/i ? $1.to_i : nil
  502.         pose[:frame] = value =~ /FRAMES: (\d+)/i  ? $1.to_i : subject.frames
  503.         subject.start_pose(pose) if add.upcase == "CHANGE POSE"
  504.         subject.add_pose(pose)   if add.upcase == "ADD POSE"
  505.       end
  506.     end
  507.   end
  508. end
  509.  
  510. #==============================================================================
  511. # ** Sprite_Character
  512. #------------------------------------------------------------------------------
  513. #  This sprite is used to display characters. It observes a instance of the
  514. # Game_Character class and automatically changes sprite conditions.
  515. #==============================================================================
  516.  
  517. class Sprite_Character < Sprite_Base
  518.   #--------------------------------------------------------------------------
  519.   # * Alias method: graphic_changed?
  520.   #--------------------------------------------------------------------------
  521.   alias :graphic_changed_ve_character_control? :graphic_changed?
  522.   def graphic_changed?
  523.     graphic_changed_ve_character_control? ||
  524.     @pose_sufix != @character.pose_sufix
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # * Alias method: update_character_info
  528.   #--------------------------------------------------------------------------
  529.   alias :update_character_info_ve_character_control :update_character_info
  530.   def update_character_info
  531.     update_character_info_ve_character_control
  532.     @pose_sufix = @character.pose_sufix
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # * Alias method: set_bitmap_name
  536.   #--------------------------------------------------------------------------
  537.   alias :set_bitmap_name_ve_character_control :set_bitmap_name
  538.   def set_bitmap_name
  539.     sufix = ($imported[:ve_diagonal_move] ? diagonal_sufix : "") + @pose_sufix
  540.     if $imported[:ve_visual_equip]
  541.       return set_bitmap_name_ve_character_control
  542.     elsif character_exist?(@character_name + sufix)
  543.       return @character_name + sufix
  544.     elsif character_exist?(@character_name + @pose_sufix)
  545.       return @character_name + @pose_sufix
  546.     else
  547.       return set_bitmap_name_ve_character_control
  548.     end
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # * Alias method: set_bitmap_position
  552.   #--------------------------------------------------------------------------
  553.   alias :set_bitmap_position_ve_character_control :set_bitmap_position
  554.   def set_bitmap_position
  555.     set_bitmap_position_ve_character_control
  556.     self.ox -= (@character_name[/\[x([+-]?\d+)\]/i] ? $1.to_i : 0)
  557.     self.oy -= (@character_name[/\[y([+-]?\d+)\]/i] ? $1.to_i : 0)
  558.   end
  559. end
  560.  
  561. #==============================================================================
  562. # ** Window_Base
  563. #------------------------------------------------------------------------------
  564. #  This is a superclass of all windows in the game.
  565. #==============================================================================
  566.  
  567. class Window_Base < Window
  568.   #--------------------------------------------------------------------------
  569.   # * Alias method: draw_character
  570.   #--------------------------------------------------------------------------
  571.   alias :draw_character_ve_character_control :draw_character
  572.   def draw_character(character_name, character_index, x, y, parts = nil)
  573.     return unless character_name
  574.     x += (character_name[/\[x([+-]?\d+)\]/i] ? $1.to_i : 0)
  575.     y += (character_name[/\[y([+-]?\d+)\]/i] ? $1.to_i : 0)
  576.     args = [character_name, character_index, x, y]
  577.     args.push(parts) if $imported[:ve_visual_equip]
  578.     draw_character_ve_character_control(*args)
  579.   end
  580. end
Advertisement
Add Comment
Please, Sign In to add comment