Bonsoir
en fouillant sur le net je suis tomber sur un sript permettant de rajouter des commande en combat que voici
Code:SÉLECTIONNER LE CONTENU
#===============================================================================
#
# 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", "-Subclass", "-Guard", "-Item"],
5 => ["-Attack", "-Skill", "Invocation", "Guard", "-Item"],
#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 => "",
2 => "X-Attack",
5 => "Invocation",
6 => "Darkness",
7 => "3-Attack",
} # 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
"X-Attack" => 1,
"3-Attack" => 3,
"Invocation" => 140,
"Darkness" => 80,
"Test" => 109,
} # 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"]
@commander.reset_mix_items
@commander.subskill_flag = nil
@commander.set_chain
end
determine_actor_command
else
update_actor_command_selection_cba
end
end
#--------------------------------------------------------------------------
# new method determine actor command
#--------------------------------------------------------------------------
def determine_actor_command
@commander.custom_action_flag = false
command = @actor_command_window.command
case command
when "-Attack"
Sound.play_decision
@commander.action.set_attack
start_target_enemy_selection
when "-Skill"
Sound.play_decision
start_skill_selection
when "-Guard"
Sound.play_decision
@commander.action.set_guard
end_command
when "-Item"
Sound.play_decision
start_item_selection
when "-Wait"
Sound.play_decision
@commander.action.kind = 0
@commander.action.basic = 3
end_command
else
unless YE::BATTLE::COMMANDS::CUSTOM_COMMANDS.include?(command)
Sound.play_buzzer
else
@commander.custom_action_flag = true
@skill = $data_skills[YE::BATTLE::COMMANDS::CUSTOM_COMMANDS[command]]
if @commander.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
@commander.action.set_skill(@skill.id)
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_command
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
#
#=======================
J'ai bien réussi a rajouter la commande invocation mais au lieu de m'ouvrir un autre menus avec les sort souhaiter (Skill ID 140), la commande invocation me lance directement mon sort sans me faire entrer dans un sous menus.
Questions :
-Sauriez vous comment faire pour faire en sorte que ma commande invocation devienne un commande comme skill, c'est a dire que lorsque j’appuie dessus ça m'ouvre un sous menus avec une liste des sort definis.
PS : j'ai bien essayer de mettre un autre sort a coter de "Invocation" => 140,(ligne 91)
mais le jeu plante.