Official Boytoy
 |
|
Group: Retired Staff Location: Québec / Canada
|
Action Order by Dargor Version 1.9 IntroductionThis script displays who's turn is next in a battle, based on the battlers attack speed. Exactly like in FF10 for those who have played this game. Screenshots Script- #==============================================================================
- # ** Action Order
- #------------------------------------------------------------------------------
- # © Dargor, 2008-2009
- # 28/01/09
- # Version 1.9
- #------------------------------------------------------------------------------
- # VERSION HISTORY:
- # - 1.0 (22/06/08), Initial release
- # - 1.1 (22/06/08), Added options for the window's opacity/height
- # - 1.2 (22/06/08), Removed the window from the Party Command phase
- # - 1.3 (22/06/08), Bug fixed with the window's disposal
- # - 1.4 (27/06/08), Added battlers order for next turn
- # - 1.5 (27/06/08), Added action speed preview
- # - 1.6 (27/06/08), Added options for Item/Skill windows size correction
- # - 1.7 (27/06/08), Removed dependency over the Custom Commands script
- # - 1.8 (28/01/09), Fixed monsters graphics in action order window
- # - 1.9 (28/01/09), Improved precision when defining action order.
- # The script now redefines only the acting battler's speed
- # instead of the whole Party + Troop
- #------------------------------------------------------------------------------
- # INSTRUCTIONS:
- # - Paste this above main
- # - Edit the constants in Action_Order module
- #==============================================================================
-
- #==============================================================================
- # ** Action Order Customization Module
- #==============================================================================
-
- module Action_Order
- # Actors face graphic offset (X,Y)
- # SYNTAX: Face_Offset = face_name => {face_index => [x,y]}}
- Face_Offset = {
- 'Actor1' => {0 => [0, 32]},
- 'Evil' => {4 => [0, 16]}
- }
- Face_Offset.default = [0,32]
- # Ememies battler graphic offset (X,Y)
- Battler_Offset = {'Demon' => [42,72]}
- Battler_Offset.default = [0, 32]
- # Is the action window enabled in the Party Command selection phase?
- Enabled_Party_Phase = true
- # Show Actors name instead of face
- Actor_Names = false
- # Show enemies name instead of battler graphic
- Enemy_Names = false
- # Action Window Opacity
- Window_Opacity = 255
- Window_Back_Opacity = 160
- # Maximum number of battlers visible at the same time in the window
- Battlers_Max = 8
- # Small Windows (True is Recommended)
- Small_Windows = true
- # Maximum number of columns when using small windows (1 is recommended)
- Small_Windows_Column_Max = 1
- end
-
- #==============================================================================
- # ** Game_BattleAction
- #------------------------------------------------------------------------------
- # This class handles battle actions. This class is used within the
- # Game_Battler class.
- #==============================================================================
-
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_action_order_action_make_speed make_speed
- #--------------------------------------------------------------------------
- # * Confirm Action Speed
- #--------------------------------------------------------------------------
- def make_speed
- # The usual
- # dargor_vx_action_order_action_make_speed
- @speed = battler.agi #+ rand(5 + battler.agi / 4)
- @speed += skill.speed if skill?
- @speed += item.speed if item?
- @speed += 2000 if guard?
- @speed += 1000 if attack? and battler.fast_attack
- @speed += battler.index * 2 if attack? and battler.is_a?(Game_Actor)
- @speed += battler.index
- end
- end
-
- #==============================================================================
- # ** Window_Item
- #------------------------------------------------------------------------------
- # This window displays a list of inventory items for the item screen, etc.
- #==============================================================================
-
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_action_order_window_item_refresh refresh
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if $game_temp.in_battle && Action_Order::Small_Windows
- @column_max = Action_Order::Small_Windows_Column_Max
- self.width = 412
- self.x = 132
- end
- dargor_vx_action_order_window_item_refresh
- end
- end
-
- #==============================================================================
- # ** Window_Skill
- #------------------------------------------------------------------------------
- # This window displays a list of usable skills on the skill screen, etc.
- #==============================================================================
-
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_action_order_window_skill_refresh refresh
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if $game_temp.in_battle && Action_Order::Small_Windows
- @column_max = Action_Order::Small_Windows_Column_Max
- self.width = 412
- self.x = 132
- end
- dargor_vx_action_order_window_skill_refresh
- end
- end
-
- #==============================================================================
- # ** Window_ActionOrder
- #------------------------------------------------------------------------------
- # This window displays action battlers order on the battle screen.
- #==============================================================================
-
- class Window_ActionOrder < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0,56,132, 40 + Action_Order::Battlers_Max * 24)
- self.active = false
- self.visible = Action_Order::Enabled_Party_Phase
- self.opacity = Action_Order::Window_Opacity
- self.back_opacity = Action_Order::Window_Back_Opacity
- self.index = 0
- @action_battlers = []
- @next_action_battlers = []
- end
- #--------------------------------------------------------------------------
- # * Make Action Orders
- #--------------------------------------------------------------------------
- def make_action_orders(action_battlers)
- return if action_battlers == @action_battlers
- @action_battlers = action_battlers
- for battler in @action_battlers
- @action_battlers.delete(battler) if battler.dead?
- @action_battlers.delete(battler) if battler.hidden
- end
- if @next_action_battlers.empty?
- mul = (Action_Order::Battlers_Max.to_f / @action_battlers.size.to_f).ceil
- for i in 0...mul
- @next_action_battlers += @action_battlers.dup
- end
- end
- refresh
- end
- def remove_first_battler
- @action_battlers.delete_at(0)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Remove Battler
- #--------------------------------------------------------------------------
- def remove_battler(battler)
- @action_battlers.delete(battler)
- for battler in @action_battlers
- @action_battlers.delete(battler) if battler.dead?
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- return if @action_battlers.empty?
- @item_max = @action_battlers.size
- @all_action_battlers = @action_battlers + @next_action_battlers
- create_contents
- for i in 0...@all_action_battlers.size
- battler = @all_action_battlers[i]
- if battler.is_a?(Game_Enemy)
- name = "" + battler.battler_name
- hue = 0 + battler.battler_hue
- if Action_Order::Enemy_Names
- self.contents.draw_text(4,i * WLH,128,WLH,battler.name)
- else
- battler_name = "" + battler.battler_name
- battler_hue = 0 + battler.battler_hue
- draw_battler(battler_name, battler_hue, 2, i * WLH + 2)
- end
- else
- if Action_Order::Actor_Names
- self.contents.draw_text(4,i * WLH,128,WLH,battler.name)
- else
- draw_face(battler.face_name, battler.face_index, 2, i * WLH + 2)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Face Graphic
- # face_name : Face graphic filename
- # face_index : Face graphic index
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # size : Display size
- #--------------------------------------------------------------------------
- def draw_face(face_name, face_index, x, y, size = 96)
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size) / 2
- rect.y = face_index / 4 * 96 + (96 - size) / 2
- offset = Action_Order::Face_Offset[face_name][face_index]
- offset = Action_Order::Face_Offset.default if offset.nil?
- rect.x += offset[0]
- rect.y += offset[1]
- rect.width = size
- rect.height = 20
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # * Draw Battler Graphic
- # battler_name : Face graphic filename
- # battler_hue : Face graphic index
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # size : Display size
- #--------------------------------------------------------------------------
- def draw_battler(battler_name, battler_hue, x, y, size = 96)
- bitmap = Bitmap.new("Graphics/Battlers/#{battler_name}")
- bitmap.hue_change(battler_hue)
- rect = Rect.new(4, 4, 0, 0)
- offset = Action_Order::Battler_Offset[battler_name]
- offset = Action_Order::Battler_Offset.default if offset.nil?
- rect.x = offset[0]
- rect.y = offset[1]
- rect.width = size
- rect.height = 20
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- end
-
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
-
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_action_order_battle_make_action_orders make_action_orders
- alias dargor_vx_action_order_battle_execute_action execute_action
- alias dargor_vx_action_order_battle_start start
- alias dargor_vx_action_order_battle_start_main start_main
- alias dargor_vx_action_order_battle_terminate terminate
- alias dargor_vx_action_order_update_basic update_basic
- alias dargor_vx_action_order_next_actor next_actor
- alias dargor_vx_action_order_prior_actor prior_actor
- alias dargor_vx_action_order_start_party_command_selection start_party_command_selection
- alias dargor_vx_action_order_start_actor_command_selection start_actor_command_selection
- alias dargor_vx_action_order_update_actor_command_selection update_actor_command_selection
- alias dargor_vx_action_order_update_item_selection update_item_selection
- alias dargor_vx_action_order_update_skill_selection update_skill_selection
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- def start
- dargor_vx_action_order_battle_start
- @action_index = -1
- @action_window = Window_ActionOrder.new
- make_action_orders
- @action_window.make_action_orders(@action_battlers)
- end
- #--------------------------------------------------------------------------
- # * Terminate processing
- #--------------------------------------------------------------------------
- def terminate
- dargor_vx_action_order_battle_terminate
- @action_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Basic Update Processing
- # main : Call from main update method
- #--------------------------------------------------------------------------
- def update_basic(main = false)
- dargor_vx_action_order_update_basic(main)
- @action_window.update
- end
- #--------------------------------------------------------------------------
- # * Start party command selection
- #--------------------------------------------------------------------------
- def start_party_command_selection
- @action_window.visible = Action_Order::Enabled_Party_Phase
- if $game_temp.in_battle
- make_action_orders
- end
- dargor_vx_action_order_start_party_command_selection
- end
- #--------------------------------------------------------------------------
- # * Start party command selection
- #--------------------------------------------------------------------------
- def start_actor_command_selection
- @action_window.open
- @action_window.visible = true
- dargor_vx_action_order_start_actor_command_selection
- end
- #--------------------------------------------------------------------------
- # * Start Execution of Battle Processing
- #--------------------------------------------------------------------------
- def start_main
- @action_window.visible = true
- dargor_vx_action_order_battle_start_main
- end
- #--------------------------------------------------------------------------
- # * Go to Command Input for Next Actor
- #--------------------------------------------------------------------------
- def next_actor
- dargor_vx_action_order_next_actor
- make_action_orders
- end
- #--------------------------------------------------------------------------
- # * Go to Command Input of Previous Actor
- #--------------------------------------------------------------------------
- def prior_actor
- dargor_vx_action_order_prior_actor
- make_action_orders
- end
- #--------------------------------------------------------------------------
- # * Create Action Orders
- #--------------------------------------------------------------------------
- def make_action_orders
- dargor_vx_action_order_battle_make_action_orders
- @action_window.make_action_orders(@action_battlers)
- end
- #--------------------------------------------------------------------------
- # * Create Action Order (For a single battler)
- # battler : Battler
- #--------------------------------------------------------------------------
- def make_action_order(battler)
- @action_battlers = []
- unless $game_troop.surprise
- @action_battlers += $game_party.members
- end
- unless $game_troop.preemptive
- @action_battlers += $game_troop.members
- end
- battler.action.make_speed
- @action_battlers.sort! do |a,b|
- b.action.speed - a.action.speed
- end
- @action_window.make_action_orders(@action_battlers)
- end
- #--------------------------------------------------------------------------
- # * Execute Battle Actions
- #--------------------------------------------------------------------------
- def execute_action
- dargor_vx_action_order_battle_execute_action
- @action_window.remove_first_battler
- end
- #--------------------------------------------------------------------------
- # * Update Actor Command Selection
- #--------------------------------------------------------------------------
- def update_actor_command_selection
- dargor_vx_action_order_update_actor_command_selection
- return if @active_battler.nil?
- if @actor_command_window.methods.include?('selection')
- case @actor_command_window.selection
- when Vocab::attack
- unless @active_battler.action.attack?
- @active_battler.action.clear
- @active_battler.action.set_attack
- make_action_order(@active_battler)
- end
- when Vocab::guard
- unless @active_battler.action.guard?
- @active_battler.action.clear
- @active_battler.action.set_guard
- make_action_order(@active_battler)
- end
- else
- @active_battler.action.clear
- end
- else
- case @actor_command_window.index
- when 0
- unless @active_battler.action.attack?
- @active_battler.action.clear
- @active_battler.action.set_attack
- make_action_order(@active_battler)
- end
- when 2
- unless @active_battler.action.guard?
- @active_battler.action.clear
- @active_battler.action.set_guard
- make_action_order(@active_battler)
- end
- else
- @active_battler.action.clear
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Update Item Selection
- #--------------------------------------------------------------------------
- def update_item_selection
- @item = @item_window.item
- if @active_battler.action.item.id != @item.id
- @active_battler.action.clear
- @active_battler.action.set_item(@item.id)
- make_action_order(@active_battler)
- end
- dargor_vx_action_order_update_item_selection
- end
- #--------------------------------------------------------------------------
- # * Update Skill Selection
- #--------------------------------------------------------------------------
- def update_skill_selection
- @skill = @skill_window.skill
- if @active_battler.action.skill.id != @skill.id
- @active_battler.action.clear
- @active_battler.action.set_skill(@skill.id)
- make_action_order(@active_battler)
- end
- dargor_vx_action_order_update_skill_selection
- end
- end
-
- #==============================================================================
- # ** Window_BattleMessage
- #------------------------------------------------------------------------------
- # Message window displayed during battle. In addition to the normal message
- # window functions, it also has a battle progress narration function.
- #==============================================================================
-
- class Window_BattleMessage < Window_Message
- #--------------------------------------------------------------------------
- # * Get Text From Last Line
- #--------------------------------------------------------------------------
- def last_instant_text
- line = @lines[-1]
- line = @lines[0] if line.nil?
- return line
- end
- end
-
Expand to see the code. Credits and ThanksThanks to J4iru5 for requesting this script.
_________________
Tutorial: How to use RGSS2 with RPG Maker XP
If you're ever sad, you just need to stop being sad and start being awesome. It works for me.
Last edited by Dargor on Sat Jun 28, 2008 6:11 pm, edited 1 time in total.
|
|