
Inventaire amélioré Script pour RPG Maker XP Ecrit par Protectator
En plus d'être mon tout premier article, ce script est également mon tout premier script :D
Il est fonctionnel, mais je ne pense pas avoir codé très méthodologiquement, enfin bref !
Je trouvais le menu d'objets de base assez... basique. C'est pourquoi j'ai décidé de l'améliorer un peu.
Description
Un petit menu s'affiche lors de la sélection d'un objet et permet de faire les actions suivantes :
Utiliser (pour un objet)
Equiper (pour une arme/armure)
Jeter
Détails (Affiche une fenêtre détaillée avec les caractéristiques de l'objet)
Les informations détaillées se trouvent directement dans le script.
Screens
Le sous-menu qui s'affiche dans l'inventaire
La fenêtre "Détails"
Possibilité de choisir d'équiper une arme/armure
Créez un script au-dessus de "Main" et appelez-le comme bon vous semble.
Et collez-y le code suivant :
Portion de code:
#==============================================================================
# ▲ Fenêtre inventaire amélioré
#------------------------------------------------------------------------------
# Auteur : Protectator
# Version : 1.0
# Date : 15.07.2010
#------------------------------------------------------------------------------
# Ce script améliore la fenêtre d'inventaire dans le menu du groupe en y
# ajoutant certaines fonctions :
# ► Utiliser (Objet) / Equiper (Arme, Armure)
# - Dans le cas d'un objet, permet de l'utiliser normalement.
# - Dans le cas d'une arme ou d'une armure, le joueur sélectionne le héros
# à équiper, et l'amène directement dans la fenêtred d'équipement avec
# l'objet sélectionné.
# ► Jeter (Sauf objets non consommables)
# - Permet de jeter une certaine quantité d'un objet. Attention, pas de
# fenêtre de confirmation
# ► Détails
# - Ouvre une fenêtre indiquant les caractéristiques précises sur l'objet.
# Cette fenêtre est réglable plus loin dans le script.
#==============================================================================
# Il est possible que ce script soit incompatible avec certains autres.
#
# Ce script ajoute :
# Window_ItemAction
# Window_ItemDetails
# Window_ItemThrow
#
# Ce script modifie :
# Window_Target
# Scene_Item
# Scene_Equip
#***********************************
# ♦ Réglages de la fenêtre de détails
#
# Il est possible de modifier l'affichage des informations de la fenêtre de
# détails. Vous pouvez activer ou désactiver l'affichage de certaines
# caractéristiques dès la ligne 230 de ce script, vous y trouverez également des
# informations plus détaillées.
#***********************************
#==============================================================================
# ■ Window_ItemAction
#------------------------------------------------------------------------------
# Fenêtre intervenant après le choix d'un item
# Auteur : Protectator
#==============================================================================
class Window_ItemAction < Window_Selectable
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, 128, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.z += 10
@commands = ["Utiliser", "Jeter", "Détails", "Annuler"]
@item_max = @commands.size
@column_max = 1
@type = RPG::Item
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
y = i * 32
text_size = self.contents.text_size(@commands).width
self.contents.draw_text(4, y, text_size, 32, @commands)
end
end
#--------------------------------------------------------------------------
# ● update_cursor_rect
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 32, self.width - 32, 32)
end
end
#--------------------------------------------------------------------------
# ● set_type
#--------------------------------------------------------------------------
def set_type(item)
@item = item
if item.is_a?(RPG::Item)
@commands = ["Utiliser", "Jeter", "Détails", "Annuler"]
else
@commands = ["Equiper", "Jeter", "Détails", "Annuler"]
end
refresh
end
end
#==============================================================================
# ■ Window_ItemThrow
#------------------------------------------------------------------------------
# Fenêtre permettant de choisir la quantité à jeter d'un objet
# Auteur : Protectator
#==============================================================================
class Window_ItemThrow < Window_Base
#--------------------------------------------------------------------------
# ● initialize
# digits_max : ??
#--------------------------------------------------------------------------
def initialize
@number = 0
dummy_bitmap = Bitmap.new(32, 32)
if dummy_bitmap.text_size("0").width < 8
size = 8
else
size = dummy_bitmap.text_size("0").width
end
@cursor_width = size + 8
dummy_bitmap.dispose
super(0, 0, 176, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.z += 20
@index = 1
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● number
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● number=
# number : ?????
#--------------------------------------------------------------------------
def number=(number)
@number = [[number, 0].max, 10 ** 2 - 1].min
refresh
end
#--------------------------------------------------------------------------
# ● set_max
#--------------------------------------------------------------------------
def set_max(number)
@max = number
refresh
end
#--------------------------------------------------------------------------
# ● index=
#--------------------------------------------------------------------------
def index=(number)
@index = number
refresh
end
#--------------------------------------------------------------------------
# ● update_cursor_rect
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(@index * @cursor_width, 32, @cursor_width + 4, 32)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update(max = 99)
super()
# ???
if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
# ??? ???
place = 10 ** (1 - @index)
n = @number / place % 10
@number -= n * place
# ???
n = (n + 1) % 10 if Input.repeat?(Input::UP)
n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
# ???
@number += n * place
if @number > @max
@number = @max
end
refresh
end
# ???
if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 2
end
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
s = sprintf("%0*d", 2, @number)
self.contents.draw_text(4, 0, 144, 32, "Jeter combien ?")
for i in 0...2
self.contents.draw_text(i * @cursor_width + 4, 32, 64, 32, s[i,1])
end
end
end
#==============================================================================
# ■ Window_ItemDetails
#------------------------------------------------------------------------------
# Fenêtre montrant tous les détails sur l'item
# Auteur : Protectator
#==============================================================================
class Window_ItemDetails < Window_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.z += 20
#***********************************
# Modifications des infos présentes
#
# En-dessous de chaque description: "true" pour activer l'affichage
# "false" pour désactiver l'affichage
# Vous pouvez également changer les textes de la fenêtre détails à partir de
# la ligne 290
#****************************
# Choix des infos présentes *
#****************************
# Coloration des bonus de stats
@couleurs = true
# Affichage de la catégorie de l'objet
@activer_TYPE = true
# Affichage du prix de l'objet
@activer_PRIX = true
# Affichage du nombre d'exemplaires de l'objet possédés
@activer_NOMBRE = true
#****************************
# Objets uniquement
# Affichage de la portée (sur qui) des effets de l'objet
@item_PORTEE = true
# Affichage des conditions d'utilisation de l'objet (Combat, Carte ou Libre)
@item_OCCASION = true
# Affichage des effets de restauration de PV ou PM
@item_RESTAURE = true
# Affichage des effets de soin de statut
@item_SOIGNE_STATUT = true
# Affichage des effets d'attribution de statut
@item_INFLIGE_STATUT = false
# Affichage des effets de boost de caractéristique
@item_CARAC_BOOST = true
#****************************
# Armes uniquement
# Affichage de ou des élément(s) de l'arme
@arme_ELEMENT = true
# Affichage de la valeur d'Attaque de l'arme
@arme_ATTAQUE = true
# Affichage des effets de boost de caractéristique de l'arme
@arme_CARAC_BONUS = true
#****************************
# Armures uniquement
# Affichage des effets de boost de caractéristique de l'armure
@armure_CARAC_BONUS = true
# Affichage de la résistance aux éléments de l'armure
@armure_RES_ELEMENT = true
# Affichage de la résistance aux statuts de l'armure
@armure_RES_STATUT = true
#****************************
# Textes généraux
@texte_TYPE = "Catégorie"
@texte_DESCR = "Description "
@texte_PRIX = "Prix"
@texte_EFFETS = "Effets"
@texte_NOMBRE = "Possédé"
@texte_OBJET = "Objet"
@texte_SEPARATION = ", "
# Textes items
@texte_UTIL = "Utilisation"
@texte_PORTEE_0 = "Inutilisable"
@texte_PORTEE_1 = "1 ennemi"
@texte_PORTEE_2 = "Tous ennemis"
@texte_PORTEE_3 = "1 allié"
@texte_PORTEE_4 = "Tous alliés"
@texte_PORTEE_5 = "1 allié mort"
@texte_PORTEE_6 = "Tous alliés morts"
@texte_PORTEE_7 = "Utilisateur"
@texte_OCCASION_0 = "Libre"
@texte_OCCASION_1 = "En combat"
@texte_OCCASION_2 = "Hors combat"
@texte_OCCASION_3 = "Inutilisable"
@texte_RESTAURE = "Restaure "
@texte_INFLIGE = "Inflige "
@texte_SOIGNE = "Soigne "
# Textes armes
@texte_ELEMENT = "Element"
@texte_NOELEM = "Aucun"
# Textes armures
@texte_ESQ = "Esquive"
@texte_RES = "Résiste à "
@texte_RES_STATUT = "Résiste au statut "
# Couleurs
@couleur_bonus = Color.new(128, 255, 128, 255) # Couleur bonus
@couleur_malus = Color.new(255, 128, 128, 255) # Couleur malus
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
rect = Rect.new(4, 32, self.width - 32, 32)
bitmap = RPG::Cache.icon(@item.icon_name)
case @item
when RPG::Item
type = @texte_OBJET
when RPG::Weapon
type = $data_system.words.weapon
when RPG::Armor
case @item.kind
when 0
type = $data_system.words.armor1
when 1
type = $data_system.words.armor2
when 2
type = $data_system.words.armor3
when 3
type = $data_system.words.armor4
end
end
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 0, 212, 32, @item.name, 0)
# - - - Nombre - - -
if @activer_NOMBRE
self.contents.font.color = system_color
self.contents.draw_text(4, 32, 100, 32, @texte_NOMBRE, 0)
self.contents.font.color = normal_color
case @item
when RPG::Item
affiche = $game_party.item_number(@item.id)
when RPG::Weapon
affiche = $game_party.weapon_number(@item.id)
when RPG::Armor
affiche = $game_party.armor_number(@item.id)
end
self.contents.draw_text(104, 32, 32, 32, affiche.to_s, 2)
end
# - - - - - Effets - - - - -
self.contents.font.color = system_color
self.contents.draw_text(4, 96, 100, 32, @texte_EFFETS, 0)
self.contents.font.color = normal_color
y = 128
case @item
# Effets ITEMS
when RPG::Item
if @item_RESTAURE
if @item.recover_hp_rate != 0
affiche = @texte_RESTAURE + @item.recover_hp_rate.to_s + "% " +
$data_system.words.hp
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
if @item.recover_hp != 0
affiche = @texte_RESTAURE + @item.recover_hp.to_s + " " +
$data_system.words.hp
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
if @item.recover_sp_rate != 0
affiche = @texte_RESTAURE + @item.recover_sp_rate.to_s + "% " +
$data_system.words.sp
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
if @item.recover_sp != 0
affiche = @texte_RESTAURE + @item.recover_sp.to_s + " " +
$data_system.words.sp
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
end
if @item_SOIGNE_STATUT
if @item.minus_state_set.size > 0
affiche = @texte_SOIGNE
for i in 0...@item.minus_state_set.size
affiche += $data_states[@item.minus_state_set].name
if i + 1 < @item.minus_state_set.size
affiche += ", "
end
end
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 468, 32, affiche, 0)
y += 32
end
end
if @item_INFLIGE_STATUT
if @item.plus_state_set.size > 0
affiche = @texte_INFLIGE
for i in 0...@item.plus_state_set.size
affiche += $data_states[@item.plus_state_set].name
if i + 1 < @item.plus_state_set.size
affiche += ", "
end
end
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 468, 32, affiche, 0)
y += 32
end
end
if @item_CARAC_BOOST
if @item.parameter_type != 0 && @item.parameter_points != 0
if @item.parameter_points > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.parameter_points.to_s + " "
else
self.contents.font.color = @couleur_malus
affiche = @item.parameter_points.to_s + " "
end
case @item.parameter_type
when 1
affiche += $data_system.words.hp
when 2
affiche += $data_system.words.sp
when 3
affiche += $data_system.words.str
when 4
affiche += $data_system.words.dex
when 5
affiche += $data_system.words.agi
when 6
affiche += $data_system.words.int
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
end
# Effets ARMES
when RPG::Weapon
if @arme_ATTAQUE
affiche = $data_system.words.atk + " : " + @item.atk.to_s
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
if @arme_CARAC_BONUS
# bonus déf. phys.
if @item.pdef != 0
if @item.pdef > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.pdef.to_s + " " + $data_system.words.pdef
else
self.contents.font.color = @couleur_malus
affiche = @item.pdef.to_s + " " + $data_system.words.pdef
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus déf. mag.
if @item.mdef != 0
if @item.mdef > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.mdef.to_s + " " + $data_system.words.mdef
else
self.contents.font.color = @couleur_malus
affiche = @item.mdef.to_s + " " + $data_system.words.mdef
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus force
if @item.str_plus != 0
if @item.str_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.str_plus.to_s + " " + $data_system.words.str
else
self.contents.font.color = @couleur_malus
affiche = @item.str_plus.to_s + " " + $data_system.words.str
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus dextérité
if @item.dex_plus != 0
if @item.dex_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.dex_plus.to_s + " " + $data_system.words.dex
else
self.contents.font.color = @couleur_malus
affiche = @item.dex_plus.to_s + " " + $data_system.words.dex
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus agilité
if @item.agi_plus != 0
if @item.agi_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.agi_plus.to_s + " " + $data_system.words.agi
else
self.contents.font.color = @couleur_malus
affiche = @item.agi_plus.to_s + " " + $data_system.words.agi
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus intelligence
if @item.int_plus != 0
if @item.int_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.int_plus.to_s + " " + $data_system.words.int
else
self.contents.font.color = @couleur_malus
affiche = @item.int_plus.to_s + " " + $data_system.words.int
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
end
# Effets ARMURES
when RPG::Armor
if @armure_CARAC_BONUS
# bonus déf. phys.
if @item.pdef != 0
if @item.pdef > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.pdef.to_s + " " + $data_system.words.pdef
else
self.contents.font.color = @couleur_malus
affiche = @item.pdef.to_s + " " + $data_system.words.pdef
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus déf. mag.
if @item.mdef != 0
if @item.mdef > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.mdef.to_s + " " + $data_system.words.mdef
else
self.contents.font.color = @couleur_malus
affiche = @item.mdef.to_s + " " + $data_system.words.mdef
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus esquive
if @item.eva != 0
if @item.eva > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.eva.to_s + " " + @texte_ESQ
else
self.contents.font.color = @couleur_malus
affiche = @item.eva.to_s + " " + @texte_ESQ
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus force
if @item.str_plus != 0
if @item.str_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.str_plus.to_s + " " + $data_system.words.str
else
self.contents.font.color = @couleur_malus
affiche = @item.str_plus.to_s + " " + $data_system.words.str
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus dextérité
if @item.dex_plus != 0
if @item.dex_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.dex_plus.to_s + " " + $data_system.words.dex
else
self.contents.font.color = @couleur_malus
affiche = @item.dex_plus.to_s + " " + $data_system.words.dex
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus agilité
if @item.agi_plus != 0
if @item.agi_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.agi_plus.to_s + " " + $data_system.words.agi
else
self.contents.font.color = @couleur_malus
affiche = @item.agi_plus.to_s + " " + $data_system.words.agi
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
# bonus intelligence
if @item.int_plus != 0
if @item.int_plus > 0
self.contents.font.color = @couleur_bonus
affiche = "+" + @item.int_plus.to_s + " " + $data_system.words.int
else
self.contents.font.color = @couleur_malus
affiche = @item.int_plus.to_s + " " + $data_system.words.int
end
self.contents.draw_text(4, y, 320, 32, affiche, 0)
y += 32
end
end
if @armure_RES_ELEMENT
if @item.guard_element_set.size > 0
affiche = @texte_RES
for i in 0...@item.guard_element_set.size
affiche += $data_system.elements[@item.guard_element_set]
if i + 1 < @item.guard_element_set.size
affiche += ", "
end
end
self.contents.font.color = normal_color
self.contents.draw_text(4, y, 468, 32, affiche, 0)
y += 32
end
end
if @armure_RES_STATUT
if @item.guard_state_set.size > 0
affiche = @texte_RES_STATUT
for i in 0...@item.guard_state_set.size
affiche += $data_states[@item.guard_state_set].name
if i + 1 < @item.guard_state_set.size
affiche += ", "
end
end
self.contents.draw_text(4, y, 468, 32, affiche, 0)
y += 32
end
end
end
# - - - - - Droite - - - - -
y = 0
# Affiche la catégorie
if @activer_TYPE
self.contents.font.color = system_color
text_size = self.contents.text_size(@texte_TYPE).width
if text_size > 100
text_size = 100
end
self.contents.draw_text(400, y, text_size, 32, @texte_TYPE, 0)
self.contents.font.color = normal_color
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32, type, 2)
y += 32
end
# Affiche le prix
if @activer_PRIX
self.contents.font.color = system_color
text_size = self.contents.text_size(@texte_PRIX).width
if text_size > 100
text_size = 100
end
self.contents.draw_text(400, y, text_size, 32, @texte_PRIX, 0)
self.contents.font.color = normal_color
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32,
@item.price.to_s, 2)
y += 32
end
# - - - - -
# Items
# - - - - -
case @item
when RPG::Item
# Affiche le mot "Utilisation" si besoin
if @item_PORTEE || @item_OCCASION
self.contents.font.color = system_color
text_size = self.contents.text_size(@texte_UTIL).width
if text_size > 100
text_size = 100
end
self.contents.draw_text(400, y, text_size, 32, @texte_UTIL, 0)
self.contents.font.color = normal_color
end
if @item_PORTEE
case @item.scope
when 0
portee = @texte_PORTEE_0
when 1
portee = @texte_PORTEE_1
when 2
portee = @texte_PORTEE_2
when 3
portee = @texte_PORTEE_3
when 4
portee = @texte_PORTEE_4
when 5
portee = @texte_PORTEE_5
when 6
portee = @texte_PORTEE_6
when 7
portee = @texte_PORTEE_7
end
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32, portee,
2)
y += 32
end
if @item_OCCASION
case @item.occasion
when 0
occas = @texte_OCCASION_0
when 1
occas = @texte_OCCASION_1
when 2
occas = @texte_OCCASION_2
when 3
occas = @texte_OCCASION_3
end
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32, occas,
2)
y += 32
end
# - - - - -
# Armes
# - - - - -
when RPG::Weapon
if @arme_ELEMENT
self.contents.font.color = system_color
text_size = self.contents.text_size(@texte_ELEMENT).width
if text_size > 100
text_size = 100
end
self.contents.draw_text(400, y, text_size, 32, @texte_ELEMENT, 0)
self.contents.font.color = normal_color
if @item.element_set.size == 0
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32,
@texte_NOELEM, 2)
y += 32
else
for i in 0...@item.element_set.size
element = $data_system.elements[@item.element_set]
self.contents.draw_text(400 + text_size, y, 208 - text_size, 32,
element, 2)
y += 32
end
end
end
end
end
#--------------------------------------------------------------------------
# ● set_item
#--------------------------------------------------------------------------
def set_item(item)
@item = item
end
end
#==============================================================================
# ■ Window_Target
#------------------------------------------------------------------------------
# ?????????
# Modifié par Protectator
#==============================================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# ● refresh
# Modifié par Protectator
#--------------------------------------------------------------------------
def refresh(item = nil)
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 116
actor = $game_party.actors
self.contents.font.color = disabled_color
if (item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)) && item != nil
if actor.equippable?(item)
self.contents.font.color = normal_color
end
name_size = self.contents.text_size(actor.name).width
class_name = $data_classes[actor.class_id].name
class_size = self.contents.text_size(class_name).width
self.contents.draw_text(x, y, name_size, 32, actor.name, 0)
self.contents.draw_text(x + 144, y, class_size, 32, class_name, 0)
else
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
end
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp(actor, x + 152, y + 64)
end
end
end
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# ?????????
# Modifié par Protectator
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● main
# Modifié par Protectator
#--------------------------------------------------------------------------
def main
# ???
@help_window = Window_Help.new
@item_window = Window_Item.new
@action_window = Window_ItemAction.new
@details_window = Window_ItemDetails.new
@throw_window = Window_ItemThrow.new
# ???
@item_window.help_window = @help_window
# ???
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@action_window.visible = false
@action_window.active = false
@details_window.visible = false
@details_window.active = false
@throw_window.visible = false
@throw_window.active = false
# ???
Graphics.transition
# ???
loop do
# ???
Graphics.update
# ???
Input.update
# ???
update
# ???
if $scene != self
break
end
end
# ???
Graphics.freeze
# ???
@help_window.dispose
@item_window.dispose
@action_window.dispose
@throw_window.dispose
@details_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ● update
# Modifié par Protectator
#--------------------------------------------------------------------------
def update
# ???
@help_window.update
@item_window.update
@action_window.update
@details_window.update
@target_window.update
# ???: update_item
if @item_window.active
update_item
return
end
# Si la fenêtre d'action est active
if @action_window.active
update_action
return
end
# Si la fenêtre des jeterest active
if @throw_window.active
@throw_window.update
update_throw
return
end
# Si la fenêtre des détails est active
if @details_window.active
update_details
return
end
# ???: update_target ???
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● update_item
# Modifié par Protectator
#--------------------------------------------------------------------------
def update_item
# B ???
if Input.trigger?(Input::B)
# ??? SE???
$game_system.se_play($data_system.cancel_se)
# ???
$scene = Scene_Menu.new(0)
return
end
# C ???
if Input.trigger?(Input::C)
# ???
@item = @item_window.item
# ???
# ??? SE???
# ???
if @item.is_a?(RPG::Item)
if @item.scope >= 3
# ???
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@action_window.set_type(@item)
@details_window.set_item(@item)
@action_window.x = @item_window.index % 2 * 320 + 16
@action_window.y = @item_window.index / 2 * 32 + 112 -
(@item_window.index / 14) * 192
@throw_window.x = @item_window.index % 2 * 320 + 16 + 128
@throw_window.y = @item_window.index / 2 * 32 + 112 + 32 -
(@item_window.index / 14) * 192
@action_window.index = 0
@action_window.visible = true
@action_window.active = true
$game_system.se_play($data_system.decision_se)
# ??? (???) ???
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# ???
else
# ??? ID ???
if @item.common_event_id > 0
# ???
$game_temp.common_event_id = @item.common_event_id
# ??? SE ???
$game_system.se_play(@item.menu_se)
# ???
if @item.consumable
# ??? 1 ???
$game_party.lose_item(@item.id, 1)
# ???
@item_window.draw_item(@item_window.index)
end
# ???
$scene = Scene_Map.new
return
else
$game_system.se_play($data_system.buzzer_se)
end
end
elsif @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
$game_system.se_play($data_system.decision_se)
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@action_window.set_type(@item)
@details_window.set_item(@item)
@action_window.x = @item_window.index % 2 * 320 + 16
@action_window.y = @item_window.index / 2 * 32 + 112 -
(@item_window.index / 14) * 192
@throw_window.x = @item_window.index % 2 * 320 + 16 + 128
@throw_window.y = @item_window.index / 2 * 32 + 112 + 32 -
(@item_window.index / 14) * 192
@action_window.index = 0
@action_window.visible = true
@action_window.active = true
@target_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# ● update_action
# Auteur : Protectator
#--------------------------------------------------------------------------
def update_action
# Si le joueur revient en arrière
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@item_window.active = true
@action_window.visible = false
@action_window.active = false
return
end
# Si le joueur confirme
if Input.trigger?(Input::C)
case @item
when RPG::Item
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Weapon
if $game_party.weapon_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Armor
if $game_party.armor_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
end
case @action_window.index
when 0
$game_system.se_play($data_system.decision_se)
@action_window.active = false
@target_window.active = true
@target_window.visible = true
@target_window.refresh(@item)
return
when 1
$game_system.se_play($data_system.decision_se)
@throw_window.refresh
case @item
when RPG::Item
@throw_window.set_max($game_party.item_number(@item.id))
when RPG::Weapon
@throw_window.set_max($game_party.weapon_number(@item.id))
when RPG::Armor
@throw_window.set_max($game_party.armor_number(@item.id))
end
@action_window.active = false
@throw_window.active = true
@throw_window.visible = true
return
when 2
$game_system.se_play($data_system.decision_se)
@details_window.refresh
@action_window.active = false
@details_window.active = true
@details_window.visible = true
return
when 3
$game_system.se_play($data_system.cancel_se)
@item_window.active = true
@action_window.visible = false
@action_window.active = false
return
end
end
end
#--------------------------------------------------------------------------
# ● update_throw
# Auteur : Protectator
#--------------------------------------------------------------------------
def update_throw
# Si le joueur revient en arrière
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@action_window.active = true
@throw_window.visible = false
@throw_window.active = false
return
end
# Si le joueur confirme
if Input.trigger?(Input::C)
@item_window.active = true
@action_window.visible = false
@action_window.active = false
@throw_window.visible = false
@throw_window.active = false
if @throw_window.number != 0
$game_system.se_play($data_system.escape_se)
case @item
when RPG::Item
$game_party.lose_item(@item.id, @throw_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @throw_window.number)
when RPG::Armor
$game_party.lose_armor(@item.id, @throw_window.number)
end
@item_window.refresh
else
$game_system.se_play($data_system.cancel_se)
end
@throw_window.number = 0
@throw_window.index = 1
end
end
#--------------------------------------------------------------------------
# ● update_details
# Auteur : Protectator
#--------------------------------------------------------------------------
def update_details
# Si le joueur revient en arrière ou confirme
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
$game_system.se_play($data_system.cancel_se)
@action_window.active = true
@details_window.visible = false
@details_window.active = false
return
end
end
#--------------------------------------------------------------------------
# ● update_target
# Modifié par Protectator
#--------------------------------------------------------------------------
def update_target
# B ???
if Input.trigger?(Input::B)
# ??? SE ???
$game_system.se_play($data_system.cancel_se)
# ???
unless $game_party.item_can_use?(@item.id)
# ???
@item_window.refresh
end
# ???
@action_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# C ???
if Input.trigger?(Input::C)
# ???
case @item
when RPG::Item
if $game_party.item_number(@item.id) == 0
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Weapon
if $game_party.weapon_number(@item.id) == 0
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
when RPG::Armor
if $game_party.armor_number(@item.id) == 0
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
end
# ???
if @target_window.index == -1
# ???
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ???
if @target_window.index >= 0
if @item.is_a?(RPG::Item)
# ???
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
# Si ce n'est pas un objet
else
target = $game_party.actors[@target_window.index]
if target.equippable?(@item)
case @item
when RPG::Weapon
slot = 0
when RPG::Armor
slot = @item.kind + 1
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@target_window.index, slot, true, @item)
return
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
# ???
if used
# ??? SE ???
$game_system.se_play(@item.menu_se)
# ???
if @item.consumable
# ??? 1 ???
$game_party.lose_item(@item.id, 1)
# ???
@item_window.draw_item(@item_window.index)
end
# ???
@target_window.refresh(@item)
# ???
if $game_party.all_dead?
# ???
$scene = Scene_Gameover.new
return
end
# ??? ID ???
if @item.common_event_id > 0
# ???
$game_temp.common_event_id = @item.common_event_id
# ???
$scene = Scene_Map.new
return
end
end
# ???
unless used
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# ?????????
# Modifié par Protectator
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● initialize
# forced : Active la fenêtre window_item par défaut à l'ouverture
# focus : RPG::Weapon ou RPG::Armor sur lequel placer le sélecteur
# Modifié par Protectator
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0, forced = false, focus = nil)
@actor_index = actor_index
@equip_index = equip_index
@forced = forced
@focus = focus
end
#--------------------------------------------------------------------------
# ● refresh
# Modifié par Protectator
#--------------------------------------------------------------------------
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 @forced
@right_window.active = false
@item_window.active = true
@item_window.index = 0
@forced = false
if @focus
case @focus
when RPG::Weapon
for i in 0...$game_party.weapon_number(@focus.id)
if @focus.id == @item_window.item.id
break
end
@item_window.index += 1
end
when RPG::Armor
for i in 0...$game_party.armor_number(@focus.id)
if @focus.id == @item_window.item.id
break
end
@item_window.index += 1
end
end
end
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
end
|
Voilà donc mon first script, mais j'en suis assez content
Si quelqu'un veut lire ça, me dire si y'a des trucs un peu bizarres, ou si j'aurais pu faire plus simple par exemple... je suis preneur ! Le script fonctionne, mais j'ai pas tout à fait l'impression d'avoir codé au plus simple ni au plus clair ^^' Si vous voulez que je commente mon code partiellement ou totalement, ou que je vous dise où sont les modifications dans les trois scripts que j'ai touchés, pas de problème. J'aimerais m'améliorer et je ferai le nécessaire, c'est pour ca que je ne refuse pas un peu d'aide et d'intérêt
Et il va sans dire que je suis naturellement ouvert aux remarques, commentaires, avis et autres propositions...
Merci !
|
|
ff-style - posté le 17/07/2010 à 21:40:37. (589 messages postés)
|

| C'est normal, dans l'image 3, que la description soit coupée . Sinon, je ne pourrai pas l'essayer, je suis sur Vx en ce moment. |
/La raison de tuer, est celle d'aimer ça/ Vous voulez devenir un bogoss ? Alors ne ressemblez surtout pas à ça !/Comment m'être toutes les filles à ces pieds |
|
tampaxor - posté le 17/07/2010 à 23:55:12. (7676 messages postés)
|

Fan 2 le magazine | C'est bien que tu précises ce que tu modifies et ce qui change avec ton script.
Et c'est toujours sympa ce genre de truc, inutile mais sympa. |
Twitter BloGecko ! Suivez moi ! | Page facebook de mon blog | Du nouveau sur le blog ! | Lire avant tout nouveau projet | Travelers Of Time | Fruity Loops, de nouvelles bases | Fruity Loops et les VST |
|
reelie - posté le 16/10/2010 à 04:10:22. (35 messages postés)
|

Marine | C'est vrai lorsque je le test la description dépasse un peu
du carré...  |
Hell, it's about time ! |
|
Dambaru - posté le 01/12/2010 à 20:47:35. (46 messages postés)
|

| Chez moi, rien ne dépasse
En tout cas je le garde ! |
Même l'avenir n'est plus ce qu'il était.. | 
|