Bonjour,
J'ai modifié l'interface de combat elle ressemble à ceci :

Cependant, parfois, quelque soit l'item sur lequel je suis, (par item j'entends : ATK / SAC / PKMN / FUITE) cela selectionne toujours le même item.
Exemple : J'entre en combat, je veux selectionner ATK mais cela ouvre le sac. Et lorsque ça arrive une le seul moyen de s'en défaire c'est de quitter le combat (ce qui est impossible si on peut uniquement sélectionner le sac ou les pokémons) Dans cas, quelque soit l'item que je sélectionne, cela va ouvrir le sac. (et parfois cela se bloque sur Fuite ou sur pokemon, ou sur atk) Le bug n'arrive pas tout le temps et n'apparaissait pas du tout quand j'étais en alpha 0.22, je ne serais pas dire depuis quelle version ça fait ça. :/
Voilà ce que j'ai modifié : (les scripts qui sont directement sur mon projet)
Interface de combat - Arrows (Voir la fonction update_phase2)
# Header: psdk.pokemonworkshop.com/index.php/ScriptHeader
# Author: Nuri Yuri
# Date: 2014
# Update: 2014-mm-dd
# ScriptNorm: No
# Description: Définition de la phase de choix de l'action à réaliser
class Scene_Battle
#===
#>start_phase2 : Initialisation du choix pour le pokémon index
#===
def start_phase2(index=0)
# Remise à 0 de l'avancement de la phase 4 (on passe forcément ici)
@phase4_step = 0
@phase = 2
return if judge
@action_selector.pos_selector(@action_index=0)
#Vidage des actions si on retourne au premier actor :d
@actor_actions.clear if index == 0
#Si le Pokémon est KO on le saute
if @actors[index].dead?
@actor_actions.push([-1])
return update_phase2_next_act
#Si une attaque est forcée on la force :D
elsif @actors[index].battle_effect.has_forced_attack?
@actor_actions.push([0,@actors[index].battle_effect.get_forced_attack(@actors[index]),
-@actors[index].battle_effect.get_forced_position-1,@actors[index]])
return update_phase2_next_act
#> Si le Pokémon doit se reposer
elsif @actors[index].battle_effect.must_reload
@actor_actions.push([0, @actors[index].find_last_skill_position, 0,@actors[index]])
return update_phase2_next_act
end
display_message(_parse(18, 71, '[VAR 010C(0000)]' => @actors[index].given_name),false) if @Actions_To_DO.size==0
@action_selector.pokemon = @actors[index]
@action_selector.visible = true
0 while get_action
launch_phase_event(2,true)
end
#===
#>update_phase2
#Méthode qui va mettre à jour le choix Attaquer, Sac, PKMN, Fuite
#===
def update_phase2
#> Actions forcés par le tutoriel
forced_action = get_action
if !forced_action and Input.trigger?(1) #>Souris
forced_action, @action_index = @action_selector.mouse_action(@action_index)
@action_selector.pos_selector(@action_index)
end
if Input.trigger?(:LEFT) and !forced_action or forced_action==:LEFT
@action_index = ((@action_index == 0) ? 3 : (@action_index == 1) ? 0 : (@action_index == 2) ? 1 : 2)
elsif Input.trigger?(:RIGHT) and !forced_action or forced_action==:RIGHT
@action_index = ((@action_index == 0) ? 1 : (@action_index == 1) ? 2 : (@action_index == 2) ? 3 : 0)
elsif Input.trigger?(:A) and !forced_action or forced_action==:A
return on_phase2_validation
elsif Input.trigger?(:B) and !forced_action or forced_action==:B
if @actor_actions.size>0 and @actor_actions[-1][0] != 1 #> Empêchement du retour pour les objets
$game_system.se_play($data_system.decision_se)
start_phase2(@actor_actions.size-1)
end
end
#Reposition du sprite de selection
@action_selector.pos_selector(@action_index)
end
#===
#>update_phase2_next_act
#Méthode permettant de sauter l'actor en cours pour le suivant ou la phase 4
#===
def update_phase2_next_act
if $game_temp.vs_type==2 and @actors[1] and
!@actors[1].dead? and @actor_actions.size==1
unless(@actor_actions[0][0] == 1 and @actor_actions[0][1][1][:ball_data])
start_phase2(1)
return
end
end
launch_phase_event(4,false)
@to_start=:start_phase4
end
#===
#>update_phase2_escape
#Méthode de fuite (menu fuite)
#===
def update_phase2_escape(auto_return=false)
success = rand(256) < phase2_flee_factor
$game_temp.vs_type.times do |i|
next unless @actors[i]
#>Boule fumée / Carapace Mue / Fuite
if !$game_temp.trainer_battle and
(BattleEngine::_has_items(@actors[i],228,295) or
BattleEngine::Abilities.has_ability_usable(@actors[i],9))
return true if auto_return
$game_system.se_play($data_system.escape_se)
display_message(_get(18,75))
battle_end(1)
return
end
success&&=BattleEngine::_can_switch(@actors[i])
end
return success if auto_return
#Si c'est un succès on lance la fin du combat avec l'argument fuite
if success
$game_system.se_play($data_system.escape_se)
display_message(_get(18,75))
battle_end(1)
else
display_message(_get(18,76))
launch_phase_event(4,false)
@to_start=:start_phase4
end
end
end
Interface de combat - Selectors - sert à ajouter les nouvelles images
class Scene_Battle
class Action_Selector
Bar="Choice_4"
Selector="Choice_Select"
Selector2="Choice_Select2"
Selector3="Choice_Select3"
Selector4="Choice_Select4"
# Creates a new Action Selector interface
def initialize
super(nil)
push(0, 0, "choice_4").z = 10005
@select_sprite = push(0, 0, "choice_select")
@select_sprite.z = z = 10006
self.visible = false
self.pos_selector(0)
end
# Sets the position of the selector
# @param action_index [Integer] the index of the action (0 to 3)
def pos_selector(action_index)
sprite = @select_sprite
sprite.angle = 0
sprite.ox = sprite.oy = 0
sprite.mirror = false
case action_index
when 0 #> Attaquer
@select_sprite.bitmap = RPG::Cache.interface(Selector)
sprite.x = 0
sprite.y = 0
when 1 #> Pokémon
@select_sprite.bitmap = RPG::Cache.interface(Selector2)
sprite.x = 0
sprite.y = 0
when 2 #> Sac
@select_sprite.bitmap = RPG::Cache.interface(Selector3)
sprite.x = 0
sprite.y = 0
else
@select_sprite.bitmap = RPG::Cache.interface(Selector4)
sprite.x = 0
sprite.y = 0
end
end
# Sets the Pokemon used to show the Action Selector
alias pokemon= data=
# Ranges that describe the Attack button surface
ATK = [257..319, 29..161]
# Ranges that describe the Pokemon button surface
POK = [0..61, 32..93]
# Ranges that describe the Bag button surface
BAG = [0..61, 100..161]
# Ranges that describe the Flee button surface
RUN = [98..221, 158..191]
# Action to do when mouse clicks on the interface
# @param index [Integer] the index of the current action
# @return [Array(Symbol, Integer)] forced_action, new_index
# @note forced_action return can be nil
def mouse_action(index)
mx, my = @stack[0].translate_mouse_coords
return :A, 0 if ATK[0].include?(mx) and ATK[1].include?(my)
return :A, 1 if POK[0].include?(mx) and POK[1].include?(my)
return :A, 2 if BAG[0].include?(mx) and BAG[1].include?(my)
return :A, 3 if RUN[0].include?(mx) and RUN[1].include?(my)
return nil, index
end
end
end
Interface de combat - Position Skills (Modification de la positions des éléments dans le choix de attaques) Je ne pense pas que ça puisse venir de là mais je voulais tout montrer au cas où.
class Scene_Battle
# Sprite that show the button of a skill to use
class Skill_Element < UI::SpriteStack
include UI
# Create a new Skill_Element
# @param position [Integer] the position of the element in the interface (0 to 3)
def initialize(position)
super(nil, (position % 2 == 0) ? 0 : 165, (position / 2) * 60 + 38)
sprite = push(0, 0, nil, type: AttackDummySprite)
sprite.z = 10005 + position
sprite.mirror = @x != 0
add_text(20, 10, 132, 16, :name, 0, 1, type: SymText, color: 9).z = z = 10015 + position
add_text(0, 30, 134, 16, :pp_text, 2, type: SymText, color: 8).z = z
push(22, 31, nil, type: TypeSprite).z = z
push(56, 31, nil, type: CategorySprite).z = z
end
# Set the skill the element shows
alias set_skill data=
end
end
Merci de votre aide, je tente des choses de mon côté mais c'est assez difficile vu que je ne sais pas comment reproduire le bug et qu'il n'arrive pas si souvent que ça... (pour le moment je dirais une fois sur 10 a peu près, mais c'est pas exact du tout)