Invité Invité
| Sujet: Double action pour les monstres Lun 14 Jan 2008, 10:24 | |
| Auteur: Nikoleis Il faut copier les variables et les accesseurs dans les classes d'origine (sinon, il râle avec " current_action2"). Pour le reste, un nouveau script suffit. Modifier " dual_turn?" dans " Game_Enemy" pour que cela corresponde a vos monstres ayant 2 attaques ! - Code:
-
class Game_Battler
attr_accessor :second_action @current_action2 = Game_BattleAction.new @second_action = true
def current_action return @current_action end def current_action2 return @current_action2 end def second_action return @second_action end
def make_action_speed(turn,dual) m = agi + rand(10 + agi / 3) n = agi + rand(10 + agi / 3) if dual if m > n @current_action.speed = m @current_action2.speed = n else @current_action.speed = n @current_action2.speed = m end else @current_action.speed = m end end end
class Game_Actor def dual_turn? return false end def first_attack @second_attack = false end def second_attack @second_attack = true end
end
class Game_Enemy
#----------------------------------------------- def make_action2 self.current_action2.clear unless self.movable? return end available_actions = [] rating_max = 0 for action in self.actions n = $game_temp.battle_turn a = action.condition_turn_a b = action.condition_turn_b if (b == 0 and n != a) or (b > 0 and (n < 1 or n < a or n % b != a % b)) next end if self.hp * 100.0 / self.maxhp > action.condition_hp next end if $game_party.max_level < action.condition_level next end switch_id = action.condition_switch_id if switch_id > 0 and $game_switches[switch_id] == false next end if exclude_pointless_actions(action) next end available_actions.push(action) if action.rating > rating_max rating_max = action.rating end end ratings_total = 0 for action in available_actions ratings_total += action.rating end if ratings_total > 0 choose_action = [] for action in available_actions for j in 1..action.rating choose_action.push(action) end end enemy_action = choose_action[rand(choose_action.size - 1)] self.current_action2.kind = enemy_action.kind self.current_action2.basic = enemy_action.basic self.current_action2.skill_id = enemy_action.skill_id self.current_action2.decide_random_target_for_enemy end end def dual_turn? case self.id when 1 return(true) end return(false) end end
class Scene_Battle
def start_phase4 @phase = 4 $game_temp.battle_turn += 1 for index in 0...$data_troops[@troop_id].pages.size page = $data_troops[@troop_id].pages[index] if page.span == 1 $game_temp.battle_event_flags[index] = false end end @actor_index = -1 @active_battler = nil @party_command_window.active = false @party_command_window.visible = false @actor_command_window.active = false @actor_command_window.visible = false $game_temp.battle_main_phase = true for enemy in $game_troop.enemies enemy.make_action if enemy.dual_turn? enemy.second_action = true enemy.make_action2 end end make_action_orders @phase4_step = 1 end
def make_action_orders @action_battlers @action_battlers = [] @action_battlers for enemy in $game_troop.enemies @action_battlers.push(enemy) end @action_battlers for actor in $game_party.actors @action_battlers.push(actor) end for battler in @action_battlers battler.make_action_speed($game_temp.battle_turn,battler.dual_turn?) end @action_battlers.sort! {|a,b| b.current_action.speed - a.current_action.speed } end
def update_phase4_step2 unless @active_battler.current_action.forcing if @active_battler.restriction == 2 or @active_battler.restriction == 3 @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 0 end if @active_battler.restriction == 4 $game_temp.forcing_battler = nil @phase4_step = 1 return end end @target_battlers = [] case @active_battler.current_action.kind when 0 make_basic_action_result when 1 make_skill_action_result when 2 make_item_action_result end if(@active_battler.is_a?(Game_Enemy) and @active_battler.dual_turn? and @active_battler.second_action == true) @active_battler.current_action.speed = @active_battler.current_action2.speed @active_battler.current_action.kind = @active_battler.current_action2.kind @active_battler.current_action.basic = @active_battler.current_action2.basic @active_battler.current_action.skill_id = @active_battler.current_action2.skill_id @active_battler.current_action.item_id = @active_battler.current_action2.item_id @active_battler.current_action.target_index = @active_battler.current_action2.target_index @active_battler.current_action.forcing = @active_battler.current_action2.forcing @active_battler.second_action = false @action_battlers.push(@active_battler) @action_battlers.sort! {|a,b| b.current_action.speed - a.current_action.speed } end if @phase4_step == 2 @phase4_step = 3 end end end EDIT By DeadcellEDIT de NikoleisDésolé, j'avais pas vu l'option ! La fonction du script est évidente : elle permet aux monstres sélectionnés d'avoir deux action à chaque tour de combat, comme le dit le titre. Je pensais que ca suffirait. Promis, j'essaie de m'amélorer sur le forum !
Dernière édition par le Jeu 17 Jan 2008, 07:49, édité 1 fois |
|
deadcell Trouvère Follet
Nombre de messages : 625 Age : 35 Niveau Rpg Maker : Excellent Niveau Jeux Préférés : Final Fantasy, Resident evil... Date d'inscription : 21/03/2007
| Sujet: Re: Double action pour les monstres Lun 14 Jan 2008, 14:09 | |
| Pense à mettre les "codes" la prochaine fois, et si tu pouvais Editer pour nous expliquer la fonction de ce script, afin que ce soit plus clair pour les autres membres. Merci | |
|