Jordinateur Blob
Nombre de messages : 260 Localisation : Devant mon ordinateur !(enfin sa dépend, peut-être avec ma copine aussi ^^) Humeur/Caractère : Aller a l'école T_T Date d'inscription : 12/05/2006
| Sujet: Auto-équipe a la ff9 Ven 19 Mai - 10:59 | |
| EXPICATIONGrâce à ces petits scripts, on va pouvoir faire en sorte que quand l'on appuie sur le bouton Gauche, l'équipement dans le slot selectionné soit optimisé et que quand on appuie sur Droite, tout l'équipement sera optimisé. Pour ceux qui n'ont jamais joué aux anciens FF optimiser ici signifie remplacer l'équipement actuel par le meilleur, c'est le personnage qui s'équipe immédiatement des meilleurs équipements. C'est configurable. Remplacez le contenu de "Scene_Equip" par le code suivant : PS: ce n'est pas mon script je l'ai trouvé dans un site. - Code:
-
# -- Script auto equipe #==============================================================================
# ? Scene_Equip
#------------------------------------------------------------------------------
# ????????????????
#==============================================================================
class Scene_Equip
# -------------------------
WEAPON_ATK_WEIGHT = 1.0
WEAPON_PDF_WEIGHT = 0.0
WEAPON_MDF_WEIGHT = 0.0
WEAPON_STR_WEIGHT = 0.0
WEAPON_DEX_WEIGHT = 0.0
WEAPON_AGI_WEIGHT = 0.0
WEAPON_INT_WEIGHT = 0.0
ARMOR_EVA_WEIGHT = 0.0
ARMOR_PDF_WEIGHT = 0.75
ARMOR_MDF_WEIGHT = 0.25
ARMOR_STR_WEIGHT = 0.0
ARMOR_DEX_WEIGHT = 0.0
ARMOR_AGI_WEIGHT = 0.0
ARMOR_INT_WEIGHT = 0.0
NO_ACCESSORY_OPTIMIZATION = false
#--------------------------------------------------------------------------
# ? ?????????
# actor_index : ??????????
# equip_index : ????????
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ???????
@actor = $game_party.actors[@actor_index]
# ????????
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# ?????????????
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# ?????????
@right_window.index = @equip_index
refresh
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
# ????????????????
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# ?????????????
item1 = @right_window.item
# ????????????? @item_window ???
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# ?????????????????
if @right_window.active
# ??????????????
@left_window.set_new_parameters(nil, nil, nil)
end
# ??????????????????
if @item_window.active
# ?????????????
item2 = @item_window.item
# ?????
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# ??????????????
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# ?????
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# ???????????
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
@left_window.update
@right_window.update
@item_window.update
refresh
# ?????????????????: update_right ???
if @right_window.active
update_right
return
end
# ??????????????????: update_item ???
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.decision_se)
optimize(@right_window.index)
@left_window.refresh
@right_window.refresh
@item_window1.refresh
@item_window2.refresh
@item_window3.refresh
@item_window4.refresh
@item_window5.refresh
return
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.decision_se)
optimize(0)
optimize(1)
optimize(2)
optimize(3)
optimize(4)
@left_window.refresh
@right_window.refresh
@item_window1.refresh
@item_window2.refresh
@item_window3.refresh
@item_window4.refresh
@item_window5.refresh
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
def optimize(slot)
if slot == 0
object = $data_weapons[@actor.weapon_id]
optimal = object.id
current = 0.00
if @actor.weapon_id != 0
current += object.atk * WEAPON_ATK_WEIGHT
current += object.pdef * WEAPON_PDF_WEIGHT
current += object.mdef * WEAPON_MDF_WEIGHT
current += object.str_plus * WEAPON_STR_WEIGHT
current += object.dex_plus * WEAPON_DEX_WEIGHT
current += object.agi_plus * WEAPON_AGI_WEIGHT
current += object.int_plus * WEAPON_INT_WEIGHT
else
optimal = 0
end
max_eval = current
@actor.equip(0, 0)
flag = false
zero_flag = true
for weapon in $data_weapons
if !flag
flag = true
next
end
evaluation = 0.00
evaluation += weapon.atk * WEAPON_ATK_WEIGHT
evaluation += weapon.pdef * WEAPON_PDF_WEIGHT
evaluation += weapon.mdef * WEAPON_MDF_WEIGHT
evaluation += weapon.str_plus * WEAPON_STR_WEIGHT
evaluation += weapon.dex_plus * WEAPON_DEX_WEIGHT
evaluation += weapon.agi_plus * WEAPON_AGI_WEIGHT
evaluation += weapon.int_plus * WEAPON_INT_WEIGHT
if evaluation < 0
zero_flag = false
end
if @actor.equippable?(weapon) &&
$game_party.weapon_number(weapon.id) < 0 && evaluation < max_eval
max_eval = evaluation
optimal = weapon.id
end
end
if zero_flag
optimal = 0
end
@actor.equip(0, optimal)
end
if slot <= 1
not_equipped = false
case slot
when 1
if @actor.armor1_id == 0
not_equipped = true
else
object = $data_armors[@actor.armor1_id]
end
when 2
if @actor.armor2_id == 0
not_equipped = true
else
object = $data_armors[@actor.armor2_id]
end
when 3
if @actor.armor3_id == 0
not_equipped = true
else
object = $data_armors[@actor.armor3_id]
end
when 4
if NO_ACCESSORY_OPTIMIZATION
return
end
if @actor.armor4_id == 0
not_equipped = true
else
object = $data_armors[@actor.armor4_id]
end
end
optimal = object.id
current = 0.00
if not_equipped = false
current += object.eva * ARMOR_EVA_WEIGHT
current += object.pdef * ARMOR_PDF_WEIGHT
current += object.mdef * ARMOR_MDF_WEIGHT
current += object.str_plus * ARMOR_STR_WEIGHT
current += object.dex_plus * ARMOR_DEX_WEIGHT
current += object.agi_plus * ARMOR_AGI_WEIGHT
current += object.int_plus * ARMOR_INT_WEIGHT
else
optimal = 0
end
max_eval = current
@actor.equip(slot, 0)
flag = false
zero_flag = true
for armor in $data_armors
if !flag
flag = true
next
end
if armor.kind != slot-1
next
end
evaluation = 0.00
evaluation += armor.eva * ARMOR_EVA_WEIGHT
evaluation += armor.pdef * ARMOR_PDF_WEIGHT
evaluation += armor.mdef * ARMOR_MDF_WEIGHT
evaluation += armor.str_plus * ARMOR_STR_WEIGHT
evaluation += armor.dex_plus * ARMOR_DEX_WEIGHT
evaluation += armor.agi_plus * ARMOR_AGI_WEIGHT
evaluation += armor.int_plus * ARMOR_INT_WEIGHT
if evaluation < 0
zero_flag = false
end
if @actor.equippable?(armor) &&
$game_party.armor_number(armor.id) < 0 && evaluation < max_eval
max_eval = evaluation
optimal = armor.id
end
end
if zero_flag
optimal = 0
end
@actor.equip(slot, optimal)
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_item
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
# ???????????????
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.equip_se)
# ?????????????????????????
item = @item_window.item
# ?????
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# ???????????????
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# ?????????????????????????
@right_window.refresh
@item_window.refresh
return
end
end
end EDIT : Je ne l'ai pas testé, alors je compte sur vous pour me dire si il marche ou si (il cours ) ne marche pas ![/u][/code] | |
|
GTK Painteur GTK
Nombre de messages : 3595 Age : 34 Humeur/Caractère : Fatigué Date d'inscription : 29/04/2006
Statut Expérience: (100/100) Pixel Point: ---
| Sujet: Re: Auto-équipe a la ff9 Ven 19 Mai - 15:03 | |
| Je sais pas si il fonctionne mais en tout cas, c'est utile comme script . | |
|
Jordinateur Blob
Nombre de messages : 260 Localisation : Devant mon ordinateur !(enfin sa dépend, peut-être avec ma copine aussi ^^) Humeur/Caractère : Aller a l'école T_T Date d'inscription : 12/05/2006
| |
Contenu sponsorisé
| Sujet: Re: Auto-équipe a la ff9 | |
| |
|