WR Heart rpg
Vuoi reagire a questo messaggio? Crea un account in pochi clic o accedi per continuare.

Nemici che usano gli item

Andare in basso

Iconxp Nemici che usano gli item

Messaggio Da Yushi II il Mer Mag 16, 2012 7:05 pm

Nemici che usano gli item

Autore
DerVVulfman -Fomar0153

Script
Spoiler:


Codice:
#======================================================================
 ========
 # ** Enemies Use Items
 #------------------------------------------------------------------------------
 # by Fomar0153
 # version 2
 # 04-27-2007
 # Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
 #------------------------------------------------------------------------------
 #
 # INTRODUCTION:
 #
 # This system allows enemy battlers to use items during battle. This is accom-
 # plished by switching the skill used by an enemy to that of an item in a pre-
 # defined list in the configuration section.
 #
 # By example, you could set up a Skeleton enemy to use a 'Tonic' in battle when
 # it performs its 'Sleep' skill. This 'skill-to-item' change would have to be
 # defined in either the SWITCH_SKILL_ITEM hash, or the SWITCH_ENEMY_SKILL_ITEM
# hash (explained in the configuration section below).
 #
 # The enemies can either have infinite item usage, or can be limited to the no.
 # of items used based on the SP points at their disposal. This feature is con-
 # trolled by the SWITCH_SP_LIMIT value. As long as it is false, enemies can use
 # items without running out. But if it is true, the enemies will use up their
 # SP points as they use items. The SP points used will be based on the SP Cost
 # of the Skill it is switched from.
 #
 #------------------------------------------------------------------------------
 #
 # COMPATABILITY:
 #
 # This system is compatible with the default battlesystem, SDK 2.2, the RTAB
 # system, Fomar's Action Cost, ParaDog's and XRXS's battle system in certain
 # limits.
 #
 # Systems that use AT bars (everything except the 'default' and 'SDK default'
# battlesystems) must have the SWITCH_SP_LIMIT value set to 'false'. All other
 # systems either use up the enemy sp through repeated calls of the make_action
 # def as their AT gauges are filled, or uses values other than sp_cost.
 #
 # In short, the 'SWITCH_SP_LIMIT' value can only be 'true' if you're using the
 # default or SDK default battlesystems.
 #
 #==============================================================================
 

#========================================================================
 # ** C O N F I G U R A T I O N S Y S T E M ** #
 #========================================================================
 

# This constant holds the list of skills and items they are switched with. It
 # is in the following format: { skill.id => item.id, skill.id => item.id,... }
 # The sample currently switches the "Heal" skill with the "Sharp Stone" item,
# and the "Greater Heal" with the "Potion" item.
 SWITCH_SKILL_ITEM = {1 => 13, 2 => 1}
 

# This constant holds the lists of skills & items switched for each enemy that
 # uses them. The format to apply the switch mimics the design to the one above:
 # { enemy.id => ( skill.id => item.id), enemy.id =>{ skill.id => item.id},... }
 # The sample currently switches the "Mass Heal" skill with the "Tonic" item for
 # the GHOST enemy, and changes the "Heal" skill with the "Barrier Stone" item
 # for the BASILISK enemy.
 SWITCH_ENEMY_SKILL_ITEM = { 1 => {3 => 9}, 2 => {1 => 14}}

 
# This merely determines if you limit the items based on Skill SP cost. If this
 # is true, then the enemy must have enough SP to use the original skill before
 # the item is used. If it is false, then the enemy has an infinite supply.
 SWITCH_SP_LIMIT = false
 

#==============================================================================
 # ** Game_Enemy
 #------------------------------------------------------------------------------
 # This class handles enemies. It's used within the Game_Troop class
 # ($game_troop).
 #==============================================================================
 
class Game_Enemy < Game_Battler
 #--------------------------------------------------------------------------
 # * Make Action
 #--------------------------------------------------------------------------
alias item_make_action make_action
 def make_action
 item_make_action
 temp_hash = {}
 switch_id = self.current_action.skill_id
# Sets the Skill Limiting switch if the SWITCH_SP_LIMIT is true.
 # If true, this sets 'sp_limted' to true if SP is too low for item use.
 if SWITCH_SP_LIMIT
 if $data_skills[switch_id].sp_cost > self.sp
 sp_limited = true
 else
 sp_limited = nil
 end
 else
 sp_limited = nil
 end
 # Perform Skill/Item switch if 'sp_limited' switch isn't true.
 # It won't be true if there's enough SP, or if SWITCH_SP_LIMITED is false.
 if !sp_limited
 if SWITCH_SKILL_ITEM.include? switch_id
 self.current_action.kind = 2
 self.current_action.item_id = SWITCH_SKILL_ITEM[switch_id]
self.current_action.decide_random_target_for_enemy
end
 temp_hash = SWITCH_ENEMY_SKILL_ITEM[self.id] if SWITCH_ENEMY_SKILL_ITEM.include? self.id
 if temp_hash.include? switch_id
 self.current_action.kind = 2
 self.current_action.item_id = temp_hash[switch_id]
self.current_action.decide_random_target_for_enemy
end
 end
 # Use up SP (If SWITCH_SP_LIMIT is true)
 if SWITCH_SP_LIMIT
 self.sp =- $data_skills[switch_id].sp_cost
 end
 end
 end
 


#==============================================================================
 # ** Scene_Battle
 #------------------------------------------------------------------------------
 # This class performs battle screen processing.
 #==============================================================================
 
class Scene_Battle
 #--------------------------------------------------------------------------
 # * Make Item Action Results
 #--------------------------------------------------------------------------
alias e_make_item_action_result make_item_action_result
 def make_item_action_result(battler = @active_battler)
 @rtab = !@target_battlers
 if @active_battler.is_a?(Game_Actor)
 @rtab ? e_make_item_action_result(battler) : e_make_item_action_result
 else
 # Get item
 @item = $data_items[battler.current_action.item_id]
 if @rtab
 # Setting animation ID
 battler.anime1 = @item.animation1_id
 battler.anime2 = @item.animation2_id
 # Setting common event ID
 battler.event = @item.common_event_id
else
 # Display item name on help window
 @help_window.set_text(@item.name, 1)
 # Set animation ID
 @animation1_id = @item.animation1_id
 @animation2_id = @item.animation2_id
 # Set common event ID
 @common_event_id = @item.common_event_id
 end
 # Deciding the object
 index = battler.current_action.target_index
 target = $game_party.smooth_target_actor(index)
if @rtab
 # Setting the object side battler
 set_target_battlers(@item.scope, battler)
# Applying the effect of the item
 for target in battler.target
 target.item_effect(@item, battler)
 end
 else
 # Set targeted battlers
 set_target_battlers(@item.scope)
 # Apply item effect
 for target in @target_battlers
 target.item_effect(@item)
 end
 end
 end
 end
 end
Yushi II
Yushi II

Data d'iscrizione : 09.07.11
Età : 30

Torna in alto Andare in basso

Torna in alto


 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.