Aventurier Lv.16
Age : 40 Inscrit le : 03/09/2009 Messages : 1503
| Sujet: Problème avec le "Custom Battle Actions" de Yanfly. Lun 6 Juin 2011 - 14:32 | |
| Bonjour ! Voilà, j'ai un léger souci avec ce script, du moins ça fait un moment que ce problème est présent dans mon projet et c'est le seul bug que je n'ai pas réussi à résoudre. =( Description du problème Voici l'écran de combat, tout est normal. - Spoiler:
Seulement si je choisis une compétence rajouter à l'aide du script et que j'annule mon choix deux problèmes se présentent. Le premier en images: - Spoiler:
- Spoiler:
Les fenêtres sont décalés et le plus chiant, c'est qu'elles continueront de se décaler si a refait la même manip. Le second problème: le tour est réinitialisé. Si on choisit l'action des personnages 1 et 2 et qu'on annule la compétence avec le 3, on doit refaire l'action 1 et 2, ce n'est pas la mort, mais le vrai problème intervient sur les effets néfastes, si un personnage est empoisonné il perdra à nouveau des points de vies, les sorts qui ont un effet de boost sur l'attaque pendant 3 tours par exemple gagneront 1 en compteur que ce soit celle des personnages que je contrôle ou de mes adversaires. Le script: - Code:
-
#=============================================================================== # # Yanfly Engine RD - Custom Battle Actions # Last Date Updated: 2009.06.25 # Level: Normal # # For those who would like to have more than just Attack, Skill, Guard, and # Item for their actions in their list, this script allows just that. You can # rearrange the ordering of the actions, bind new custom actions to skills, # and even incorporate subskill actions into the individual command lists. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.06.25 - Bug fix for enemy targetting cancel selection. # o 2009.06.23 - Compatibility update with Custom Skill Effects Upgrade 3. # o 2009.06.21 - Bug fix for ally targetting custom skill cancel. # o 2009.05.28 - Started script and finished. #=============================================================================== # Instructions #=============================================================================== # # Scroll down below and modify the module to reflect how you would like the # battle commands to appear for each class-type. # #=============================================================================== # # Compatibility # - Works With: Yanfly Custom Skill Effects # - Alias: Game_Actor: skill_can_use? # - Overwrites: Scene_Battle, execute_action_wait, update_actor_command # - Overwrites: Window_ActorCommand: all of it # #===============================================================================
$imported = {} if $imported == nil $imported["CustomBattleActions"] = true
module YE module BATTLE module COMMANDS
#------------------------------------------------------------------------ # CLASS COMMANDS #------------------------------------------------------------------------ # This following section will adjust commands for individual classes. If # a class ID is not included, it will take out the commands from class 0. # With that said, do not remove class 0. # # There are a few commands verbal commands reserved for the command hash. # "-Attack" - Reserved for basic attacking. # "-Skill" - Reserved for selecting skills. # "-Guard" - Reserved for guarding. # "-Item" - Reserved for using items. # "-Wait" - Reserved for the wait command. # "-Subclass" - Reserved for subclass skills. # "" - If empty, skip it. # # If you input other commands, be sure to spell them correctly as they # will reflect upon how it appears in game. #------------------------------------------------------------------------ # Note that class commands will be determined by the character's primary # class if you're using the Subclass Selection System. #------------------------------------------------------------------------ CLASS_COMMANDS ={ # DO NOT REMOVE CLASS ID ZERO! # ClassID => [ Actions, Actions, Actions...] 0 => ["-Attack", "-Skill", "Angel", "-Item"], 1 => ["-Attack", "-Skill", "Angel", "-Item"], 2 => ["-Attack", "-Skill", "Furtivita'", "-Item"], 3 => ["-Attack", "-Subclass", "-Skill", "-Guard", "-Item"], 4 => ["-Attack", "-Skill", "Ratatouille", "-Item"], 17 => ["Morsure", "-Skill", "Syphair", "Absorber","-Item",], 18=>["Griffe", "-Skill", "Puissance", "Absorber", "-Item",], 19 => ["Griffe", "-Skill", "Secousse", "Absorber", "-Item"], 20 => ["Charge", "-Skill", "Bubulle", "Eau de vie"], 21 => ["Baffe", "-Skill", "Illusion", "Etoile du Nord"], 22 => ["Venin", "-Skill", "Analyse", "Dodo"], 23 => ["Griffe", "-Skill", "Coup Mortel"], 24 => ["Morsure", "-Skill", "Croc", "Absorber", "-Item"], 25 => ["Morsure", "-Skill", "-Guard", "-Item"], 26 => ["Charge", "-Skill", "Vitesse", "-Guard"], 27 => ["Charge", "-Skill", "Corps de pierre", "Absorber", "-Item"], 28 => ["Charge", "-Skill", "Grognement", "-Item"], 29 => ["Charge", "-Skill", "Endurance", "Corps de pierre"], 30 => ["Charge", "-Skill", "Hurlement", "Obscurité"], 31 => ["Charge", "-Skill", "Grognement", "-Item"], 33 => ["Morsure", "-Skill", "Absorber", "Boule de feu", "-Item",], 34 => ["Piqûre", "-Skill", "Filet",], 51 => ["Morsure", "-Skill", "Grognement", "Vitesse", "-Item",], 54 => ["Électrochoc", "-Skill", "Grognement", "Absorber", "-Item",], 55 => ["Griffe", "-Skill", "Flambée"], 56 => ["Venin", "-Skill", "Analyse", "Visée", "Absorber", "-Item",], 57 => ["Venin", "-Skill", "Analyse", "Coup d'air", "Absorber", "-Item",], 58 => ["Auto-SP", "-Skill", "Analyse", "-Guard"], 59 => ["Charge", "-Skill", "Armaggeddon", "Absorber"], 61 => ["Contamination", "-Skill", "Bubble Poison", "Vitesse"], 62 => ["Combo double", "-Skill", "Puissance", "Absorber", "-Item",], 63 => ["Morsure", "-Skill", "Absorber", "Boule de feu", "-Item",], 64 => ["Morsure", "-Skill", "Auto-flamma", "Grande Garde",], 65 => ["Lechouille", "-Skill", "Tremble", "-Item",], 66 => ["Charge", "-Skill", "Chant", "Auto-SP",], 68 => ["Charge", "-Skill", "Augmentation", "-Guard",], 69 => ["Charge", "-Skill", "Bubulle", "Coeur de Diamant",], 151 => ["FurieMax", "-Skill", "Grognement", "-Guard"], 300 => ["Combo-Griffes", "-Skill", "Puissance", "Grande Garde"], #1 => ["X-Attack", "-Skill", "-Subclass", "-Guard", "-Item"], } # Do not remove this.
# This following hash will determine what commands to replace when the # "-Subclass" command is inputted into the array of commands. If the # subclass's ID does not appear in this array, then it will return 0. SUBCLASS_COMMANDS ={ # DO NOT REMOVE CLASS ID ZERO! # ClassID => Name 0 => "", 1 => "Angel", 4 => "Ratatouille", 2 => "X-Attack", 5 => "Light", 7 => "3-Attack", 9 => "Furtivita'", 10 => "Concentrazione", 11 => "Assimila", 12 => "Medicina", 6=>"Attaque X2"
} # Do not remove this.
# The following hash allows you to adjust which custom commands to bind # to which skills for the actions to come out of. The custom actions will # still consume HP/MP/Rage. If it's unusable, then it'll be greyed out. CUSTOM_COMMANDS ={ # Follow the example. # -Command Name- => Skill.ID "Attaque X2" => 1, "Grande Garde" => 133, "Combo double" => 176, "FurieMax" => 177, "Combo-Griffes" => 178, "Analyse" => 200, "Absorber" => 201, "Evasion" => 204, "Endurance" => 221, "Vitesse" => 224, "Augmentation" => 225, "Flambée" => 245, "Charge" => 500, "Bubulle" => 501, "Eau de vie" => 502, "Baffe" => 503, "Illusion" => 504, "Etoile du Nord" => 505, "Dodo" => 506, "Griffe" => 507, "Coup Mortel" => 508, "Morsure" => 509, "Croc" => 510, "Syphair" => 511, "Puissance" => 512, "Secousse" => 513, "Venin" => 515, "Auto-SP" => 516, "Bubble Poison" => 517, "Boule de feu" => 518, "Contamination" => 519, "Piqûre" => 521, "Filet" => 522, "Lechouille" => 527, "Chant" => 528, "Électrochoc" => 659, "Auto-flamma" => 706, "Corps de pierre" => 717, "Obscurité" => 723, "Hurlement" => 724, "Grognement" => 726, "Visée" => 727, "Coup d'air" => 728, "Armaggeddon" => 729, "Tremble" => 731, "Coeur de Diamant" => 744
} # Do not remove this.
# For those who use "-Wait" and would like to change how Wait appears, # adjust the value below. Also following is how the action takes place. WAIT_VOCAB = "Wait" ACTION_WAIT = "%s is waiting." # Set to nil to not show wait.
end # COMMANDS end # BATTLE end # YE
#=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #===============================================================================
module Vocab DoWait = YE::BATTLE::COMMANDS::ACTION_WAIT end
#============================================================================== # Game_Actor #==============================================================================
class Game_Actor < Game_Battler
#-------------------------------------------------------------------------- # Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :custom_action_flag
#-------------------------------------------------------------------------- # alias skill_can_use? #-------------------------------------------------------------------------- alias skill_can_use_cba skill_can_use? unless $@ def skill_can_use?(skill) if @custom_action_flag == true return super else return skill_can_use_cba(skill) end end
end
#=============================================================================== # Scene_Battle #===============================================================================
class Scene_Battle < Scene_Base
#-------------------------------------------------------------------------- # alias execute_action_wait #-------------------------------------------------------------------------- alias execute_action_wait_cba execute_action_wait unless $@ def execute_action_wait if Vocab::DoWait != nil execute_action_wait_cba end end
#-------------------------------------------------------------------------- # alias end_target_enemy_selection #-------------------------------------------------------------------------- alias end_target_enemy_selection_cba end_target_enemy_selection unless $@ def end_target_enemy_selection end_target_enemy_selection_cba if @skill_window == nil @actor_command_window.active = true end end
#-------------------------------------------------------------------------- # alias end_target_actor_selection #-------------------------------------------------------------------------- alias end_target_actor_selection_cba end_target_actor_selection unless $@ def end_target_actor_selection end_target_actor_selection_cba if @skill_window == nil @actor_command_window.active = true end end
#-------------------------------------------------------------------------- # alias update actor command selection #-------------------------------------------------------------------------- alias update_actor_command_selection_cba update_actor_command_selection unless $@ def update_actor_command_selection if Input.trigger?(Input::C) if $imported["CustomSkillEffects"] @active_battler.reset_mix_items @active_battler.subskill_flag = nil @active_battler.set_chain end determine_actor_command else update_actor_command_selection_cba end end
#-------------------------------------------------------------------------- # new method determine actor command #-------------------------------------------------------------------------- def determine_actor_command @active_battler.custom_action_flag = false command = @actor_command_window.command case command when "-Attack" Sound.play_decision @active_battler.action.set_attack start_target_enemy_selection when "-Skill" Sound.play_decision start_skill_selection when "-Guard" Sound.play_decision @active_battler.action.set_guard next_actor when "-Item" Sound.play_decision start_item_selection when "-Wait" Sound.play_decision @active_battler.action.kind = 0 @active_battler.action.basic = 3 next_actor else unless YE::BATTLE::COMMANDS::CUSTOM_COMMANDS.include?(command) Sound.play_buzzer else @active_battler.custom_action_flag = true @skill = $data_skills[YE::BATTLE::COMMANDS::CUSTOM_COMMANDS[command]] if @active_battler.skill_can_use?(@skill) Sound.play_decision if $imported["CustomSkillEffects"] and @skill.mix_items start_skill_selection create_mix_item_windows elsif $imported["CustomSkillEffects"] and @skill.subskills != [] start_skill_selection create_subskill_windows elsif $imported["CustomSkillEffects"] and @skill.chain_type > 0 start_skill_selection create_chain_windows elsif $imported["CustomSkillEffects"] and @skill.throw_skill start_skill_selection create_throw_windows else determine_custom_action end else Sound.play_buzzer end end end end
#-------------------------------------------------------------------------- # determine_custom_action #-------------------------------------------------------------------------- def determine_custom_action @active_battler.action.set_skill(@skill.id) if @skill.need_selection? if @skill.for_opponent? start_target_enemy_selection else start_target_actor_selection end else next_actor end end
end # Scene_Battle
#=============================================================================== # Window_ActorCommand #===============================================================================
class Window_ActorCommand < Window_Selectable
#-------------------------------------------------------------------------- # overwrite initialize #-------------------------------------------------------------------------- def initialize super(0, 0, 128, 128) self.active = false end
#-------------------------------------------------------------------------- # overwrite setup #-------------------------------------------------------------------------- def setup(actor) @actor = actor @commands = [] if YE::BATTLE::COMMANDS::CLASS_COMMANDS.include?(@actor.class.id) array = YE::BATTLE::COMMANDS::CLASS_COMMANDS[@actor.class.id] else array = YE::BATTLE::COMMANDS::CLASS_COMMANDS[0] end for command in array if command == "-Subclass" if subclass_check? command = YE::BATTLE::COMMANDS::SUBCLASS_COMMANDS[@actor.subclass.id] else command = "" end end @commands.push(command) unless command == "" end @item_max = @commands.size refresh self.index = 0 end
#-------------------------------------------------------------------------- # subclass check #-------------------------------------------------------------------------- def subclass_check? return false unless $imported["SubclassSelectionSystem"] return false if @actor.subclass == nil sub_id = @actor.subclass_id return false if !YE::BATTLE::COMMANDS::SUBCLASS_COMMANDS.include?(sub_id) return true end
#-------------------------------------------------------------------------- # overwrite refresh #-------------------------------------------------------------------------- def refresh create_contents for i in 0...@item_max draw_item(i) end end
#-------------------------------------------------------------------------- # return command #-------------------------------------------------------------------------- def command return @commands[self.index] end
#-------------------------------------------------------------------------- # new method draw item #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color cmd = @commands[index] #--- case cmd when "-Attack" text = Vocab::attack when "-Skill" if @actor.class.skill_name_valid text = @actor.class.skill_name else text = Vocab::skill end when "-Guard" text = Vocab::guard when "-Item" text = Vocab::item when "-Wait" text = YE::BATTLE::COMMANDS::WAIT_VOCAB else text = cmd if YE::BATTLE::COMMANDS::CUSTOM_COMMANDS.include?(cmd) skill = $data_skills[YE::BATTLE::COMMANDS::CUSTOM_COMMANDS[cmd]] @actor.custom_action_flag = true enabled = @actor.skill_can_use?(skill) @actor.custom_action_flag = false else enabled = false end end #--- self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text) end
end # Window_ActorCommand
#=============================================================================== # # END OF FILE # #=============================================================================== Je remercie par avance, les personnes qui arriveront là ou j'ai échoué. =) |
|