- NérylisMembre
- Nombre de messages : 615
Age : 35
Localisation : Seine Maritime
Distinction : aucune
Date d'inscription : 23/11/2014
Maîtrise des types d'armes
Mer 3 Aoû 2016 - 9:48
Coucou,
J'aurais besoin d'une petite modification sur un script que j'utilise pour gérer les différents rangs de maîtrise des types d'armes.
L'idée du script, c'est que chaque coup de base porté sur l'ennemi donne un point de maîtrise pour le type de l'arme équipée. A la base, j'avais mis des valeurs communes pour chaque type d'arme. En gros, peu importe le type d'arme utilisé, à 500 points, on avait tel rang, à 1000 points, tel rang... Sauf que c'était pas pratique. Alors, j'ai décidé de mettre des valeurs différentes et séparer chaque type d'arme.
Dans l'upgrade list, entre la ligne 34 et la ligne 104, j'ai juste changé les valeurs pour lesquelles on gagne le bonus. Maintenant, chaque type d'arme a ses propres valeurs (pour la hache, après 75 attaques données, on gagne 2 points en force, etc...). Cette partie-là marche bien. On gagne bien le bonus quand on franchit le palier.
Là où ça marche moins bien, c'est le lvl description à partir de la ligne 115. Le script ne distingue pas les différents types d'armes. Il prend la valeur la plus basse et attribue le nom du rang. Exemple : un personnage qui utilise les griffes doit monter à 150 points pour passer au rang Initié. Sauf que lorsqu'il aura atteint 50 points, bien qu'il ne gagne pas encore le bonus (ce qui est normal), on verra affiché Initié car il ne faut que 50 points pour passer Initié avec le type d'arme bâton. Mon souci se trouve là. Je pense qu'il faut modifier cette partie-là. Quelqu'un saurait faire ça s'il vous plaît ? Apparemment, c'est une histoire de tableau qu'il faut redécouper mais je ne sais pas comment faire.
Une démo pour ceux que ça intéresse : http://www.mediafire.com/download/x1815hxc839h6wa/Ace+menu+-+Type+arme.exe
(Passez les lignes 240 et 253 si ce n'est pas fait dans la démo, ça évitera un message d'erreur en fin de combat.)
Le script ci-dessous :
J'aurais besoin d'une petite modification sur un script que j'utilise pour gérer les différents rangs de maîtrise des types d'armes.
L'idée du script, c'est que chaque coup de base porté sur l'ennemi donne un point de maîtrise pour le type de l'arme équipée. A la base, j'avais mis des valeurs communes pour chaque type d'arme. En gros, peu importe le type d'arme utilisé, à 500 points, on avait tel rang, à 1000 points, tel rang... Sauf que c'était pas pratique. Alors, j'ai décidé de mettre des valeurs différentes et séparer chaque type d'arme.
Dans l'upgrade list, entre la ligne 34 et la ligne 104, j'ai juste changé les valeurs pour lesquelles on gagne le bonus. Maintenant, chaque type d'arme a ses propres valeurs (pour la hache, après 75 attaques données, on gagne 2 points en force, etc...). Cette partie-là marche bien. On gagne bien le bonus quand on franchit le palier.
Là où ça marche moins bien, c'est le lvl description à partir de la ligne 115. Le script ne distingue pas les différents types d'armes. Il prend la valeur la plus basse et attribue le nom du rang. Exemple : un personnage qui utilise les griffes doit monter à 150 points pour passer au rang Initié. Sauf que lorsqu'il aura atteint 50 points, bien qu'il ne gagne pas encore le bonus (ce qui est normal), on verra affiché Initié car il ne faut que 50 points pour passer Initié avec le type d'arme bâton. Mon souci se trouve là. Je pense qu'il faut modifier cette partie-là. Quelqu'un saurait faire ça s'il vous plaît ? Apparemment, c'est une histoire de tableau qu'il faut redécouper mais je ne sais pas comment faire.
Une démo pour ceux que ça intéresse : http://www.mediafire.com/download/x1815hxc839h6wa/Ace+menu+-+Type+arme.exe
(Passez les lignes 240 et 253 si ce n'est pas fait dans la démo, ça évitera un message d'erreur en fin de combat.)
Le script ci-dessous :
- Code:
=begin
##############################################################
Weapon_Upgrade
####
Vincent26
####
Description:
Ce script permet de monter en level pour l'utilisation de catégorie d'armes.
Le principe est que chaque coup donné avec un type d'armes particulier augmente
son expérience. Une fois un niveau passé, le personnage reçoit une amélioration
définitive d'une de ses caractéristiques.
Un menu secondaire est ajouté au menu status à l'appui de la touche Shift.
Le niveau de compétence pour une arme du héros est associé à un nom descriptif.
####
Utilisation :
Configurer le module suivant pour mettre en place ce script.
=end
module Weapon_Upgrade
#Ne pas modifier
CARACTERISTIQUE = {:max_hp => 0,:max_mp => 1,:force => 2,:defense => 3,
:magic_atk => 4,:magic_def => 5,:agilité => 6,:chance => 7}
#LISTE DES TYPES D'ARMES DANS LE LEXIQUE DE LA BDD
#
#
# Liste des upgrades des types d'armes :
# TYPE => [[NBR_COUP,VALEUR,CARACTERISTIQUE,[ID_PERSONNAGE]],...]
#
# TYPE est le type d'arme (l'id associé dans la BDD)
# VALEUR est la valeur à ajouter à la caractéristique du perso
# CARACTERISTIQUE est la caractéristique à modifier
# ID_PERSONNAGE est la liste des personnages à qui peut s'appliquer cet upgrade
UPGRADE_LIST = {
1 => [[75,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Hache
[350,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1000,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[1800,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3000,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[4500,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
2 => [[150,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Griffes
[800,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2100,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5100,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[7500,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
3 => [[110,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Lance
[525,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1300,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2200,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3300,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5250,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
4 => [[115,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Epée
[550,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1325,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2300,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3500,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5350,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
5 => [[100,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Katana
[500,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1200,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2000,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3250,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5000,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
6 => [[120,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arc
[600,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2400,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3800,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
7 => [[135,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Dague
[750,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1600,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2800,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4400,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
8 => [[65,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Massue
[300,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[900,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1650,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2450,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3750,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
9 => [[50,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Bâton
[250,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[850,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1500,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2350,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3450,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
10 => [[125,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arme à feu
[650,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1450,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2500,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4000,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6000,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
}
#Nombre de type d'arme
NBR_TYPE_ARME = 10
#Liste des types d'armes
LIST_TYPE_ARME = ["Hache","Griffes","Lance","Epée","Katana","Arc","Dague",
"Massue","Bâton","Arme à feu"]
#Description des levels de maitrisse
LVL_DESCRIPTION = {0=>"Néophyte", #Commun
50=>"Initié", #Bâton
65=>"Initié", #Massue
75=>"Initié", #Hache
100=>"Initié", #Katana
110=>"Initié", #Lance
115=>"Initié", #Epée
120=>"Initié", #Arc
125=>"Initié", #Arme à feu
135=>"Initié", #Dague
150=>"Initié", #Griffes
250=>"Apprenti", #Bâton
300=>"Apprenti", #Massue
350=>"Apprenti", #Hache
500=>"Apprenti", #Katana
525=>"Apprenti", #Lance
550=>"Apprenti", #Epée
600=>"Apprenti", #Arc
650=>"Apprenti", #Arme à feu
750=>"Apprenti", #Dague
800=>"Apprenti", #Griffes
850=>"Confirmé", #Bâton
900=>"Confirmé", #Massue
1000=>"Confirmé", #Hache
1200=>"Confirmé", #Katana
1300=>"Confirmé", #Lance
1325=>"Confirmé", #Epée
1400=>"Confirmé", #Arc
1450=>"Confirmé", #Arme à feu
1600=>"Confirmé", #Dague
2100=>"Confirmé", #Griffes
1500=>"Expert", #Bâton
1650=>"Expert", #Massue
1800=>"Expert", #Hache
2000=>"Expert", #Katana
2200=>"Expert", #Lance
2300=>"Expert", #Epée
2400=>"Expert", #Arc
2500=>"Expert", #Arme à feu
2800=>"Expert", #Dague
3400=>"Expert", #Griffes
2350=>"Prodige", #Bâton
2450=>"Prodige", #Massue
3000=>"Prodige", #Hache
3250=>"Prodige", #Katana
3300=>"Prodige", #Lance
3500=>"Prodige", #Epée
3800=>"Prodige", #Arc
4000=>"Prodige", #Arme à feu
4400=>"Prodige", #Dague
5100=>"Prodige", #Griffes
3450=>"Maître", #Bâton
3750=>"Maître", #Massue
4500=>"Maître", #Hache
5000=>"Maître", #Katana
5250=>"Maître", #Lance
5350=>"Maître", #Epée
5500=>"Maître", #Arc
6000=>"Maître", #Arme à feu
6500=>"Maître", #Dague
7500=>"Maître", #Griffes
9999=>"Légende"} #Commun
#Pour définir une autre attaque que celle de base pour le décompte des point
#ajouter cela dans la note d'un personnage :
#<Basic_Skill = ID>
#ID est l'id de la compétence prise pour base
end
class Scene_Battle
alias start_weapon_upgrade start
def start
@attaque_standard = false
start_weapon_upgrade
end
alias use_item_weapon_upgrade use_item
def use_item
@attaque_standard = false
item = @subject.current_action.item
if @subject.actor?
if @subject.actor.note =~ /<Basic_Skill = (\d+)>/
skill_id = $1.to_i
@attaque_standard = true if item.id == skill_id
else
@attaque_standard = true if item.animation_id < 0
end
end
use_item_weapon_upgrade
end
alias apply_item_effects_weapon_uprade apply_item_effects
def apply_item_effects(target, item)
apply_item_effects_weapon_uprade(target, item)
if target.result.hit? && target.result.success && @attaque_standard
if @subject.actor?
@subject.upgrade_weapon_skill
end
end
end
end
module BattleManager
class << self
alias gain_exp_weapon_update gain_exp
alias process_abort_weapon_update process_abort
def gain_exp
gain_exp_weapon_update
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
#$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
end
def process_abort
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
#$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
process_abort_weapon_update
end
end
end
class Game_Actor
attr_reader :upgrade_list
attr_accessor :texte_fin_combat
alias initialize_weapon_upgrade initialize
def initialize(actor_id)
initialize_weapon_upgrade(actor_id)
@weapon_upgrade = {}
@texte_fin_combat = []
@upgrade_list = {}
Weapon_Upgrade::UPGRADE_LIST.each do |key,value|
li = []
for list in value
if list[3].include?(actor_id)
li.push([list[0],list[1],list[2],true])
end
end
@upgrade_list[key] = li if li != []
end
end
def upgrade_weapon_skill
for i in 1..Weapon_Upgrade::NBR_TYPE_ARME
if wtype_equipped?(i)
@weapon_upgrade[i.to_s] = 0 if !@weapon_upgrade.include?(i.to_s)
@weapon_upgrade[i.to_s] += 1
test_upgrade_weapon(i)
end
end
end
def level_up_weapon(name,lvl)
id = (Weapon_Upgrade::LIST_TYPE_ARME.index(name)+1).to_s
@weapon_upgrade[id] = 0 if !@weapon_upgrade.include?(id)
@weapon_upgrade[id] += lvl
@upgrade_list.each do |key,lis|
next if key.to_s != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
@upgrade_list[key][j][3] = false
end
end
end
end
end
def weapon_upgrade
return @weapon_upgrade
end
def test_upgrade_weapon(id)
@upgrade_list.each do |key,lis|
next if key != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
#NOMPERSO | NOUVEAU RANG | | NOM ARME | | NOM DU PARAMETRE| | VALEUR AUG |
@texte_fin_combat.push(@name +" devient "+Weapon_Upgrade::LVL_DESCRIPTION[liste[0]].to_s+" en "+Weapon_Upgrade::LIST_TYPE_ARME[id-1]+ ", "+Vocab.param(param)+" +"+liste[1].to_s+".")
@upgrade_list[key][j][3] = false
end
end
end
end
end
end
class Scene_Status
alias update_weapon_upgrade update
def update
if Input.trigger?(:UP) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel -= 1
@item_window.refresh
elsif Input.trigger?(:DOWN) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel += 1
@item_window.refresh
end
if Input.trigger?(:B) && @item_window.menu == 1
Sound.play_cancel
@item_window.menu = 0
@command_window.activate
else
update_weapon_upgrade
end
end
alias terminate_vincent26_weapon_type terminate
def terminate
terminate_vincent26_weapon_type
$game_temp.scene_status_index = nil
end
def maitrise_commande
if @item_window.line_nbr_max == 0
@item_window.menu = 0
@command_window.activate
else
@item_window.menu = 1
end
end
end
class Window_StatusItem < Window_Base
attr_accessor :menu
attr_reader :ligne_actuel
NRB_LINE = 7
alias initialize_weapon_upgrade initialize
def initialize(*args)
@ligne_actuel = 0
@table_upgrade = []
@menu = 0
initialize_weapon_upgrade(*args)
end
def ligne_actuel=(value)
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@ligne_actuel = [[value,table.length-NRB_LINE].min,0].max
end
def line_nbr_max
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
[table.length-NRB_LINE,0].max
end
alias contents_height_weapon_upgrade contents_height
def contents_height
if @upgrade_weapon_contents
@table_upgrade.length*24+24
else
contents_height_weapon_upgrade
end
end
alias refresh_weapon_upgrade refresh
def refresh
@upgrade_weapon_contents = false
create_contents
refresh_weapon_upgrade
end
def maitrise_enable
actif = self.line_nbr_max() != 0
return actif
end
def draw_maitrise_block
if @actor_save != @actor
@ligne_actuel = 0
@actor_save = @actor
end
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@table_upgrade = table
@upgrade_weapon_contents = true
create_contents
y = @ligne_actuel*24
self.oy = y
draw_arme_usable(32,y,table)
draw_arme_lvl(270,y,table)
draw_arme_param(380,y,table)
draw_arme_rang(150,y,table)
end
def draw_arme_rang(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(table[i-1+@ligne_actuel])
else
rang = "Rang"
end
if rang == "Rang"
change_color(system_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
change_color(normal_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
end
end
end
end
def draw_arme_param(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
value = j[1]
param = Weapon_Upgrade::CARACTERISTIQUE[j[2]]
texte = Vocab::param(param)+" +"+value.to_s
break
end
texte = "-"
end
else
texte = "-"
end
else
texte = "Obtention"
end
if texte == "Obtention"
change_color(system_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
if texte == "-"
change_color(text_color(17))
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_usable(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
texte = Weapon_Upgrade::LIST_TYPE_ARME[table[i-1+@ligne_actuel]-1]
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
else
texte = "Type arme"
end
if texte == "Type arme"
change_color(system_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_lvl(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
lvl = j[0]
texte = nbr.to_s+"/"+lvl.to_s
break
end
texte = "Max"
end
else
texte = "Max"
end
else
texte = "Points"
end
if texte == "Points"
change_color(system_color)
draw_text(252, y+i*line_height, 140, line_height , texte, 1)
else
if texte == "Max"
change_color(text_color(17))
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
end
class Game_Interpreter
def get_rang_lvl_actor(id, weapon_id)
nbr = $game_actors[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
def get_rang_lvl_member(id, weapon_id)
nbr = $game_party.members[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
end
- DrakeRoxasMembre
- Nombre de messages : 44
Age : 31
Distinction : aucune
Date d'inscription : 23/07/2016
Re: Maîtrise des types d'armes
Mer 3 Aoû 2016 - 20:54
J'ai pas VX pour tester, donc je ne garantit rien ^^' Juste, pour le LVL_DESCRIPTION j'ai mis un truc à l'arrache, faut le refaire en suivant le modèle. Tu me diras ce que ça donne, vu que je peux pas tester ^^'
- Code:
=begin
##############################################################
Weapon_Upgrade
####
Vincent26
####
Description:
Ce script permet de monter en level pour l'utilisation de catégorie d'armes.
Le principe est que chaque coup donné avec un type d'armes particulier augmente
son expérience. Une fois un niveau passé, le personnage reçoit une amélioration
définitive d'une de ses caractéristiques.
Un menu secondaire est ajouté au menu status à l'appui de la touche Shift.
Le niveau de compétence pour une arme du héros est associé à un nom descriptif.
####
Utilisation :
Configurer le module suivant pour mettre en place ce script.
=end
module Weapon_Upgrade
#Ne pas modifier
CARACTERISTIQUE = {:max_hp => 0,:max_mp => 1,:force => 2,:defense => 3,
:magic_atk => 4,:magic_def => 5,:agilité => 6,:chance => 7}
#LISTE DES TYPES D'ARMES DANS LE LEXIQUE DE LA BDD
#
#
# Liste des upgrades des types d'armes :
# TYPE => [[NBR_COUP,VALEUR,CARACTERISTIQUE,[ID_PERSONNAGE]],...]
#
# TYPE est le type d'arme (l'id associé dans la BDD)
# VALEUR est la valeur à ajouter à la caractéristique du perso
# CARACTERISTIQUE est la caractéristique à modifier
# ID_PERSONNAGE est la liste des personnages à qui peut s'appliquer cet upgrade
UPGRADE_LIST = {
1 => [[75,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Hache
[350,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1000,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[1800,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3000,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[4500,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
2 => [[150,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Griffes
[800,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2100,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5100,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[7500,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
3 => [[110,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Lance
[525,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1300,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2200,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3300,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5250,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
4 => [[115,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Epée
[550,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1325,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2300,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3500,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5350,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
5 => [[100,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Katana
[500,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1200,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2000,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3250,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5000,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
6 => [[120,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arc
[600,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2400,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3800,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
7 => [[135,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Dague
[750,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1600,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2800,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4400,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
8 => [[65,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Massue
[300,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[900,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1650,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2450,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3750,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
9 => [[50,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Bâton
[250,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[850,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1500,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2350,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3450,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
10 => [[125,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arme à feu
[650,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1450,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2500,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4000,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6000,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
}
#Nombre de type d'arme
NBR_TYPE_ARME = 10
#Liste des types d'armes
LIST_TYPE_ARME = ["Hache","Griffes","Lance","Epée","Katana","Arc","Dague",
"Massue","Bâton","Arme à feu"]
#Description des levels de maitrisse
LVL_DESCRIPTION = {
1 => { #Hache
0=>"Néophyte",
100=>"Initié",
350=>"Apprenti",
.
.
.
9999=>"Légende"},
2 => { #Griffes
0=>"Néophyte",
100=>"Initié",
350=>"Apprenti",
.
.
.
9999=>"Légende"},
.
.
.
10 => { #Arme à feu
0=>"Néophyte",
100=>"Initié",
350=>"Apprenti",
.
.
.
9999=>"Légende"}
}
#Pour définir une autre attaque que celle de base pour le décompte des point
#ajouter cela dans la note d'un personnage :
#<Basic_Skill = ID>
#ID est l'id de la compétence prise pour base
end
class Scene_Battle
alias start_weapon_upgrade start
def start
@attaque_standard = false
start_weapon_upgrade
end
alias use_item_weapon_upgrade use_item
def use_item
@attaque_standard = false
item = @subject.current_action.item
if @subject.actor?
if @subject.actor.note =~ /<Basic_Skill = (\d+)>/
skill_id = $1.to_i
@attaque_standard = true if item.id == skill_id
else
@attaque_standard = true if item.animation_id < 0
end
end
use_item_weapon_upgrade
end
alias apply_item_effects_weapon_uprade apply_item_effects
def apply_item_effects(target, item)
apply_item_effects_weapon_uprade(target, item)
if target.result.hit? && target.result.success && @attaque_standard
if @subject.actor?
@subject.upgrade_weapon_skill
end
end
end
end
module BattleManager
class << self
alias gain_exp_weapon_update gain_exp
alias process_abort_weapon_update process_abort
def gain_exp
gain_exp_weapon_update
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
#$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
end
def process_abort
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
#$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
process_abort_weapon_update
end
end
end
class Game_Actor
attr_reader :upgrade_list
attr_accessor :texte_fin_combat
alias initialize_weapon_upgrade initialize
def initialize(actor_id)
initialize_weapon_upgrade(actor_id)
@weapon_upgrade = {}
@texte_fin_combat = []
@upgrade_list = {}
Weapon_Upgrade::UPGRADE_LIST.each do |key,value|
li = []
for list in value
if list[3].include?(actor_id)
li.push([list[0],list[1],list[2],true])
end
end
@upgrade_list[key] = li if li != []
end
end
def upgrade_weapon_skill
for i in 1..Weapon_Upgrade::NBR_TYPE_ARME
if wtype_equipped?(i)
@weapon_upgrade[i.to_s] = 0 if !@weapon_upgrade.include?(i.to_s)
@weapon_upgrade[i.to_s] += 1
test_upgrade_weapon(i)
end
end
end
def level_up_weapon(name,lvl)
id = (Weapon_Upgrade::LIST_TYPE_ARME.index(name)+1).to_s
@weapon_upgrade[id] = 0 if !@weapon_upgrade.include?(id)
@weapon_upgrade[id] += lvl
@upgrade_list.each do |key,lis|
next if key.to_s != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
@upgrade_list[key][j][3] = false
end
end
end
end
end
def weapon_upgrade
return @weapon_upgrade
end
def test_upgrade_weapon(id)
@upgrade_list.each do |key,lis|
next if key != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
#NOMPERSO | NOUVEAU RANG | | NOM ARME | | NOM DU PARAMETRE| | VALEUR AUG |
@texte_fin_combat.push(@name +" devient "+Weapon_Upgrade::LVL_DESCRIPTION[id][liste[0]].to_s+" en "+Weapon_Upgrade::LIST_TYPE_ARME[id-1]+ ", "+Vocab.param(param)+" +"+liste[1].to_s+".")
@upgrade_list[key][j][3] = false
end
end
end
end
end
end
class Scene_Status
alias update_weapon_upgrade update
def update
if Input.trigger?(:UP) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel -= 1
@item_window.refresh
elsif Input.trigger?(:DOWN) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel += 1
@item_window.refresh
end
if Input.trigger?(:B) && @item_window.menu == 1
Sound.play_cancel
@item_window.menu = 0
@command_window.activate
else
update_weapon_upgrade
end
end
alias terminate_vincent26_weapon_type terminate
def terminate
terminate_vincent26_weapon_type
$game_temp.scene_status_index = nil
end
def maitrise_commande
if @item_window.line_nbr_max == 0
@item_window.menu = 0
@command_window.activate
else
@item_window.menu = 1
end
end
end
class Window_StatusItem < Window_Base
attr_accessor :menu
attr_reader :ligne_actuel
NRB_LINE = 7
alias initialize_weapon_upgrade initialize
def initialize(*args)
@ligne_actuel = 0
@table_upgrade = []
@menu = 0
initialize_weapon_upgrade(*args)
end
def ligne_actuel=(value)
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@ligne_actuel = [[value,table.length-NRB_LINE].min,0].max
end
def line_nbr_max
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
[table.length-NRB_LINE,0].max
end
alias contents_height_weapon_upgrade contents_height
def contents_height
if @upgrade_weapon_contents
@table_upgrade.length*24+24
else
contents_height_weapon_upgrade
end
end
alias refresh_weapon_upgrade refresh
def refresh
@upgrade_weapon_contents = false
create_contents
refresh_weapon_upgrade
end
def maitrise_enable
actif = self.line_nbr_max() != 0
return actif
end
def draw_maitrise_block
if @actor_save != @actor
@ligne_actuel = 0
@actor_save = @actor
end
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@table_upgrade = table
@upgrade_weapon_contents = true
create_contents
y = @ligne_actuel*24
self.oy = y
draw_arme_usable(32,y,table)
draw_arme_lvl(270,y,table)
draw_arme_param(380,y,table)
draw_arme_rang(150,y,table)
end
def draw_arme_rang(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[table[i-1+@ligne_actuel]][0]
Weapon_Upgrade::LVL_DESCRIPTION[table[i-1+@ligne_actuel]].each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(table[i-1+@ligne_actuel])
else
rang = "Rang"
end
if rang == "Rang"
change_color(system_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
change_color(normal_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
end
end
end
end
def draw_arme_param(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
value = j[1]
param = Weapon_Upgrade::CARACTERISTIQUE[j[2]]
texte = Vocab::param(param)+" +"+value.to_s
break
end
texte = "-"
end
else
texte = "-"
end
else
texte = "Obtention"
end
if texte == "Obtention"
change_color(system_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
if texte == "-"
change_color(text_color(17))
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_usable(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
texte = Weapon_Upgrade::LIST_TYPE_ARME[table[i-1+@ligne_actuel]-1]
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[table[i-1+@ligne_actuel]][0]
Weapon_Upgrade::LVL_DESCRIPTION[table[i-1+@ligne_actuel]].each do |key , value|
break if nbr < key
rang = value
end
else
texte = "Type arme"
end
if texte == "Type arme"
change_color(system_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_lvl(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
lvl = j[0]
texte = nbr.to_s+"/"+lvl.to_s
break
end
texte = "Max"
end
else
texte = "Max"
end
else
texte = "Points"
end
if texte == "Points"
change_color(system_color)
draw_text(252, y+i*line_height, 140, line_height , texte, 1)
else
if texte == "Max"
change_color(text_color(17))
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
end
class Game_Interpreter
def get_rang_lvl_actor(id, weapon_id)
nbr = $game_actors[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[weapon_id][0]
Weapon_Upgrade::LVL_DESCRIPTION[weapon_id].each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
def get_rang_lvl_member(id, weapon_id)
nbr = $game_party.members[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[weapon_id][0]
Weapon_Upgrade::LVL_DESCRIPTION[weapon_id].each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
end
- NérylisMembre
- Nombre de messages : 615
Age : 35
Localisation : Seine Maritime
Distinction : aucune
Date d'inscription : 23/11/2014
Re: Maîtrise des types d'armes
Mer 3 Aoû 2016 - 22:31
A priori, ça a l'air de marcher mais je n'ai pas eu le temps de tout tester. Je regarderai demain en détail pour voir si tout marche bien. En tout cas, merci pour ton aide.
Dis, pour ma connaissance, tu as juste changer la partie LVL_DESCRIPTION ou tu as touché à autre chose dans le script ?
Dis, pour ma connaissance, tu as juste changer la partie LVL_DESCRIPTION ou tu as touché à autre chose dans le script ?
- DrakeRoxasMembre
- Nombre de messages : 44
Age : 31
Distinction : aucune
Date d'inscription : 23/07/2016
Re: Maîtrise des types d'armes
Jeu 4 Aoû 2016 - 16:06
J'ai un peu modifier les utilisations du LVL_DESCRIPTION pour faire LVL_DESCRIPTION[id_arme] à la place, je suis pas sûr d'avoir bien fait ce qu'il fallait pour cette partie là justement ^^'
- NérylisMembre
- Nombre de messages : 615
Age : 35
Localisation : Seine Maritime
Distinction : aucune
Date d'inscription : 23/11/2014
Re: Maîtrise des types d'armes
Jeu 4 Aoû 2016 - 16:38
D'ac, bin en tout cas j'ai testé la montée des points, le menu Statut, la prise de rang et les appels de script. Tout fonctionne correctement, ça prend bien en charge les valeurs pour chaque type d'arme.
Merci pour ton aide.
Merci pour ton aide.
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum