Jump to content
Rpg²S Forum

Ruba magie


payam
 Share

Recommended Posts

Skill Draw

Descrizione

Come in ff8, assimila le magie

 

Autore

Dargor

 

Allegati

Nessuno

 

Istruzioni per l'uso

Inserire sopra main

 

#======================================================================
========
# ** Skill Draw (FFVIII)
#------------------------------------------------------------------------------
#  © Dargor, 2008
#  08/05/08
#  Version 1.2
#------------------------------------------------------------------------------
#  VERSION HISTORY:
#   - 1.0 (11/05/08), Initial release
#   - 1.1 (14/05/08), Bug fixed with consuming skill number
#   - 1.2 (14/05/08), Bug fixed with initial skill number
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   1) Paste the script above main
#   2) Edit the Vocab variables
#   2) Edit the constants in the Skill_Draw module
#==============================================================================

# Command name
Vocab::CommandDraw = 'Draw'
Vocab::CommandDrawStock = 'Stock'
Vocab::CommandDrawCast = 'Cast'
Vocab::UnknownSkill = '??????'
Vocab::UseDraw = "%s uses #{Vocab::CommandDraw}!"
Vocab::DrawGain = "%s draw %s %s!"
Vocab::DrawFail = "%s's draw failed."

module Skill_Draw
 # The Draw Animation
 Animation_id = 41
 # Prevent from drawing specific enemy skills
 # SYNTAX: enemy_id => [skill_id, ...]
 Dont_Draw = {
               1 => [2,3]
             }
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :skill_drawned
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_system_initialize initialize
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   dargor_vx_draw_system_initialize
   @skill_drawned = []
 end
end
#==============================================================================
# ** Game_BattleAction
#------------------------------------------------------------------------------
#  This class handles battle actions. This class is used within the
# Game_Battler class.
#==============================================================================

class Game_BattleAction
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :draw_kind                # draw kind (stock/cast)
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_battle_action_clear clear
 alias dargor_vx_draw_battle_action_make_targets make_targets
 #--------------------------------------------------------------------------
 # * Clear
 #--------------------------------------------------------------------------
 def clear
   @draw_kind = -1
   # The usual
   dargor_vx_draw_battle_action_clear
 end
 #--------------------------------------------------------------------------
 # * Set Skill
 #     skill_id : skill ID
 #     draw_kind: draw kind (stock/cast)
 #--------------------------------------------------------------------------
 def set_skill(skill_id, draw_kind = -1)
   @kind = 1
   @skill_id = skill_id
   @draw_kind = draw_kind
 end
 #--------------------------------------------------------------------------
 # * Draw Determination
 #--------------------------------------------------------------------------
 def draw?
   return @kind == 1 && [0,1].include?(@draw_kind)
 end
 #--------------------------------------------------------------------------
 # * Create Target Array
 #--------------------------------------------------------------------------
 def make_targets
   targets = []
   if draw?
     targets.push(opponents_unit.smooth_target(@target_index))
     return targets
   end
   dargor_vx_draw_battle_action_make_targets
 end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler 
 #--------------------------------------------------------------------------
 # * Draw Success
 #     skill : skill
 #     number: number to draw
 #--------------------------------------------------------------------------
 def draw_success?(skill, number)
   return false unless self.is_a?(Game_Actor)
   return false if number == 0
   level_factor = (self.level / 10) / 2
   random = [10-level_factor, 0].max
   success = (self.level / 10) + rand(random) 
   return success >= number 
 end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :skills_number
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_actor_skill_can_use? skill_can_use?
 alias dargor_vx_draw_actor_setup setup
 #--------------------------------------------------------------------------
 # * Setup
 #     actor_id : actor ID
 #--------------------------------------------------------------------------
 def setup(actor_id)
   @skills_number = []
   dargor_vx_draw_actor_setup(actor_id)
   for i in self.class.learnings
     @skills_number[i.skill_id] == 1 if i.level <= @level
   end
   # Add battle commands
   case @actor_id
   when 1,2,3,4,5,6,7,8
     # Add 'Draw' to actor 1
     add_command(1, Vocab::CommandDraw)
   end
 end
 #--------------------------------------------------------------------------
 # * Learn Skill
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def learn_skill(skill_id)
   $game_system.skill_drawned << skill_id
   unless skill_learn?($data_skills[skill_id])
     @skills.push(skill_id)
     @skills.sort!
   end
 end
 #--------------------------------------------------------------------------
 # * Get Number of Items Possessed
 #     item : item
 #--------------------------------------------------------------------------
 def skill_number(skill)
   number = @skills_number[skill.id]
   return number == nil ? 0 : number
 end
 #--------------------------------------------------------------------------
 # * Determine Usable Skills
 #     skill : skill
 #--------------------------------------------------------------------------
 def skill_can_use?(skill)
   return false unless skill_number(skill) > 0
   dargor_vx_draw_actor_skill_can_use?(skill)
 end
 #--------------------------------------------------------------------------
 # * Gain Items (or lose)
 #     item          : Item
 #     n             : Number
 #     include_equip : Include equipped items
 #--------------------------------------------------------------------------
 def gain_skill(skill, n)
   $game_system.skill_drawned << skill.id
   number = skill_number(skill)
   @skills_number[skill.id] = [[number + n, 0].max, 99].min
   n += number
 end
 #--------------------------------------------------------------------------
 # * Lose Items
 #     item          : Item
 #     n             : Number
 #     include_equip : Include equipped items
 #--------------------------------------------------------------------------
 def lose_skill(skill, n)
   gain_skill(skill, -n)
 end
end

#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
 #--------------------------------------------------------------------------
 # * Skills
 #--------------------------------------------------------------------------
 def skills
   result = []
   for action in enemy.actions
     next unless action.skill?
     result << $data_skills[action.skill_id]
   end
   return result
 end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_Skill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   rect = item_rect(index)
   self.contents.clear_rect(rect)
   skill = @data[index]
   if skill != nil
     rect.width -= 4
     enabled = @actor.skill_can_use?(skill)
     draw_item_name(skill, rect.x, rect.y, enabled)
     self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
     # Draw skill number
     rect.x -= 24
     self.contents.draw_text(rect, ":", 2)
     rect.x -= 12
     skill_number = @actor.skill_number(skill)
     if enabled
       self.contents.font.color = text_color(3)
     end
     self.contents.draw_text(rect, skill_number.to_s, 2)
   end
 end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_EnemySkill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :enemy
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     x      : window x-coordinate
 #     y      : window y-coordinate
 #     width  : window width
 #     height : window height
 #     actor  : actor
 #--------------------------------------------------------------------------
 def initialize(x, y, width, height, enemy)
   super(x, y, width, height)
   @enemy = enemy
   @column_max = 2
   self.index = 0
   refresh
 end
 #--------------------------------------------------------------------------
 # * Skill
 #--------------------------------------------------------------------------
 def skill
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   @data = []
   for skill in @enemy.skills
     unless Skill_Draw::Dont_Draw[@enemy.id].nil?
       next if Skill_Draw::Dont_Draw[@enemy.id].include?(skill.id)
     end
     @data.push(skill)
   end
   @item_max = @data.size
   create_contents
   for i in 0...@item_max
     draw_item(i)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   rect = item_rect(index)
   self.contents.clear_rect(rect)
   skill = @data[index]
   if skill != nil
     rect.width -= 4
     draw_item_name(skill, rect.x, rect.y, true)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item Name
 #     item    : Item (skill, weapon, armor are also possible)
 #     x       : draw spot x-coordinate
 #     y       : draw spot y-coordinate
 #     enabled : Enabled flag. When false, draw semi-transparently.
 #--------------------------------------------------------------------------
 def draw_item_name(item, x, y, enabled = true)
   if item != nil
     draw_icon(item.icon_index, x, y, enabled)
     self.contents.font.color = normal_color
     self.contents.font.color.alpha = enabled ? 255 : 128
     if item.is_a?(RPG::Skill) && !$game_system.skill_drawned.include?(item.id)
       self.contents.draw_text(x + 24, y, 172, WLH, Vocab::UnknownSkill)
     else  
       self.contents.draw_text(x + 24, y, 172, WLH, item.name)
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
 end
 #--------------------------------------------------------------------------
 # * Update Help Text
 #--------------------------------------------------------------------------
 def update_help
   if $game_system.skill_drawned.include?(skill.id)
     @help_window.set_text(skill == nil ? "" : skill.description)
   else
     @help_window.set_text(skill == nil ? "" : Vocab::UnknownSkill)
   end
 end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_battle_update update
 alias dargor_vx_draw_update_actor_command_selection update_actor_command_selection
 alias dargor_vx_draw_execute_action execute_action
 alias dargor_vx_draw_execute_action_skill execute_action_skill
 alias dargor_vx_draw_update_target_enemy_selection update_target_enemy_selection
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   unless @enemy_skill_window != nil or @draw_command_window != nil
     dargor_vx_draw_battle_update
   else
     super
     update_basic(true)
     update_info_viewport                  # Update information viewport
     if $game_message.visible
       @info_viewport.visible = false
       @message_window.visible = true
     end
     unless $game_message.visible          # Unless displaying a message
       return if judge_win_loss            # Determine win/loss results
       update_scene_change
       if @enemy_skill_window.active
         update_enemy_skill_selection    # Select party changer command
       elsif @draw_command_window.active
         update_draw_command_selection    # Select party changer command
       end
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Update Actor Command Selection
 #--------------------------------------------------------------------------
 def update_actor_command_selection
   dargor_vx_draw_update_actor_command_selection
   if Input.trigger?(Input::C)
     case @actor_command_window.commands[@actor_command_window.index]
     when Vocab::CommandDraw
       Sound.play_decision
       start_target_enemy_selection
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Update Target Enemy Selection
 #--------------------------------------------------------------------------
 def update_target_enemy_selection
   if Input.trigger?(Input::C) && 
       @actor_command_window.selection == Vocab::CommandDraw
       Sound.play_decision
     Sound.play_decision
     @active_battler.action.target_index = @target_enemy_window.enemy.index
     start_draw_command_selection
     end_target_enemy_selection
     end_skill_selection
     end_item_selection
     return
   end
   dargor_vx_draw_update_target_enemy_selection
 end
 #--------------------------------------------------------------------------
 # * Start Draw Command Selection
 #--------------------------------------------------------------------------
 def start_draw_command_selection
   enemy = @target_enemy_window.enemy
   @help_window = Window_Help.new
   @help_window.y = 56
   @enemy_skill_window = Window_EnemySkill.new(0, 112, 544, 176, enemy)
   @enemy_skill_window.help_window = @help_window
   @enemy_skill_window.active = false
   s1 = Vocab::CommandDrawStock
   s2 = Vocab::CommandDrawCast
   @draw_command_window = Window_Command.new(544, [s1,s2], 2)
 end
 #--------------------------------------------------------------------------
 # * Update Draw Command Selection
 #--------------------------------------------------------------------------
 def update_draw_command_selection
   @draw_command_window.update
   @actor_command_window.active = false
   if Input.trigger?(Input::B)
     end_draw_command_selection
     return
   end
   if Input.trigger?(Input::C)
     @enemy_skill_window.active = true
     return
   end
 end
 #--------------------------------------------------------------------------
 # * End Draw Command Selection
 #--------------------------------------------------------------------------
 def end_draw_command_selection
   if @enemy_skill_window != nil
     @enemy_skill_window.dispose
     @enemy_skill_window = nil
     @draw_command_window.dispose
     @draw_command_window = nil
     @help_window.dispose
     @help_window = nil
   end
   @actor_command_window.active = true
 end
 #--------------------------------------------------------------------------
 # * Update Enemy Skill Selection
 #--------------------------------------------------------------------------
 def update_enemy_skill_selection
   @help_window.update
   @enemy_skill_window.update
   @actor_command_window.active = false
   if Input.trigger?(Input::B)
     @draw_command_window.active = true
     @enemy_skill_window.active = false
     return
   end
   if Input.trigger?(Input::C)
     case @draw_command_window.selection
     when Vocab::CommandDrawStock
       # Play decision SE
       Sound.play_decision
       @active_battler.action.set_skill(@enemy_skill_window.skill.id, 0)
       # Force the action to be executed
       @active_battler.action.forcing = true
       # End draw selection
       end_draw_command_selection
       # Switch to next actor
       next_actor
     when Vocab::CommandDrawCast
       Sound.play_decision
       # Prepare to cast a drawned skill
       @active_battler.action.set_skill(@enemy_skill_window.skill.id, 1)
       # Force the action to be executed
       @active_battler.action.forcing = true
       @active_battler.action.target_index = @enemy_skill_window.enemy.index
       # End draw selection
       end_draw_command_selection
       # Switch to next actor
       next_actor
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Actions
 #--------------------------------------------------------------------------
 def execute_action
   if @active_battler.action.draw?
     case @active_battler.action.draw_kind
     when 0 # Stock
       execute_action_draw_stock
       return
     when 1 # Cast
       execute_action_draw_cast
       return
     end
   end
   # The usual
   dargor_vx_draw_execute_action
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Skill
 #--------------------------------------------------------------------------
 def execute_action_skill
   skill = @active_battler.action.skill
   # Remove 1 skill number
   if @active_battler.is_a?(Game_Actor)# && 
       #!@active_battler.action.draw_kind == 0
     @active_battler.lose_skill(skill, 1)
   end
   # The usual
   dargor_vx_draw_execute_action_skill
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Draw Stock
 #--------------------------------------------------------------------------
 def execute_action_draw_stock
   text = sprintf(Vocab::UseDraw, @active_battler.name)
   @message_window.add_instant_text(text)
   targets = @active_battler.action.make_targets
   display_animation(targets, Skill_Draw::Animation_id)
   # Add skill number
   skill = @active_battler.action.skill
   gain = rand(9)
   if @active_battler.draw_success?(skill, gain)
     if @active_battler.is_a?(Game_Actor)
       @active_battler.gain_skill(skill, gain)
       @active_battler.learn_skill(skill.id)
     end
     name = skill.name
     name += 's' if gain > 1
     text = sprintf(Vocab::DrawGain, @active_battler.name, gain, name)
     @message_window.add_instant_text(text)
     wait(60)
   else
     text = sprintf(Vocab::DrawFail, @active_battler.name)
     @message_window.add_instant_text(text)
     wait(60)
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Draw Cast
 #--------------------------------------------------------------------------
 def execute_action_draw_cast
   # Add skill to known skills
   skill = @active_battler.action.skill
   $game_system.skill_drawned << skill.id
   # Cast the skill
   execute_action_skill
 end
end

 

Bugs e Conflitti Noti

N/A

 

Altri Dettagli

Preso da

Bazar:

Clicca qui!!

Link to comment
Share on other sites

  • 4 months later...

Skill Draw

Descrizione

Come in ff8, assimila le magie

 

Autore

Dargor

 

Allegati

Nessuno

 

Istruzioni per l'uso

Inserire sopra main

 

#======================================================================
========
# ** Skill Draw (FFVIII)
#------------------------------------------------------------------------------
#  © Dargor, 2008
#  08/05/08
#  Version 1.2
#------------------------------------------------------------------------------
#  VERSION HISTORY:
#   - 1.0 (11/05/08), Initial release
#   - 1.1 (14/05/08), Bug fixed with consuming skill number
#   - 1.2 (14/05/08), Bug fixed with initial skill number
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   1) Paste the script above main
#   2) Edit the Vocab variables
#   2) Edit the constants in the Skill_Draw module
#==============================================================================

# Command name
Vocab::CommandDraw = 'Draw'
Vocab::CommandDrawStock = 'Stock'
Vocab::CommandDrawCast = 'Cast'
Vocab::UnknownSkill = '??????'
Vocab::UseDraw = "%s uses #{Vocab::CommandDraw}!"
Vocab::DrawGain = "%s draw %s %s!"
Vocab::DrawFail = "%s's draw failed."

module Skill_Draw
 # The Draw Animation
 Animation_id = 41
 # Prevent from drawing specific enemy skills
 # SYNTAX: enemy_id => [skill_id, ...]
 Dont_Draw = {
               1 => [2,3]
             }
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :skill_drawned
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_system_initialize initialize
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   dargor_vx_draw_system_initialize
   @skill_drawned = []
 end
end
#==============================================================================
# ** Game_BattleAction
#------------------------------------------------------------------------------
#  This class handles battle actions. This class is used within the
# Game_Battler class.
#==============================================================================

class Game_BattleAction
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :draw_kind                # draw kind (stock/cast)
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_battle_action_clear clear
 alias dargor_vx_draw_battle_action_make_targets make_targets
 #--------------------------------------------------------------------------
 # * Clear
 #--------------------------------------------------------------------------
 def clear
   @draw_kind = -1
   # The usual
   dargor_vx_draw_battle_action_clear
 end
 #--------------------------------------------------------------------------
 # * Set Skill
 #     skill_id : skill ID
 #     draw_kind: draw kind (stock/cast)
 #--------------------------------------------------------------------------
 def set_skill(skill_id, draw_kind = -1)
   @kind = 1
   @skill_id = skill_id
   @draw_kind = draw_kind
 end
 #--------------------------------------------------------------------------
 # * Draw Determination
 #--------------------------------------------------------------------------
 def draw?
   return @kind == 1 && [0,1].include?(@draw_kind)
 end
 #--------------------------------------------------------------------------
 # * Create Target Array
 #--------------------------------------------------------------------------
 def make_targets
   targets = []
   if draw?
     targets.push(opponents_unit.smooth_target(@target_index))
     return targets
   end
   dargor_vx_draw_battle_action_make_targets
 end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler 
 #--------------------------------------------------------------------------
 # * Draw Success
 #     skill : skill
 #     number: number to draw
 #--------------------------------------------------------------------------
 def draw_success?(skill, number)
   return false unless self.is_a?(Game_Actor)
   return false if number == 0
   level_factor = (self.level / 10) / 2
   random = [10-level_factor, 0].max
   success = (self.level / 10) + rand(random) 
   return success >= number 
 end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :skills_number
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_actor_skill_can_use? skill_can_use?
 alias dargor_vx_draw_actor_setup setup
 #--------------------------------------------------------------------------
 # * Setup
 #     actor_id : actor ID
 #--------------------------------------------------------------------------
 def setup(actor_id)
   @skills_number = []
   dargor_vx_draw_actor_setup(actor_id)
   for i in self.class.learnings
     @skills_number[i.skill_id] == 1 if i.level <= @level
   end
   # Add battle commands
   case @actor_id
   when 1,2,3,4,5,6,7,8
     # Add 'Draw' to actor 1
     add_command(1, Vocab::CommandDraw)
   end
 end
 #--------------------------------------------------------------------------
 # * Learn Skill
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def learn_skill(skill_id)
   $game_system.skill_drawned << skill_id
   unless skill_learn?($data_skills[skill_id])
     @skills.push(skill_id)
     @skills.sort!
   end
 end
 #--------------------------------------------------------------------------
 # * Get Number of Items Possessed
 #     item : item
 #--------------------------------------------------------------------------
 def skill_number(skill)
   number = @skills_number[skill.id]
   return number == nil ? 0 : number
 end
 #--------------------------------------------------------------------------
 # * Determine Usable Skills
 #     skill : skill
 #--------------------------------------------------------------------------
 def skill_can_use?(skill)
   return false unless skill_number(skill) > 0
   dargor_vx_draw_actor_skill_can_use?(skill)
 end
 #--------------------------------------------------------------------------
 # * Gain Items (or lose)
 #     item          : Item
 #     n             : Number
 #     include_equip : Include equipped items
 #--------------------------------------------------------------------------
 def gain_skill(skill, n)
   $game_system.skill_drawned << skill.id
   number = skill_number(skill)
   @skills_number[skill.id] = [[number + n, 0].max, 99].min
   n += number
 end
 #--------------------------------------------------------------------------
 # * Lose Items
 #     item          : Item
 #     n             : Number
 #     include_equip : Include equipped items
 #--------------------------------------------------------------------------
 def lose_skill(skill, n)
   gain_skill(skill, -n)
 end
end

#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
 #--------------------------------------------------------------------------
 # * Skills
 #--------------------------------------------------------------------------
 def skills
   result = []
   for action in enemy.actions
     next unless action.skill?
     result << $data_skills[action.skill_id]
   end
   return result
 end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_Skill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   rect = item_rect(index)
   self.contents.clear_rect(rect)
   skill = @data[index]
   if skill != nil
     rect.width -= 4
     enabled = @actor.skill_can_use?(skill)
     draw_item_name(skill, rect.x, rect.y, enabled)
     self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
     # Draw skill number
     rect.x -= 24
     self.contents.draw_text(rect, ":", 2)
     rect.x -= 12
     skill_number = @actor.skill_number(skill)
     if enabled
       self.contents.font.color = text_color(3)
     end
     self.contents.draw_text(rect, skill_number.to_s, 2)
   end
 end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_EnemySkill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :enemy
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     x      : window x-coordinate
 #     y      : window y-coordinate
 #     width  : window width
 #     height : window height
 #     actor  : actor
 #--------------------------------------------------------------------------
 def initialize(x, y, width, height, enemy)
   super(x, y, width, height)
   @enemy = enemy
   @column_max = 2
   self.index = 0
   refresh
 end
 #--------------------------------------------------------------------------
 # * Skill
 #--------------------------------------------------------------------------
 def skill
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   @data = []
   for skill in @enemy.skills
     unless Skill_Draw::Dont_Draw[@enemy.id].nil?
       next if Skill_Draw::Dont_Draw[@enemy.id].include?(skill.id)
     end
     @data.push(skill)
   end
   @item_max = @data.size
   create_contents
   for i in 0...@item_max
     draw_item(i)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   rect = item_rect(index)
   self.contents.clear_rect(rect)
   skill = @data[index]
   if skill != nil
     rect.width -= 4
     draw_item_name(skill, rect.x, rect.y, true)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item Name
 #     item    : Item (skill, weapon, armor are also possible)
 #     x       : draw spot x-coordinate
 #     y       : draw spot y-coordinate
 #     enabled : Enabled flag. When false, draw semi-transparently.
 #--------------------------------------------------------------------------
 def draw_item_name(item, x, y, enabled = true)
   if item != nil
     draw_icon(item.icon_index, x, y, enabled)
     self.contents.font.color = normal_color
     self.contents.font.color.alpha = enabled ? 255 : 128
     if item.is_a?(RPG::Skill) && !$game_system.skill_drawned.include?(item.id)
       self.contents.draw_text(x + 24, y, 172, WLH, Vocab::UnknownSkill)
     else  
       self.contents.draw_text(x + 24, y, 172, WLH, item.name)
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
 end
 #--------------------------------------------------------------------------
 # * Update Help Text
 #--------------------------------------------------------------------------
 def update_help
   if $game_system.skill_drawned.include?(skill.id)
     @help_window.set_text(skill == nil ? "" : skill.description)
   else
     @help_window.set_text(skill == nil ? "" : Vocab::UnknownSkill)
   end
 end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 alias dargor_vx_draw_battle_update update
 alias dargor_vx_draw_update_actor_command_selection update_actor_command_selection
 alias dargor_vx_draw_execute_action execute_action
 alias dargor_vx_draw_execute_action_skill execute_action_skill
 alias dargor_vx_draw_update_target_enemy_selection update_target_enemy_selection
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   unless @enemy_skill_window != nil or @draw_command_window != nil
     dargor_vx_draw_battle_update
   else
     super
     update_basic(true)
     update_info_viewport                  # Update information viewport
     if $game_message.visible
       @info_viewport.visible = false
       @message_window.visible = true
     end
     unless $game_message.visible          # Unless displaying a message
       return if judge_win_loss            # Determine win/loss results
       update_scene_change
       if @enemy_skill_window.active
         update_enemy_skill_selection    # Select party changer command
       elsif @draw_command_window.active
         update_draw_command_selection    # Select party changer command
       end
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Update Actor Command Selection
 #--------------------------------------------------------------------------
 def update_actor_command_selection
   dargor_vx_draw_update_actor_command_selection
   if Input.trigger?(Input::C)
     case @actor_command_window.commands[@actor_command_window.index]
     when Vocab::CommandDraw
       Sound.play_decision
       start_target_enemy_selection
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Update Target Enemy Selection
 #--------------------------------------------------------------------------
 def update_target_enemy_selection
   if Input.trigger?(Input::C) && 
       @actor_command_window.selection == Vocab::CommandDraw
       Sound.play_decision
     Sound.play_decision
     @active_battler.action.target_index = @target_enemy_window.enemy.index
     start_draw_command_selection
     end_target_enemy_selection
     end_skill_selection
     end_item_selection
     return
   end
   dargor_vx_draw_update_target_enemy_selection
 end
 #--------------------------------------------------------------------------
 # * Start Draw Command Selection
 #--------------------------------------------------------------------------
 def start_draw_command_selection
   enemy = @target_enemy_window.enemy
   @help_window = Window_Help.new
   @help_window.y = 56
   @enemy_skill_window = Window_EnemySkill.new(0, 112, 544, 176, enemy)
   @enemy_skill_window.help_window = @help_window
   @enemy_skill_window.active = false
   s1 = Vocab::CommandDrawStock
   s2 = Vocab::CommandDrawCast
   @draw_command_window = Window_Command.new(544, [s1,s2], 2)
 end
 #--------------------------------------------------------------------------
 # * Update Draw Command Selection
 #--------------------------------------------------------------------------
 def update_draw_command_selection
   @draw_command_window.update
   @actor_command_window.active = false
   if Input.trigger?(Input::B)
     end_draw_command_selection
     return
   end
   if Input.trigger?(Input::C)
     @enemy_skill_window.active = true
     return
   end
 end
 #--------------------------------------------------------------------------
 # * End Draw Command Selection
 #--------------------------------------------------------------------------
 def end_draw_command_selection
   if @enemy_skill_window != nil
     @enemy_skill_window.dispose
     @enemy_skill_window = nil
     @draw_command_window.dispose
     @draw_command_window = nil
     @help_window.dispose
     @help_window = nil
   end
   @actor_command_window.active = true
 end
 #--------------------------------------------------------------------------
 # * Update Enemy Skill Selection
 #--------------------------------------------------------------------------
 def update_enemy_skill_selection
   @help_window.update
   @enemy_skill_window.update
   @actor_command_window.active = false
   if Input.trigger?(Input::B)
     @draw_command_window.active = true
     @enemy_skill_window.active = false
     return
   end
   if Input.trigger?(Input::C)
     case @draw_command_window.selection
     when Vocab::CommandDrawStock
       # Play decision SE
       Sound.play_decision
       @active_battler.action.set_skill(@enemy_skill_window.skill.id, 0)
       # Force the action to be executed
       @active_battler.action.forcing = true
       # End draw selection
       end_draw_command_selection
       # Switch to next actor
       next_actor
     when Vocab::CommandDrawCast
       Sound.play_decision
       # Prepare to cast a drawned skill
       @active_battler.action.set_skill(@enemy_skill_window.skill.id, 1)
       # Force the action to be executed
       @active_battler.action.forcing = true
       @active_battler.action.target_index = @enemy_skill_window.enemy.index
       # End draw selection
       end_draw_command_selection
       # Switch to next actor
       next_actor
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Actions
 #--------------------------------------------------------------------------
 def execute_action
   if @active_battler.action.draw?
     case @active_battler.action.draw_kind
     when 0 # Stock
       execute_action_draw_stock
       return
     when 1 # Cast
       execute_action_draw_cast
       return
     end
   end
   # The usual
   dargor_vx_draw_execute_action
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Skill
 #--------------------------------------------------------------------------
 def execute_action_skill
   skill = @active_battler.action.skill
   # Remove 1 skill number
   if @active_battler.is_a?(Game_Actor)# && 
       #!@active_battler.action.draw_kind == 0
     @active_battler.lose_skill(skill, 1)
   end
   # The usual
   dargor_vx_draw_execute_action_skill
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Draw Stock
 #--------------------------------------------------------------------------
 def execute_action_draw_stock
   text = sprintf(Vocab::UseDraw, @active_battler.name)
   @message_window.add_instant_text(text)
   targets = @active_battler.action.make_targets
   display_animation(targets, Skill_Draw::Animation_id)
   # Add skill number
   skill = @active_battler.action.skill
   gain = rand(9)
   if @active_battler.draw_success?(skill, gain)
     if @active_battler.is_a?(Game_Actor)
       @active_battler.gain_skill(skill, gain)
       @active_battler.learn_skill(skill.id)
     end
     name = skill.name
     name += 's' if gain > 1
     text = sprintf(Vocab::DrawGain, @active_battler.name, gain, name)
     @message_window.add_instant_text(text)
     wait(60)
   else
     text = sprintf(Vocab::DrawFail, @active_battler.name)
     @message_window.add_instant_text(text)
     wait(60)
   end
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Draw Cast
 #--------------------------------------------------------------------------
 def execute_action_draw_cast
   # Add skill to known skills
   skill = @active_battler.action.skill
   $game_system.skill_drawned << skill.id
   # Cast the skill
   execute_action_skill
 end
end

 

Bugs e Conflitti Noti

N/A

 

Altri Dettagli

Preso da

non funge da errore a questa riga non esiste il comando formulato cosi

 

add_command(1, Vocab::CommandDraw)

Un tempo la gente era convinta che quando qualcuno moriva, un corvo portava la sua anima nella terra dei morti; a volte però, accadevano cose talmente orribili, tristi e dolorose che l'anima non poteva riposare. Così a volte, ma solo a volte, il corvo riportava indietro l'anima perché rimettesse le cose a posto.Gioco in SviluppoAwakening the BeginningRisorse Sonore: 2%Risorse Grafiche: 20%Script: 80%Trama: 100%Mappe: 3%Battle System: 100% in modifica

Link to comment
Share on other sites

  • 6 months later...

Come dice l'autore dello script nel forum in lingua inglese

Notes

 

The script requires my Custom Commands script.

 

-Dargor

 

Post Custom Comands Script by Dargor @ rmxp.org

 

Link diretto alla demo dello script Custom Commands @ Mediafire

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

  • 2 weeks later...
Se ho capito bene...questo script ti permette di fare come il mago blu di FFTA che quando un mostro ti attacca il pg gli copi la magia che avrai per sempre, per tutti i combattimenti?
Link to comment
Share on other sites

Link to comment
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
 Share

×
×
  • Create New...