- KelArtisteMembre
- Nombre de messages : 20
Localisation : Caché dans le placard de Yanfly
Distinction : aucune
Date d'inscription : 25/12/2018
VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Jeu 3 Jan 2019 - 19:43
Salut à tous !
Alors voilà, je ne vais pas tourner autour du pot, j'ai un léger soucis : je ne parviens pas à faire fonctionner deux scripts ensemble. Il s'agit du script de Coffre de stockage de Vincent26 (Disponible ici : http://rpgmakervx.1fr1.net/t15697-limiteur-d-objet-et-coffre-de-stockage ) et du script d'Alchimie style Go-go-totori de Kread-Ex (disponible ici : https://grimoirecastle.wordpress.com/2011/12/08/alchemic-synthesis-go-go-totori/ ).
L'erreur se déclenche lors des phases d'Alchimie : une fois la synthèse accomplie, le jeu crash et le message suivant apparaît :
Le projet sur lequel je suis en ce moment contient pas mal de scripts qui peuvent entrer en conflit, du coup j'ai isolé ces deux scripts sur un fichier VXAce à part et je les ai testés : ce sont bien eux qui semblent incompatibles. Plutôt que de refaire du nécropost, je chercherais éventuellement l'aide de quelqu'un pour m'aider à les faire fonctionner ensemble, ça m'embêterait de laisser de côté toute une partie du gameplay que j'avais prévu pour mon projet. J'ai pas réussi à intégrer les scripts au message, demandez-les moi si vous voulez les tester séparément (puis ensemble) chez vous.
Merci d'avance pour votre aide, ça fait un petit moment que je me chauffe les neurones sur celui-là...!
EDIT : j'imagine que le problème en soi vient de la création d'une fenêtre à l'issue du script d'Alchimie, mais je ne sais pas où est la coquille dans le code. Mes connaissances sont très limitées...
Alors voilà, je ne vais pas tourner autour du pot, j'ai un léger soucis : je ne parviens pas à faire fonctionner deux scripts ensemble. Il s'agit du script de Coffre de stockage de Vincent26 (Disponible ici : http://rpgmakervx.1fr1.net/t15697-limiteur-d-objet-et-coffre-de-stockage ) et du script d'Alchimie style Go-go-totori de Kread-Ex (disponible ici : https://grimoirecastle.wordpress.com/2011/12/08/alchemic-synthesis-go-go-totori/ ).
L'erreur se déclenche lors des phases d'Alchimie : une fois la synthèse accomplie, le jeu crash et le message suivant apparaît :
- Spoiler:
Le projet sur lequel je suis en ce moment contient pas mal de scripts qui peuvent entrer en conflit, du coup j'ai isolé ces deux scripts sur un fichier VXAce à part et je les ai testés : ce sont bien eux qui semblent incompatibles. Plutôt que de refaire du nécropost, je chercherais éventuellement l'aide de quelqu'un pour m'aider à les faire fonctionner ensemble, ça m'embêterait de laisser de côté toute une partie du gameplay que j'avais prévu pour mon projet. J'ai pas réussi à intégrer les scripts au message, demandez-les moi si vous voulez les tester séparément (puis ensemble) chez vous.
Merci d'avance pour votre aide, ça fait un petit moment que je me chauffe les neurones sur celui-là...!
EDIT : j'imagine que le problème en soi vient de la création d'une fenêtre à l'issue du script d'Alchimie, mais je ne sais pas où est la coquille dans le code. Mes connaissances sont très limitées...
- HinolaModérateur
- Nombre de messages : 969
Age : 30
Distinction : Gagnant invaincu à ce jour de tous les concours de mapping de ce forum fait par Coco'
[Coco' ]
Grande figure du Mapping Show .
Grand admirateur de notre mascotte Vehyxine
STI Haruhiste like me [Hamu' ]
et fier de l'être ! [bibi ^^]
Un fier Homme du désert sans foi ni loi è_é [:3]
Date d'inscription : 21/05/2009
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Jeu 3 Jan 2019 - 23:43
Salut
Je ne peu pas télécharger le script d'alchimie sur le lien donné.
Tu pourrais donner le script complet ?
Voir le projet que tu as créé avec seulement ces deux là, sans rtp
Je ne peu pas télécharger le script d'alchimie sur le lien donné.
Tu pourrais donner le script complet ?
Voir le projet que tu as créé avec seulement ces deux là, sans rtp
- KelArtisteMembre
- Nombre de messages : 20
Localisation : Caché dans le placard de Yanfly
Distinction : aucune
Date d'inscription : 25/12/2018
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Ven 4 Jan 2019 - 17:24
Voici la bête :
- Spoiler:
- Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ▼ GO GO TOTORI!
# Author: Kread-EX
# Version 2.03
# Release date: 08/12/2011
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#------------------------------------------------------------------------------
# ▼ UPDATES
#------------------------------------------------------------------------------
# # 05/01/2013. Fixed a bug with items disappearing when trait selection is
# # cancelled.
# # 07/12/2012. Bug fixes.
# # 25/03/2012. Version 2.0 - huge backend revamp.
# # 20/12/2011. Fixed a saving bug.
# # 12/12/2011. Added detection for the future add-ons.
#------------------------------------------------------------------------------
# ▼ TERMS OF USAGE
#------------------------------------------------------------------------------
# # You are free to adapt this work to suit your needs.
# # You can use this work for commercial purposes if you like it.
# # Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#------------------------------------------------------------------------------
# ▼ INTRODUCTION
#------------------------------------------------------------------------------
# # This script is a complex item synthesis system inspired from GUST Atelier
# # series in general and Atelier Totori in particular.
# #
# # Features
# # - Ability to create objects based on recipes.
# # - Ability to switch an ingredient for another of the same family.
# # - Ability to set traits to ingredients and put them on the final item.
# # - Alchemic level and synthesis difficulty.
# # - Synthesis Shop (add-on).
# # - Party alchemic level and experience.
#------------------------------------------------------------------------------
# ▼ INSTRUCTIONS
#------------------------------------------------------------------------------
# # I'll direct you to this webpage for a clear explanation. It's complicated I'm afraid.
# # http://grimoirecastle.wordpress.com/2011/12/08/alchemic-synthesis-go-go-totori/
#------------------------------------------------------------------------------
# ▼ COMPATIBILITY
#------------------------------------------------------------------------------
# # New classes: Scene_Alchemy, Window_SynthesisList, Window_SynthesisProp,
# # Window_IngredientList, Window_IngredientProp, Window_ItemFamily,
# # Window_TraitList, Window_FinalItem, Window_SynthCategory
# #
# # List of aliases and overwrites:
# #
# # DataManager
# # load_database (alias)
# # load_synth_notetags (new method)
# #
# # RPG::BaseItem
# # traits (new method)
# #
# # RPG::Item
# # recipe_data (new attr method)
# # synthesis_reqs (new attr method)
# # synthesis_level (new attr method)
# # synthesis_costs (new attr method)
# # synthesis_locks (new attr method)
# # load_synth_notetags (new method)
# # synthesis_quality (new method)
# # traits_type (new method)
# # effects (alias)
# #
# # RPG::EquipItem
# # synthesis_reqs (new attr method)
# # synthesis_level (new attr method)
# # synthesis_costs (new attr method)
# # synthesis_locks (new attr method)
# # load_synth_notetags (new method)
# # synthesis_quality (new method)
# # traits_type (new method)
# # features (alias)
# #
# # Game_Party
# # synthesis_level (new attr method)
# # synthesis_traits (new attr method)
# # synthesis_quality (new attr method)
# # synthesis_exp (new attr method)
# # initialize (alias)
# # synthesis_level_up (new method)
# # gain_synthesis_exp (new method)
# # exp_to_next_synth_level (new method)
#------------------------------------------------------------------------------
# Quits if the Traits Namer isn't found
if $imported.nil? || $imported['KRX-TraitsNamer'].nil?
msgbox('You need the Traits Namer in order to use Alchemic Synthesis. Loading aborted.')
else
$imported['KRX-AlchemicSynthesis'] = true
puts 'Load: Alchemic Synthesis ~GO GO TOTORI!~ v2.03 by Kread-EX'
module KRX
#===========================================================================
# ■ CONFIGURATION
#===========================================================================
SYNTH_MAX_TRAITS = 4 # Don't change this unless you're using a custom UI.
SYNTH_CATEGORIES = [:item, :weapon, :armor, :key_item]
SYNTH_LEVEL_FORMULA = "100 * @synthesis_level"
SYNTH_EXP_FORMULA = "20 * creation_level / @synthesis_level"
module VOCAB
TRAITS = 'Traits'
INGREDIENTS = 'Ingredients'
QUALITY = 'Qualité:'
SYNTH_POINTS = 'Points de Synthèse:'
CAULDRON = 'Atelier'
LEVEL = 'Niveau de Synthèse:'
SUCCESS_RATE = 'Taux de succès:'
SYNTH_FAILED = 'La synthèse a échoué!'
SYNTH_SUCCESS = 'Synthèse réussie!'
END_TRAIT_SELECTION = 'Terminé!'
PERFORM_SYNTHESIS = 'Synthétiser.'
ALCHEMIC_LEVEL = 'Niveau du Groupe.'
end
#===========================================================================
# ■ CONFIGURATION ENDS HERE
#===========================================================================
module REGEXP
SYNTHESIS_ITEM = /<synth_item:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_ITEM_REQ = /<synth_req_item:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_WEAPON = /<synth_weapon:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_WEAPON_REQ = /<synth_req_weapon:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_ARMOR = /<synth_armor:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_ARMOR_REQ = /<synth_req_armor:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_FAMILY = /<synth_family:[ ]*(.+)>/
SYNTHESIS_QUALITY = /<synth_quality:[ ]*(\d+)>/i
SYNTHESIS_LEVEL = /<synth_level:[ ]*(\d+)>/i
SYNTHESIS_COSTS = /<synth_costs:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SYNTHESIS_LOCKS = /<synth_locks:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end
#--------------------------------------------------------------------------
# ● Checks alchemic modifications to items
#--------------------------------------------------------------------------
def self.determine_alchemic_value(property, object, default_value)
return default_value if $game_party.nil?
case property
when :quality
result = $game_party.synthesis_quality[[object.class, object.id]]
when :effects
adds = $game_party.synthesis_traits[[object.class, object.id]]
if adds != nil
result = []
adds.each do |a|
result.push(RPG::UsableItem::Effect.new(a[0], a[1], a[2], a[3]))
end
final_result = default_value + result
return final_result
end
when :features
adds = $game_party.synthesis_traits[[object.class, object.id]]
if adds != nil
result = []
adds.each do |a|
result.push(RPG::BaseItem::Feature.new(a[0], a[1], a[2]))
end
final_result = default_value + result
return final_result
end
end
result.nil? ? default_value : result
end
end
#===========================================================================
# ■ DataManager
#===========================================================================
module DataManager
#--------------------------------------------------------------------------
# ● Loads the database
#--------------------------------------------------------------------------
class << self
alias_method(:krx_totori_dm_load_database, :load_database)
end
def self.load_database
krx_totori_dm_load_database
load_synth_notetags
end
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def self.load_synth_notetags
groups = [$data_items, $data_weapons, $data_armors]
classes = [RPG::Item, RPG::Weapon, RPG::Armor]
for group in groups
for obj in group
next if obj.nil?
obj.load_synth_notetags if classes.include?(obj.class)
end
end
puts "Read: Alchemic Synthesis Notetags"
end
end
#==========================================================================
# ■ RPG::BaseItem
#==========================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ● Returns the traits
#--------------------------------------------------------------------------
def traits
container = is_a?(RPG::EquipItem) ? features : effects
result = []
container.each_index do |i|
result.push(container[i]) if !@synthesis_locks.include?(i)
end
result
end
end
#==========================================================================
# ■ RPG::Item
#==========================================================================
class RPG::Item < RPG::UsableItem
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
attr_reader :recipe_data
attr_reader :synthesis_reqs
attr_reader :synthesis_family
attr_reader :synthesis_level
attr_reader :synthesis_costs
attr_reader :synthesis_locks
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def load_synth_notetags
@recipe_data = []
@synthesis_reqs, @synthesis_costs, @synthesis_locks = [], [], []
@synthesis_family = nil
@synthesis_quality, @synthesis_level = 0, 1
@note.split(/[\r\n]+/).each do |line|
case line
when KRX::REGEXP::SYNTHESIS_ITEM
$1.scan(/\d+/).each {|i| @recipe_data.push($data_items[i.to_i])}
when KRX::REGEXP::SYNTHESIS_WEAPON
$1.scan(/\d+/).each {|i| @recipe_data.push($data_weapons[i.to_i])}
when KRX::REGEXP::SYNTHESIS_ARMOR
$1.scan(/\d+/).each {|i| @recipe_data.push($data_armors[i.to_i])}
when KRX::REGEXP::SYNTHESIS_ITEM_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_items[i.to_i])}
when KRX::REGEXP::SYNTHESIS_WEAPON_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_weapons[i.to_i])}
when KRX::REGEXP::SYNTHESIS_ARMOR_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_armors[i.to_i])}
when KRX::REGEXP::SYNTHESIS_FAMILY
@synthesis_family = $1
when KRX::REGEXP::SYNTHESIS_QUALITY
@synthesis_quality = $1.to_i
when KRX::REGEXP::SYNTHESIS_LEVEL
@synthesis_level = $1.to_i
when KRX::REGEXP::SYNTHESIS_COSTS
$1.scan(/\d+/).each {|i| @synthesis_costs.push(i.to_i)}
when KRX::REGEXP::SYNTHESIS_LOCKS
$1.scan(/\d+/).each {|i| @synthesis_locks.push(i.to_i - 1)}
end
end
end
#--------------------------------------------------------------------------
# ● Returns the synthesis quality
#--------------------------------------------------------------------------
def synthesis_quality
KRX.determine_alchemic_value(:quality, self, @synthesis_quality)
end
#--------------------------------------------------------------------------
# ● Returns the type of traits
#--------------------------------------------------------------------------
def traits_type
:effects
end
#--------------------------------------------------------------------------
# ● Returns the effects
#--------------------------------------------------------------------------
alias_method(:krx_totori_item_effects, :effects)
def effects
KRX.determine_alchemic_value(:effects, self, krx_totori_item_effects)
end
end
#==========================================================================
# ■ RPG::EquipItem
#==========================================================================
class RPG::EquipItem < RPG::BaseItem
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
attr_reader :synthesis_reqs
attr_reader :synthesis_family
attr_reader :synthesis_level
attr_reader :synthesis_costs
attr_reader :synthesis_locks
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def load_synth_notetags
@synthesis_reqs, @synthesis_costs, @synthesis_locks = [], [], []
@synthesis_family = nil
@synthesis_quality, @synthesis_level = 0, 1
@note.split(/[\r\n]+/).each do |line|
case line
when KRX::REGEXP::SYNTHESIS_ITEM_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_items[i.to_i])}
when KRX::REGEXP::SYNTHESIS_WEAPON_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_weapons[i.to_i])}
when KRX::REGEXP::SYNTHESIS_ARMOR_REQ
$1.scan(/\d+/).each {|i| @synthesis_reqs.push($data_armors[i.to_i])}
when KRX::REGEXP::SYNTHESIS_FAMILY
@synthesis_family = $1
when KRX::REGEXP::SYNTHESIS_QUALITY
@synthesis_quality = $1.to_i
when KRX::REGEXP::SYNTHESIS_LEVEL
@synthesis_level = $1.to_i
when KRX::REGEXP::SYNTHESIS_COSTS
$1.scan(/\d+/).each {|i| @synthesis_costs.push(i.to_i)}
when KRX::REGEXP::SYNTHESIS_LOCKS
$1.scan(/\d+/).each {|i| @synthesis_locks.push(i.to_i - 1)}
end
end
end
#--------------------------------------------------------------------------
# ● Returns the synthesis quality
#--------------------------------------------------------------------------
def synthesis_quality
KRX.determine_alchemic_value(:quality, self, @synthesis_quality)
end
#--------------------------------------------------------------------------
# ● Returns the type of traits
#--------------------------------------------------------------------------
def traits_type
:features
end
#--------------------------------------------------------------------------
# ● Returns the effects
#--------------------------------------------------------------------------
alias_method(:krx_totori_item_features, :features)
def features
KRX.determine_alchemic_value(:features, self, krx_totori_item_features)
end
end
#==========================================================================
# ■ Game_Party
#==========================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
attr_accessor :synthesis_level
attr_accessor :synthesis_traits
attr_accessor :synthesis_quality
attr_accessor :synthesis_exp
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
alias_method(:krx_totori_gp_initialize, :initialize)
def initialize
krx_totori_gp_initialize
@synthesis_level = 1.00
@synthesis_traits = {}
@synthesis_quality = {}
@synthesis_exp = 0
end
#--------------------------------------------------------------------------
# ● Checks for synthesis level up
#--------------------------------------------------------------------------
def synthesis_level_up
while @synthesis_exp >= exp_to_next_synth_level
@synthesis_level += 1.00
@synthesis_exp = 0
end
end
#--------------------------------------------------------------------------
# ● Gains synthesis exp
#--------------------------------------------------------------------------
def gain_synthesis_exp(creation_level)
@synthesis_exp += eval(KRX::SYNTH_EXP_FORMULA)
synthesis_level_up
end
#--------------------------------------------------------------------------
# ● Returns the exp needed for the next level
#--------------------------------------------------------------------------
def exp_to_next_synth_level
eval(KRX::SYNTH_LEVEL_FORMULA)
end
end
#==========================================================================
# ■ Window_SynthCategory
#==========================================================================
class Window_SynthCategory < Window_ItemCategory
#--------------------------------------------------------------------------
# ● Creates the command list
#--------------------------------------------------------------------------
def make_command_list
list = KRX::SYNTH_CATEGORIES
add_command(Vocab::item, :item) if list.include?(:item)
add_command(Vocab::weapon, :weapon) if list.include?(:weapon)
add_command(Vocab::armor, :armor) if list.include?(:armor)
add_command(Vocab::key_item, :key_item) if list.include?(:key_item)
end
end
#==========================================================================
# ■ Window_SynthesisList
#==========================================================================
class Window_SynthesisList < Window_ItemList
#--------------------------------------------------------------------------
# ● Determine if an item goes in the list
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
else
return false
end
end
#--------------------------------------------------------------------------
# ● Determine if the required ingredients for synthesis are available
#--------------------------------------------------------------------------
def enable?(item)
return false if item.nil?
ok = []
families = item.synthesis_reqs.collect {|x| x.synthesis_family}
families.each do |family|
for itm in $game_party.all_items
next unless itm.synthesis_family == family
if $game_party.item_number(itm) >= 1
ok.push(true)
break
end
end
end
return ok.size == item.synthesis_reqs.size
end
#--------------------------------------------------------------------------
# ● Creates the list based on the recipes
#--------------------------------------------------------------------------
def make_item_list
@data = []
recipes = $game_party.items.select {|item| !item.recipe_data.empty?}
for rec in recipes
for syn in rec.recipe_data
@data.push(syn) if include?(syn)
end
end
end
#--------------------------------------------------------------------------
# ● Displays the item icon and name
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
end
end
#--------------------------------------------------------------------------
# ● Assigns a properties window
#--------------------------------------------------------------------------
def prop_window=(value)
@prop_window = value
end
#--------------------------------------------------------------------------
# ● Refreshes the help and prop windows
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@prop_window.set_item(item)
end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
end
#==========================================================================
# ■ Window_IngredientList
#==========================================================================
class Window_IngredientList < Window_ItemList
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h, item)
super(x, y, w, h)
@base_item = item
refresh
end
#--------------------------------------------------------------------------
# ● Determine if an item goes in the list
#--------------------------------------------------------------------------
def number?
case @category
when :ing0
return 0
when :ing1
return 1
when :ing2
return 2
when :ing3
return 3
else
return 0
end
end
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(item)
return $game_party.has_item?(item, false)
end
#--------------------------------------------------------------------------
# ● Creates the list based on the recipes
#--------------------------------------------------------------------------
def make_item_list
family = @base_item.synthesis_reqs[number?].synthesis_family
@data = $game_party.all_items.select {|itm| itm.synthesis_family == family}
end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Assigns a properties window
#--------------------------------------------------------------------------
def prop_window=(value)
@prop_window = value
end
#--------------------------------------------------------------------------
# ● Refreshes the help and prop windows
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@prop_window.set_item(item)
end
end
#==========================================================================
# ■ Window_SynthesisProp
#==========================================================================
class Window_SynthesisProp < Window_Base
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
set_item
end
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = nil)
contents.clear
return if item.nil?
draw_item_traits(item)
draw_item_ingredients(item)
end
#--------------------------------------------------------------------------
# ● Displays the item's traits
#--------------------------------------------------------------------------
def draw_item_traits(item)
max = KRX::SYNTH_MAX_TRAITS
change_color(system_color)
contents.draw_text(0, 0, width, line_height, KRX::VOCAB::TRAITS)
change_color(normal_color)
(1..max).each {|i| contents.draw_text(0, line_height * i, width, line_height,
"#{i}.")}
item.traits.each_index do |i|
break if i == max
name = KRX::TraitsNamer.trait_name(item.traits[i])
contents.draw_text(24, line_height * (i+1), width - 24, line_height, name)
end
draw_horz_line(line_height * 5)
end
#--------------------------------------------------------------------------
# ● Displays the item's requires ingredients
#--------------------------------------------------------------------------
def draw_item_ingredients(item)
change_color(system_color)
contents.draw_text(0, line_height * 6, width, line_height, KRX::VOCAB::INGREDIENTS)
change_color(normal_color)
item.synthesis_reqs.each_index do |i|
itm = item.synthesis_reqs[i]
draw_item_name(itm, 0, line_height * (i + 7), true, width)
end
end
#--------------------------------------------------------------------------
# ● Displays an horizontal line
#--------------------------------------------------------------------------
def draw_horz_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(0, line_y, contents_width, 2, line_color)
end
#--------------------------------------------------------------------------
# ● Returns the color used for horizontal lines
#--------------------------------------------------------------------------
def line_color
color = normal_color
color.alpha = 48
return color
end
end
#==========================================================================
# ■ Window_IngredientProp
#==========================================================================
class Window_IngredientProp < Window_SynthesisProp
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = nil)
contents.clear
draw_current_cauldron
return if item.nil?
draw_item_traits(item)
end
#--------------------------------------------------------------------------
# ● Displays the item's traits
#--------------------------------------------------------------------------
def draw_item_traits(item)
max = KRX::SYNTH_MAX_TRAITS
change_color(system_color)
contents.draw_text(0, 0, width, line_height, KRX::VOCAB::QUALITY)
size = text_size(KRX::VOCAB::QUALITY).width
change_color(normal_color)
contents.draw_text(size, 0, 32, line_height, item.synthesis_quality, 2)
return if item.traits.empty?
item.traits.each_index do |i|
break if i == max
name = KRX::TraitsNamer.trait_name(item.traits[i-1])
cost = item.synthesis_costs[i-1]
contents.draw_text(0, line_height * (i + 1), width, line_height, "#{i + 1}.")
contents.draw_text(24, line_height * (i + 1), width - 24, line_height,
"#{name} (#{cost})")
end
end
#--------------------------------------------------------------------------
# ● Displays the current ingredient selection
#--------------------------------------------------------------------------
def draw_current_cauldron
draw_horz_line(line_height * 5)
change_color(system_color)
contents.draw_text(0, line_height * 6, width, line_height, KRX::VOCAB::CAULDRON)
return if SceneManager.scene.cauldron.empty?
change_color(normal_color)
SceneManager.scene.cauldron.each_index do |i|
draw_item_name(SceneManager.scene.cauldron(true)[i], 0, line_height * (i + 7), true, width)
end
end
end
#==========================================================================
# ■ Window_ItemFamily
#==========================================================================
class Window_ItemFamily < Window_ItemCategory
#--------------------------------------------------------------------------
# ● Create the commands list
#--------------------------------------------------------------------------
def make_command_list
itm = $game_party.last_item.object
famnbs = {}
return if itm.nil?
(0...itm.synthesis_reqs.size).each do |i|
fam = itm.synthesis_reqs[i].synthesis_family
famnbs[fam] = 0 if famnbs[fam].nil?
famnbs[fam] += 1
next if SceneManager.scene.cauldron_nb(fam) >= famnbs[fam]
symb = "ing#{i}".to_sym
add_command(fam, symb)
end
end
end
#==========================================================================
# ■ Window_TraitList
#==========================================================================
class Window_TraitList < Window_ItemList
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h, p)
@points = p
@deleted = []
super(x, y, w, h)
end
#--------------------------------------------------------------------------
# ● Lists the traits of the items in the cauldron
#--------------------------------------------------------------------------
def make_item_list
@data = []
@costs = []
target_itm = $game_party.last_item.object
unless @deleted.size == KRX::SYNTH_MAX_TRAITS
SceneManager.scene.cauldron(true).each do |item|
next if item.traits_type != target_itm.traits_type
item.traits.each_index do |i|
trait = item.traits[i]
next if @deleted.include?(trait)
@data.push(trait)
@costs.push(item.synthesis_costs[i])
end
end
end
@data.push(KRX::VOCAB::END_TRAIT_SELECTION)
@data.uniq!
end
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(item)
return true if item == KRX::VOCAB::END_TRAIT_SELECTION
return false if duplicate_trait_type?(item)
@points >= @costs[@data.index(item)]
end
#--------------------------------------------------------------------------
# ● Determine if there are two traits with the same function
#--------------------------------------------------------------------------
def duplicate_trait_type?(trait)
itm = $game_party.last_item.object
return false if $game_party.synthesis_traits[[itm.class, itm.id]].nil?
$game_party.synthesis_traits[[itm.class, itm.id]].each do |arr|
return true if arr[0] == trait.code && arr[1] == trait.data_id
end
false
end
#--------------------------------------------------------------------------
# ● Remove a trait
#--------------------------------------------------------------------------
def remove_item(trait, points)
@deleted.push(trait)
@points = points
refresh
end
#--------------------------------------------------------------------------
# ● Returns the points cost of a trait
#--------------------------------------------------------------------------
def trait_cost(trait)
@costs[@data.index(trait)]
end
#--------------------------------------------------------------------------
# ● Displays the trait name and cost
#--------------------------------------------------------------------------
def draw_item(index)
trait = @data[index]
change_color(normal_color, enable?(trait))
name = trait.is_a?(String) ? trait : KRX::TraitsNamer.trait_name(trait)
contents.draw_text(4, index * line_height, width, line_height, name)
return if trait == 'Finish!'
cost = @costs[index]
contents.draw_text(4, index * line_height, width - 32, line_height, cost, 2)
end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Refreshes the help window
#--------------------------------------------------------------------------
def update_help
if @data[index] == KRX::VOCAB::END_TRAIT_SELECTION
help = KRX::VOCAB::PERFORM_SYNTHESIS
else
help = KRX::TraitsNamer.trait_description(@data[index])
end
@help_window.set_text(help)
end
end
#==========================================================================
# ■ Window_FinalItem
#==========================================================================
class Window_FinalItem < Window_SynthesisProp
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h, q, p, l, s)
@quality = q
@points = p
@level = l
@success = [s, 100].min
super(x, y, w, h)
end
#--------------------------------------------------------------------------
# ● Alters the points value
#--------------------------------------------------------------------------
def update_points(value)
@points = value
end
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = $game_party.last_item.object)
@item = item
contents.clear
draw_item_name(@item, 4, 0, true, width)
draw_item_quality
draw_item_traits
draw_synthesis_success
draw_synthesis_exp
end
#--------------------------------------------------------------------------
# ● Displays the item quality
#--------------------------------------------------------------------------
def draw_item_quality
change_color(system_color)
contents.draw_text(4, line_height * 1, width, line_height, KRX::VOCAB::QUALITY)
contents.draw_text(4, line_height * 2, width, line_height, KRX::VOCAB::SYNTH_POINTS)
change_color(normal_color)
s1 = text_size(KRX::VOCAB::QUALITY).width
s2 = text_size(KRX::VOCAB::SYNTH_POINTS).width
contents.draw_text(4 + s1, line_height * 1, 32, line_height, @quality.to_s, 2)
contents.draw_text(4 + s2, line_height * 2, 32, line_height, @points.to_s, 2)
end
#--------------------------------------------------------------------------
# ● Displays the item traits
#--------------------------------------------------------------------------
def draw_item_traits
max = KRX::SYNTH_MAX_TRAITS
draw_horz_line(line_height * 3)
change_color(system_color)
contents.draw_text(4, line_height * 4, width, line_height, KRX::VOCAB::TRAITS)
change_color(normal_color)
(1..max).each {|i| contents.draw_text(0, line_height * (i + 4), width,
line_height, "#{i}.")}
@item.traits.each_index do |i|
break if i == max
name = KRX::TraitsNamer.trait_name(@item.traits[i])
contents.draw_text(24, line_height * (i+5), width - 24, line_height, name)
end
end
#--------------------------------------------------------------------------
# ● Displays the synthesis success rate
#--------------------------------------------------------------------------
def draw_synthesis_success
draw_horz_line(line_height * 9)
change_color(system_color)
contents.draw_text(4, line_height * 10, width, line_height, KRX::VOCAB::LEVEL)
contents.draw_text(4, line_height * 11, width, line_height, KRX::VOCAB::SUCCESS_RATE)
s1 = text_size(KRX::VOCAB::LEVEL).width
s2 = text_size(KRX::VOCAB::SUCCESS_RATE).width
change_color(normal_color)
contents.draw_text(4 + s1, line_height * 10, 32, line_height, @level.to_s, 2)
case @success
when 0..19
change_color(knockout_color)
when 20..49
change_color(crisis_color)
when 50..99
change_color(normal_color)
when 100
change_color(mp_cost_color)
end
contents.draw_text(4 + s2, line_height * 11, 48, line_height, "#{@success}%", 2)
end
#--------------------------------------------------------------------------
# ● Displays the current synthesis EXP
#--------------------------------------------------------------------------
def draw_synthesis_exp
change_color(system_color)
text = KRX::VOCAB::ALCHEMIC_LEVEL
contents.draw_text(4, line_height * 12, width, line_height, text)
s = text_size(text).width
value = $game_party.synthesis_level.to_i
change_color(normal_color)
contents.draw_text(4 + s, line_height * 12, 24, line_height, value.to_s, 2)
rate = $game_party.synthesis_exp / $game_party.exp_to_next_synth_level
color1 = Color.new(0, 80, 0)
color2 = Color.new(0, 200, 100)
draw_gauge(s+48, line_height*12-2, width-(s+48), rate, color1, color2)
end
end
#==========================================================================
# ■ Scene_Alchemy
#==========================================================================
class Scene_Alchemy < Scene_MenuBase
#--------------------------------------------------------------------------
# ● Scene start
#--------------------------------------------------------------------------
def start
super
@item_cauldron, @family_cauldron = [], []
@old_traits = $game_party.synthesis_traits.dup
@old_qual = $game_party.synthesis_quality.dup
@queued_ings = []
create_help_window
create_category_window
create_properties_window
create_item_window
end
#--------------------------------------------------------------------------
# ● Creates the window displaying the item categories
#--------------------------------------------------------------------------
def create_category_window
@category_window = Window_SynthCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = @help_window.height
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● Creates the window displaying the item's properies and requirements
#--------------------------------------------------------------------------
def create_properties_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
@prop_window = Window_SynthesisProp.new(Graphics.width / 2, wy,
Graphics.width / 2, wh)
@prop_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● Creates the window displaying the items available to synthesis
#--------------------------------------------------------------------------
def create_item_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
@item_window = Window_SynthesisList.new(0, wy, Graphics.width / 2, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.prop_window = @prop_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@category_window.item_window = @item_window
end
#--------------------------------------------------------------------------
# ● Creates the window displaying the available ingredients
#--------------------------------------------------------------------------
def create_ingredient_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
@i_prop_window = Window_IngredientProp.new(Graphics.width / 2, wy,
Graphics.width / 2, wh)
@i_prop_window.viewport = @viewport
@ing_window = Window_IngredientList.new(0, wy, Graphics.width / 2, wh,
@item_window.item)
@ing_window.viewport = @viewport
@ing_window.help_window = @help_window
@ing_window.prop_window = @i_prop_window
@ing_window.set_handler(:ok, method(:on_ing_ok))
@ing_window.set_handler(:cancel, method(:on_ing_cancel))
@family_window = Window_ItemFamily.new
@family_window.y = @help_window.height
@family_window.item_window = @ing_window
@family_window.set_handler(:ok, method(:on_family_ok))
@family_window.set_handler(:cancel, method(:on_family_cancel))
@family_window.activate
@family_window.select(0)
end
#--------------------------------------------------------------------------
# ● Creates the windows related to the cauldron
#--------------------------------------------------------------------------
def create_cauldron_windows
wy = @help_window.y + @help_window.height
wh = Graphics.height - wy
ww = Graphics.width / 2
@trait_window = Window_TraitList.new(0, wy, ww, wh, @points)
@trait_window.refresh
@trait_window.activate
@trait_window.select(0)
@trait_window.help_window = @help_window
@trait_window.set_handler(:ok, method(:on_trait_ok))
@trait_window.set_handler(:cancel, method(:on_trait_cancel))
@final_window = Window_FinalItem.new(ww, wy, ww, wh, @quality, @points,
@level, @success)
end
#--------------------------------------------------------------------------
# ● Destroys the ingredient-related windows
#--------------------------------------------------------------------------
def destroy_ingredient_windows
@ing_window.dispose; @ing_window = nil
@family_window.dispose; @family_window = nil
@i_prop_window.dispose; @i_prop_window = nil
end
#--------------------------------------------------------------------------
# ● Destroys the cauldron-related windows
#--------------------------------------------------------------------------
def destroy_cauldron_windows
@trait_window.dispose; @trait_window = nil
@final_window.dispose; @final_window = nil
end
#--------------------------------------------------------------------------
# ● Returns the current ingredient selection
#--------------------------------------------------------------------------
def cauldron(item = false)
item ? @item_cauldron : @family_cauldron
end
#--------------------------------------------------------------------------
# ● Update the cauldron contents
#--------------------------------------------------------------------------
def update_cauldron(add = true)
if add
$game_party.lose_item(@ing_window.item, 1)
@queued_ings.push(@ing_window.item)
@item_cauldron.push(@ing_window.item)
@family_cauldron.push(@ing_window.item.synthesis_family)
@ing_window.unselect
else
$game_party.gain_item(@queued_ings.pop, 1)
@item_cauldron.pop
@family_cauldron.pop
@ing_window.item
end
@family_window.refresh
@family_window.update
@family_window.activate
@family_window.select(0)
@ing_window.update_help
end
#--------------------------------------------------------------------------
# ● Returns the number of an element in the family cauldron
#--------------------------------------------------------------------------
def cauldron_nb(fam)
result = 0
@family_cauldron.each {|f| result += 1 if f == fam}
result
end
#--------------------------------------------------------------------------
# ● Determine the final quality of the item
#--------------------------------------------------------------------------
def compute_quality
total_value = 0
ary = []
ary = @item_cauldron.collect {|itm| itm.synthesis_quality}
ary.each {|v| total_value += v}
rate = total_value / ary.size
@quality = rate
@points = rate
oitm = $game_party.last_item.object
$game_party.synthesis_quality[[oitm.class, oitm.id]] = rate
end
#--------------------------------------------------------------------------
# ● Determine the synthesis success rate
#--------------------------------------------------------------------------
def compute_success
@level = $game_party.last_item.object.synthesis_level
@success = (100 * ($game_party.synthesis_level / @level)).round
end
#--------------------------------------------------------------------------
# ● Synthesis outcome
#--------------------------------------------------------------------------
def process_outcome(failure = false)
destroy_cauldron_windows
wy = Graphics.height / 2 - @help_window.height / 2
@help_window.move(0, wy, Graphics.width, @help_window.height - 16)
@help_window.arrows_visible = false
if failure
@help_window.set_text(KRX::VOCAB::SYNTH_FAILED)
$game_party.synthesis_traits = @old_traits.dup
$game_party.synthesis_quality = @old_qual.dup
else
@help_window.set_text(KRX::VOCAB::SYNTH_SUCCESS)
$game_party.gain_item($game_party.last_item.object, 1)
$game_party.gain_synthesis_exp($game_party.last_item.object.synthesis_level)
end
Graphics.wait(40)
on_item_cancel
@item_cauldron.clear
@family_cauldron.clear
@help_window.move(0, 0, Graphics.width, @help_window.height + 16)
end
#--------------------------------------------------------------------------
# ● Confirms the category selection
#--------------------------------------------------------------------------
def on_category_ok
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# ● Confirms the item selection
#--------------------------------------------------------------------------
def on_item_ok
$game_party.last_item.object = @item_window.item
@item_window.hide
@category_window.hide
@prop_window.hide
create_ingredient_window
end
#--------------------------------------------------------------------------
# ● Returns to the category selection
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
@item_window.show
@item_window.refresh
@prop_window.set_item(nil)
@prop_window.show
@category_window.activate
@category_window.show
end
#--------------------------------------------------------------------------
# ● Confirms the family selection
#--------------------------------------------------------------------------
def on_family_ok
@family_window.deactivate
@ing_window.select_last
@ing_window.activate
end
#--------------------------------------------------------------------------
# ● Returns to the item selection
#--------------------------------------------------------------------------
def on_family_cancel
$game_party.gain_item(@last_ing, 1) unless @last_ing.nil?
unless cauldron.empty?
update_cauldron(false)
return
end
destroy_ingredient_windows
@item_window.show
@item_window.activate
@category_window.show
@prop_window.show
end
#--------------------------------------------------------------------------
# ● Confirms the ingredient selection
#--------------------------------------------------------------------------
def on_ing_ok
itm = $game_party.last_item.object
update_cauldron
if cauldron.size == itm.synthesis_reqs.size
$game_party.synthesis_traits[[itm.class, itm.id]] = nil
compute_quality
compute_success
destroy_ingredient_windows
create_cauldron_windows
end
end
#--------------------------------------------------------------------------
# ● Returns to the family selection
#--------------------------------------------------------------------------
def on_ing_cancel
@ing_window.unselect
@i_prop_window.set_item(nil)
@family_window.activate
end
#--------------------------------------------------------------------------
# ● Validates a trait selection
#--------------------------------------------------------------------------
def on_trait_ok
item = $game_party.last_item.object
trait = @trait_window.item
if trait == KRX::VOCAB::END_TRAIT_SELECTION
if (rand(100) + 1) <= @success
process_outcome
else
process_outcome(true)
end
return
end
if $game_party.synthesis_traits[[item.class, item.id]].nil?
$game_party.synthesis_traits[[item.class, item.id]] = []
end
container = $game_party.synthesis_traits[[item.class, item.id]]
if item.is_a?(RPG::Item)
container.push([trait.code, trait.data_id, trait.value1, trait.value2])
else
container.push([trait.code, trait.data_id, trait.value])
end
@points -= @trait_window.trait_cost(trait)
@trait_window.remove_item(trait, @points)
@trait_window.activate
@final_window.update_points(@points)
@final_window.set_item(item)
end
#--------------------------------------------------------------------------
# ● Returns to the ingredient selection
#--------------------------------------------------------------------------
def on_trait_cancel
@family_cauldron.clear
@item_cauldron.clear
$game_party.synthesis_traits = @old_traits.dup
$game_party.gain_item(@queued_ings.pop, 1) until @queued_ings.empty?
destroy_cauldron_windows
create_ingredient_window
end
end
## Menu inclusion, with Yanfly's Ace Menu Engine
if $imported["YEA-AceMenuEngine"]
#==========================================================================
# ■ Scene_Menu
#==========================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● Switch to the synthesis scene
#--------------------------------------------------------------------------
def command_totori
SceneManager.call(Scene_Alchemy)
end
end
end ## End of Yanfly's Menu inclusion
end ## End of Traits Namer's check.
- KelArtisteMembre
- Nombre de messages : 20
Localisation : Caché dans le placard de Yanfly
Distinction : aucune
Date d'inscription : 25/12/2018
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Jeu 10 Jan 2019 - 13:57
Up ! Est-ce que l'un d'entre vous a trouvé le temps de se pencher sur le sujet ?
- HinolaModérateur
- Nombre de messages : 969
Age : 30
Distinction : Gagnant invaincu à ce jour de tous les concours de mapping de ce forum fait par Coco'
[Coco' ]
Grande figure du Mapping Show .
Grand admirateur de notre mascotte Vehyxine
STI Haruhiste like me [Hamu' ]
et fier de l'être ! [bibi ^^]
Un fier Homme du désert sans foi ni loi è_é [:3]
Date d'inscription : 21/05/2009
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Jeu 10 Jan 2019 - 21:06
Il me faudrait aussi le script traitnamer requis pour le script d'alchimie.
Je penses voir d'où vient l'erreur, mais je doit faire des tests pour la corriger, et pour le moment il me manque cet élément.
Je penses voir d'où vient l'erreur, mais je doit faire des tests pour la corriger, et pour le moment il me manque cet élément.
- KelArtisteMembre
- Nombre de messages : 20
Localisation : Caché dans le placard de Yanfly
Distinction : aucune
Date d'inscription : 25/12/2018
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Ven 11 Jan 2019 - 14:35
Ah oui bien sûr ! Le voilà.
- Spoiler:
[code]
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ▼ Traits Namer
# Author: Kread-EX
# Version: 1.02
# Release date: 11/03/2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#------------------------------------------------------------------------------
# ▼ UPDATES
#------------------------------------------------------------------------------
# # 03/02/2012. Bug fixes.
# # 24/03/2012. Added methods used by Alchemic Synthesis.
# # 23/03/2012. Version 1.0, now help window generation is included.
#------------------------------------------------------------------------------
# ▼ TERMS OF USAGE
#------------------------------------------------------------------------------
# # You are free to adapt this work to suit your needs.
# # You can use this work for commercial purposes if you like it.
# # Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#------------------------------------------------------------------------------
# ▼ INTRODUCTION
#------------------------------------------------------------------------------
# # This is a core script. By itself, it doesn't do anything but it used by
# # Runic Enchantment and Alchemic Synthesis. The purpose of this script
# # is to provide an automated way to name traits: the script retrieve the traits
# # data and generates a name based on a customizable template.
#------------------------------------------------------------------------------
$imported = {} if $imported.nil?
$imported['KRX-TraitsNamer'] = true
puts 'Load: Traits Namer v1.02 by Kread-EX'
module KRX
module TraitsNamer
#===========================================================================
# ■ CONFIGURATION
#===========================================================================
X_PARAMETERS = [
'Accuracy',
'Evasion',
'Critical rate',
'Critical eva. rate',
'M. Evasion',
'Magic reflection',
'Counter rate',
'HP Regen',
'MP Regen',
'TP Regen'
]
S_PARAMETERS = [
'Aggro effect',
'Guard effect',
'Recovery rate',
'Pharmacology',
'MP cost',
'TP charge rate',
'Physical damage',
'Magical damage',
'Floor damage',
'EXP rate'
]
SPECIAL_FLAGS = [
'Autobattle',
'Guard',
'Cover',
'TP Saver'
]
PARTY_ABILITY = [
'Half Encounter',
'No Encounter',
'No surprise attacks',
'No preemptive attacks',
'Gold x2',
'Item Drops x2'
]
CODENAMES = {
11 => '%s resist: %d%%' , # Element rate
12 => '%s debuff rate: %d%%' , # Debuff rate
13 => '%s resist: %d%%' , # State rate
14 => 'Immunity: %s' , # State immunity
21 => '%s: %d%%' , # Parameter rate
22 => '%s: %d%%' , # Additional parameter rate
23 => '%s: %d%%' , # Special parameter rate
31 => 'Attack %s' , # Physical attack attribute
32 => 'Attack %s %d%%' , # Physical attack state
33 => 'Attack speed %d' , # Attack speed correction
34 => 'Attack x%d' , # Additional attacks
41 => 'Command: %s' , # Add skill type
42 => 'Seal: %s' , # Seal skill type
43 => 'Skill: %s' , # Add skill
44 => 'Skill Seal: %s' , # Seal skill
51 => 'Can equip: %s' , # Add equip type (weapon)
52 => 'Can equip: %s' , # Add equip type (armor)
53 => 'Fix equip: %s' , # Fix equip slot
54 => 'Seal equip: %s' , # Seal equip slot
55 => 'Dual Wielding' , # Dual Wield
61 => 'Bonus Actions: +%d%%' , # Bonus actions
62 => '%s' , # Special flag
63 => 'Collapse type' , # Collapse type (will never be used, I think)
64 => '%s' , # Party ability
}
CODEHELP = {
# Element rate
11 => 'Raises %s resistance by %d%%.',
# Debuff rate
12 => 'Raises %s resistance by %d%%.',
# State rate
13 => 'Raises %s resistance by %d%%.',
# State immunity
14 => 'Grants immunity to %s.',
# Parameter rate
21 => 'Raises %s by %d%%.',
# Additional parameter rate
22 => 'Raises %s by %d%%.',
# Special parameter rate
23 => 'Grants a %d% modifier to %s.',
# Physical attack attribute
31 => 'Adds %s element to normal attacks.',
# Physical attack state
32 => 'Adds %s to normal attacks (%d%% accuracy).',
# Attack speed correction (bonus)
33 => ['Raises attack speed by %d.',
# Attack speed correction (malus)
'Reduces attack speed by %d.'],
# Additional attacks
34 => 'Grants %d additional attacks.',
# Add skill type
41 => 'Enables the %s battle command.',
# Seal skill type
42 => 'Seals the %s battle command.',
# Add skill
43 => 'Allows the use of the %s skill',
# Seal skill
44 => 'Seals the %s skill.',
# Add equip type (weapon)
51 => 'Allows %s to be equipped.',
# Add equip type (armor)
52 => 'Allows %s to be equipped.',
# Fix equip slot
53 => 'Fixes the %s equipment slot.',
# Seal equip slot
54 => 'Seals the %s equipment slot.',
# Dual Wield
55 => 'Allows to use two weapons as the same time.',
# Bonus actions
61 => 'Raises the action rate by %d%%.',
# Autobattle
62 => ['The character will act on his/her own in battle.',
# Guard
'The character will permanently defend.',
# Cover
'The character will take hits for his/her wounded comrades.',
# TP Saver
'TP are kept after battles.'],
# Collapse type (no need to use it but meh)
63 => 'Alters the collapse animation.',
# Half encounter
64 => ['Halves the random encounter rate.',
# No encounter
'Disables random encounters.',
# No surprise attacks
'Disables surprise attacks.',
# No preemptive attacks
'Disables preemptive attacks.',
# Gold x2
'Doubles the money obtained after a battle.',
# Item Drops x2
'Doubles the drop rate of items.']
}
EFFECTS_CODENAMES = {
11 => 'HP Recovery' , # HP Recovery
12 => 'MP Recovery' , # MP Recovery
13 => 'TP Recovery' , # TP Gain
21 => 'Add %s' , # Add State
22 => 'Cleanse %s' , # Remove State
31 => '%s+' , # Add buff
32 => '%s-' , # Add debuff
33 => 'Dispel %s+' , # Remove buff
34 => 'Cancel %s-' , # Remove debuff
41 => 'Escape' , # Escape
42 => '%s Bonus' , # Permanent stat growth
43 => 'Learn %s' , # Permanent skill learning
44 => 'Common Event' , # Common event
}
EFFECTS_CODEHELP = {
# HP Recovery (static)
11 => ['Restores %d HP.',
# HP Recovery (dynamic)
'Restores %d%% of maximum HP.'],
# MP Recovery (static)
12 => ['Restores %d MP.',
# MP Recovery (dynamic)
'Restores %d%% of maximum MP.'],
# TP Gain
13 => 'Restores %d%% TP.',
# Add State
21 => 'Inflicts %s (%d%% chance).',
# Remove State
22 => 'Cancels %s.',
# Add buff
31 => 'Increases %s for %d turns.',
# Add debuff
32 => 'Decreases %s for %d turns.',
# Remove buff
33 => 'Cancels a previously applied %s buff.',
# Remove debuff
34 => 'Dispels an active %s debuff.',
# Escape
41 => 'Automatically escape from battle.',
# Permanent stat growth
42 => 'Boosts %d by %d permanently.',
# Permanent skill learning
43 => 'Teaches the %s skill permanently.',
# Common Event
44 => 'Calls a common event.'
}
#===========================================================================
# ■ CUSTOM TRAITS/EFFECTS CONFIGURATION
#===========================================================================
# INSTRUCTIONS
# Here you can define custom traits names and descriptions.
#
# Syntax:
# [type, code, data_id, value 1, value2] => [name, description]
#
# type: 0 (for equipment), 1 (for usables)
#
# code: the code number. Refer to default naming to know what is what.
#
# data_id: the number of the option you've choosen in the trait droplist.
#
# value1: what you typed in the first field where you can write numbers.
# For equipment this is the only one.
#
# value2: usable items only. What you typed in the second field.
#
# description: If you want to also use a custom description. If you only
# want the custom name, set this to nil.
CUSTOM_TRAITS = {
[0, 32, 2, 50] => ['Poisonous', nil],
[0, 32, 2, 100] => ['Venomous', nil],
[1, 11, 0, 0, 10] => ['HP Recovery XS', nil],
[1, 11, 0, 0, 25] => ['HP Recovery S', nil],
[1, 11, 0, 0, 50] => ['HP Recovery M', nil],
[1, 11, 0, 0, 75] => ['HP Recovery L', nil],
[1, 11, 0, 0, 100] => ['HP Recovery XL', 'Restores all HP!'],
[1, 12, 0, 0, 10] => ['MP Recovery XS', nil],
[1, 12, 0, 0, 25] => ['MP Recovery S', nil],
[1, 12, 0, 0, 50] => ['MP Recovery M', nil],
[1, 12, 0, 0, 75] => ['MP Recovery L', nil],
[1, 12, 0, 0, 100] => ['MP Recovery XL', 'Restores all MP!'],
[1, 13, 0, 2, 0] => ['TP Recovery XS', nil],
[1, 13, 0, 5, 0] => ['TP Recovery S', nil],
[1, 13, 0, 10, 0] => ['TP Recovery M', nil],
[1, 13, 0, 16, 0] => ['TP Recovery L', nil],
[1, 13, 0, 20, 0] => ['TP Recovery XL', nil],
}
#===========================================================================
# ■ CONFIGURATION ENDS HERE
#===========================================================================
#--------------------------------------------------------------------------
# ● Generates traits name
#--------------------------------------------------------------------------
def self.feature_name(code, data_id, value)
custom = CUSTOM_TRAITS[[0, code, data_id, self.convert_value(code, value)]]
return custom[0] unless custom.nil? || custom[0].nil?
base_name = CODENAMES[code]
data_name = case code
when 11, 31
$data_system.elements[data_id]
when 12, 21
Vocab.param(data_id)
when 13, 14, 32
$data_states[data_id].name
when 22
X_PARAMETERS[data_id]
when 23
S_PARAMETERS[data_id]
when 41, 42
$data_system.skill_types[data_id]
when 43, 44
$data_skills[data_id].name
when 51
$data_system.weapon_types[data_id]
when 52
$data_system.armor_types[data_id]
when 53, 54
Vocab.etype(data_id)
when 62
SPECIAL_FLAGS[data_id]
when 64
PARTY_ABILITY[data_id]
end
final_value = case code
when 11, 13
100 - (value * 100)
when 33, 34
value
else
value * 100
end
if data_name.nil?
name = sprintf(base_name, final_value)
else
name = sprintf(base_name, data_name, final_value)
end
name
end
#--------------------------------------------------------------------------
# ● Generates traits description
#--------------------------------------------------------------------------
def self.feature_description(code, data_id, value)
custom = CUSTOM_TRAITS[[0, code, data_id, self.convert_value(code, value)]]
return custom[1] unless custom.nil? || custom[1].nil?
if CODEHELP[code].is_a?(Array)
base_help = CODEHELP[code][data_id]
else
base_help = CODEHELP[code]
end
data_name = case code
when 11, 31
$data_system.elements[data_id]
when 12, 21
Vocab.param(data_id)
when 13, 14, 32
$data_states[data_id].name
when 22
X_PARAMETERS[data_id]
when 23
S_PARAMETERS[data_id]
when 41, 42
$data_system.skill_types[data_id]
when 43, 44
$data_skills[data_id].name
when 51
$data_system.weapon_types[data_id]
when 52
$data_system.armor_types[data_id]
when 53, 54
Vocab.etype(data_id)
when 62
SPECIAL_FLAGS[data_id]
when 64
PARTY_ABILITY[data_id]
end
final_value = case code
when 11, 13
100 - (value * 100)
when 33, 34
value
else
value * 100
end
if data_name.nil?
name = sprintf(base_help, final_value)
else
name = sprintf(base_help, data_name, final_value)
end
name
end
#--------------------------------------------------------------------------
# ● Generates effects name
#--------------------------------------------------------------------------
def self.effect_name(code, data_id, value1, value2)
custom = CUSTOM_TRAITS[[1, code, data_id,
self.convert_value(code, value1, false),
self.convert_value(code, value2, false)]]
return custom[0] unless custom.nil? || custom[0].nil?
base_name = EFFECTS_CODENAMES[code]
data_name = case code
when 21, 22
$data_states[data_id].name
when 31, 32, 33, 34, 42
Vocab.param(data_id)
when 43
$data_skills[data_id]
end
if data_name.nil?
name = sprintf(base_name, value1, value2)
else
name = sprintf(base_name, data_name, value1, value2)
end
name
end
#--------------------------------------------------------------------------
# ● Generates effects description
#--------------------------------------------------------------------------
def self.effect_description(code, data_id, value1, value2)
custom = CUSTOM_TRAITS[[1, code, data_id,
self.convert_value(code, value1, false),
self.convert_value(code, value2, false)]]
return custom[1] unless custom.nil? || custom[1].nil?
if EFFECTS_CODEHELP[code].is_a?(Array)
base_help = value2 > 0 ? EFFECTS_CODEHELP[code][0] :
EFFECTS_CODEHELP[code][1]
else
base_help = EFFECTS_CODEHELP[code]
end
data_name = case code
when 21, 22
$data_states[data_id].name
when 31, 32, 33, 34, 42
Vocab.param(data_id)
when 43
$data_skills[data_id]
end
value1 = self.convert_value(code, value1, false)
value2 = self.convert_value(code, value2, false)
value1 = value2 if value1 == 0
if data_name.nil?
name = sprintf(base_help, value1, value2)
else
name = sprintf(base_help, data_name, value1, value2)
end
name
end
#--------------------------------------------------------------------------
# ● Converts the real value to the one entered in the editor
#--------------------------------------------------------------------------
def self.convert_value(code, value, feature = true)
if feature && [33, 34].include?(code)
return value.to_i
elsif feature && [21].include?(code)
return (value.to_f / 100)
elsif [11, 12].include?(code) && value <= 1
return (value.to_i * 100).to_i
else
value.to_i
end
end
#--------------------------------------------------------------------------
# ● Points towards either feature name or effect name
#--------------------------------------------------------------------------
def self.trait_name(trait)
if trait.is_a?(RPG::BaseItem::Feature)
return self.feature_name(trait.code, trait.data_id, trait.value)
end
self.effect_name(trait.code, trait.data_id, trait.value1, trait.value2)
end
#--------------------------------------------------------------------------
# ● Points towards either feature description or effect description
#--------------------------------------------------------------------------
def self.trait_description(trait)
if trait.is_a?(RPG::BaseItem::Feature)
return self.feature_description(trait.code, trait.data_id, trait.value)
end
self.effect_description(trait.code, trait.data_id, trait.value1,
trait.value2)
end
end
end
[/code]
- HinolaModérateur
- Nombre de messages : 969
Age : 30
Distinction : Gagnant invaincu à ce jour de tous les concours de mapping de ce forum fait par Coco'
[Coco' ]
Grande figure du Mapping Show .
Grand admirateur de notre mascotte Vehyxine
STI Haruhiste like me [Hamu' ]
et fier de l'être ! [bibi ^^]
Un fier Homme du désert sans foi ni loi è_é [:3]
Date d'inscription : 21/05/2009
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Ven 11 Jan 2019 - 22:25
Ok cool
ça m'a pris du temps pour tester ce script mais au final l'erreur était bien où je pensais :3
Dans le script du coffre de stockage, ligne 336 :
Possible explication :
Ici le scripteur demande à créer un alias, un nouveau bout de code qui aura le même fonctionnement qu'un déjà écrit dans les scripts de base.
Et il l’exécute avant son bout de code à lui.
Sauf que ce bout de code test premièrement si la fenêtre est active, et elle ne doit pas être "détruite" pour ça.
et exécute des actions qui peuvent la détruire (quand on quitte le menu par exemple)
Mais là il a dans son code repris le code précédent complétement.
Le test y compris. Donc quand une fenêtre est validée (touche entrée), elle est testée (return unless open? && active) se détruit dans le code de base du logiciel, et est à nouveau testée dans le code du coffre de stockage (qui ne crée pas un nouveau type de fenêtre, mais modifie celui qui existe déjà) et vu que le test rate si la fenêtre est détruite (disposed) Eh bah ça crash.
Je suis surpris qu'il n'y ai pas eu de problème avant et ailleurs.
Solution :
1) Tout ce qui existait déjà dans le code de base, on va le rendre inactif.
Pour ça, on va mettre les lignes en commentaire (avec un # devant)
Et pour ajouter une sécurité, on va tester si la fenêtre a été détruite
Tu peux donc remplacer les lignes que j'ai donné au début par celles-ci :
Normalement, et je dis bien normalement, c'est bon.
J'ai relevé un autre problème sur le script de stockage, mais il ne devrait pas gêner (pas d'erreur qui quitte le jeu) et qui serait un peu plus long à corriger.
(Quand tu appuis sur maj alors que tu es dans la sélection objets/armes/armures/objet clé)
ça m'a pris du temps pour tester ce script mais au final l'erreur était bien où je pensais :3
Dans le script du coffre de stockage, ligne 336 :
- Code:
alias process_handling_coffre_stockage process_handling
def process_handling
process_handling_coffre_stockage
return unless open? && active
return process_ok if ok_enabled? && Input.trigger?(:C)
return process_cancel if cancel_enabled? && Input.trigger?(:B)
return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
return process_pageup if handle?(:pageup) && Input.trigger?(:L)
return process_switch if handle?(:switch) && Input.trigger?(Coffre_Stockage::Touche_Switch)
end
Possible explication :
Ici le scripteur demande à créer un alias, un nouveau bout de code qui aura le même fonctionnement qu'un déjà écrit dans les scripts de base.
Et il l’exécute avant son bout de code à lui.
Sauf que ce bout de code test premièrement si la fenêtre est active, et elle ne doit pas être "détruite" pour ça.
et exécute des actions qui peuvent la détruire (quand on quitte le menu par exemple)
Mais là il a dans son code repris le code précédent complétement.
Le test y compris. Donc quand une fenêtre est validée (touche entrée), elle est testée (return unless open? && active) se détruit dans le code de base du logiciel, et est à nouveau testée dans le code du coffre de stockage (qui ne crée pas un nouveau type de fenêtre, mais modifie celui qui existe déjà) et vu que le test rate si la fenêtre est détruite (disposed) Eh bah ça crash.
Je suis surpris qu'il n'y ai pas eu de problème avant et ailleurs.
Solution :
1) Tout ce qui existait déjà dans le code de base, on va le rendre inactif.
Pour ça, on va mettre les lignes en commentaire (avec un # devant)
Et pour ajouter une sécurité, on va tester si la fenêtre a été détruite
Tu peux donc remplacer les lignes que j'ai donné au début par celles-ci :
- Code:
alias process_handling_coffre_stockage process_handling
def process_handling
process_handling_coffre_stockage
#return unless open? && active
#return process_ok if ok_enabled? && Input.trigger?(:C)
#return process_cancel if cancel_enabled? && Input.trigger?(:B)
#return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
#return process_pageup if handle?(:pageup) && Input.trigger?(:L)
return if disposed? # ne va pas plus loin si la fenêtre a été détruite
return process_switch if handle?(:switch) && Input.trigger?(Coffre_Stockage::Touche_Switch)
end
Normalement, et je dis bien normalement, c'est bon.
J'ai relevé un autre problème sur le script de stockage, mais il ne devrait pas gêner (pas d'erreur qui quitte le jeu) et qui serait un peu plus long à corriger.
(Quand tu appuis sur maj alors que tu es dans la sélection objets/armes/armures/objet clé)
- KelArtisteMembre
- Nombre de messages : 20
Localisation : Caché dans le placard de Yanfly
Distinction : aucune
Date d'inscription : 25/12/2018
Re: VX ACE : Compatibilité des Scripts [Synthesis] et [Coffre Stockage]
Dim 13 Jan 2019 - 15:22
Magnifique, ça marche à la perfection, merci mille fois !
Si je puis me permettre, quelle est la nature du second bug ? Si jamais tu parviens à le résoudre, fais-moi signe.
Si je puis me permettre, quelle est la nature du second bug ? Si jamais tu parviens à le résoudre, fais-moi signe.
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|