Night.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Sorties: Dread Mac Farlane - episode 6 / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

312 connectés actuellement

29364746 visiteurs
depuis l'ouverture

1001189 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

ConsoleFun

Zarok

RPG Maker - La Communauté

Eclipso

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RESOLU] [RPG Maker VX Ace] Maîtrise des types d'armes


Nérylis - posté le 29/07/2016 à 16:48:14 (149 messages postés)

❤ 0

Domaine concerné: Script
Logiciel utilisé: RPG Maker VX Ace
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 donné 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 svp ?

Une démo pour ceux que ça intéresse : http://www.mediafire.com/download/x1815hxc839h6wa/Ace+menu+-+Type+arme.exe

Le script ci-dessous :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
=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




arttroy - posté le 02/08/2016 à 14:26:08 (2394 messages postés)

❤ 0

Just working

Je te l'avais dit... Si je m'y met pas... Essaie de partir du script que je t'avais renvoyé, ce sera peut être plus simple à modifier donc il y aura peut être plus de candidats ^^.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


Nérylis - posté le 02/08/2016 à 16:21:33 (149 messages postés)

❤ 0

Effectivement, on peut essayer.

Donc voilà ce que arttroy avait commencé. Si quelqu'un sait comment finaliser.

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
=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 => {0=>"Néophyte",            
                      75=>"Initié",                
                      350=>"Apprenti",
                      1000=>"Confirmé",            #Hache
                      1800=>"Expert",
                      3000=>"Prodige",
                      4500=>"Maître",
                      9999=>"Légende"},
                      
                      2 => {0=>"Néophyte", 
                      150=>"Initié",                  
                      800=>"Apprenti",                                       
                      2100=>"Confirmé",            #Griffes                                        
                      3400=>"Expert",              
                      5100=>"Prodige",             
                      7500=>"Maître",                                                    
                      9999=>"Légende"},
                      
                      3 => {0=>"Néophyte",            
                      110=>"Initié",                
                      525=>"Apprenti",
                      1300=>"Confirmé",            #Lance
                      2200=>"Expert",
                      3300=>"Prodige",
                      5250=>"Maître",
                      9999=>"Légende"},
                      
                      4 => {0=>"Néophyte",            
                      115=>"Initié",                
                      550=>"Apprenti",
                      1325=>"Confirmé",            #Epée
                      2300=>"Expert",
                      3500=>"Prodige",
                      5350=>"Maître",
                      9999=>"Légende"},
                      
                      5 => {0=>"Néophyte",            
                      100=>"Initié",                
                      500=>"Apprenti",
                      1200=>"Confirmé",            #Katana
                      2000=>"Expert",
                      3250=>"Prodige",
                      5000=>"Maître",
                      9999=>"Légende"},
                                            
                      6 => {0=>"Néophyte",            
                      120=>"Initié",                
                      600=>"Apprenti",
                      1400=>"Confirmé",            #Arc
                      2400=>"Expert",
                      3800=>"Prodige",
                      5500=>"Maître",
                      9999=>"Légende"},
                      
                      7 => {0=>"Néophyte",            
                      135=>"Initié",                
                      750=>"Apprenti",
                      1600=>"Confirmé",            #Dague
                      2800=>"Expert",
                      4400=>"Prodige",
                      6500=>"Maître",
                      9999=>"Légende"},
 
                      8 => {0=>"Néophyte",            
                      65=>"Initié",                
                      300=>"Apprenti",
                      900=>"Confirmé",            #Massue
                      1650=>"Expert",
                      2450=>"Prodige",
                      3750=>"Maître",
                      9999=>"Légende"},
                      
                      9 => {0=>"Néophyte",            
                      50=>"Initié",                
                      250=>"Apprenti",
                      850=>"Confirmé",            #Bâton
                      1500=>"Expert",
                      2350=>"Prodige",
                      3450=>"Maître",
                      9999=>"Légende"},
                      
                      10 => {0=>"Néophyte",            
                      125=>"Initié",                
                      650=>"Apprenti",
                      1450=>"Confirmé",            #Arme à feu
                      2500=>"Expert",
                      4000=>"Prodige",
                      6000=>"Maître",
                      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
      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
      gain_exp_weapon_update
    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][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[i][0]
        Weapon_Upgrade::LVL_DESCRIPTION[i].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[i][0]
        Weapon_Upgrade::LVL_DESCRIPTION[i].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



Edit : Notez que vous pouvez utiliser un event comme les hexagrammes blancs en haut à droite sur ma démo pour monter manuellement les points de maîtrise sans avoir besoin de combattre. Ainsi, vous pouvez vérifier que le grade et le bonus sont corrects via le menu Statut - Maîtrise.


arttroy - posté le 03/08/2016 à 12:15:08 (2394 messages postés)

❤ 0

Just working

Je tiens à préciser que le problème vient de cet appel :

Portion de code : Tout sélectionner

1
2
3
4
5
        rang = Weapon_Upgrade::LVL_DESCRIPTION[i][0]
        Weapon_Upgrade::LVL_DESCRIPTION[i].each do |key , value|
          break if nbr < key
          rang = value
        end



Le souci étant que ça me choisi systématiquement le premier hash (correspondant à la hâche ^^) pour les valeurs de LVL_DESCRIPTION (néophyte, initié, ...). J'ai bien compris que c'est le i qui ne convient pas mais je ne trouve pas l'appel correct.

idem pour cette partie là qui affiche un message en fin de combat en cas de up de maîtrise :

Portion de code : Tout sélectionner

1
2
            @texte_fin_combat.push(@name +" devient "+Weapon_Upgrade::LVL_DESCRIPTION[id][0].to_s+" en "+Weapon_Upgrade::LIST_TYPE_ARME[id-1]+ ", "+Vocab.param(param)+" +"+liste[1].to_s+".")
 



Là pour l'instant ça ne m'affiche que néophyte quel que soit le nombre de points possédés (alors qu'on devrait passer initié puisqu'on est déjà néophyte).

Si messire Zeus ou quelqu'un du même (hardcore) level pouvait me montrer comment faire ce serait cool svp.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


Nérylis - posté le 04/08/2016 à 14:17:17 (149 messages postés)

❤ 0

Solution donnée en externe. La voici pour info :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
=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 types d'armes
  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 maitrîse
  LVL_DESCRIPTION = { 1 => {0=>"Néophyte",                       #Hache 
                            75=>"Initié",                
                            350=>"Apprenti",
                            1000=>"Confirmé",            
                            1800=>"Expert",
                            3000=>"Prodige",
                            4500=>"Maître",
                            9999=>"Légende"},
 
                      2 => {0=>"Néophyte",                       #Griffes 
                            150=>"Initié",                  
                            800=>"Apprenti",                                       
                            2100=>"Confirmé",                                                   
                            3400=>"Expert",              
                            5100=>"Prodige",             
                            7500=>"Maître",                                                    
                            9999=>"Légende"},           
 
                      3 => {0=>"Néophyte",                       #Lance
                            110=>"Initié",                
                            525=>"Apprenti",
                            1300=>"Confirmé",            
                            2200=>"Expert",
                            3300=>"Prodige",
                            5250=>"Maître",
                            9999=>"Légende"},
      
                      4 => {0=>"Néophyte",                       #Epée
                            115=>"Initié",                
                            550=>"Apprenti",
                            1325=>"Confirmé",            
                            2300=>"Expert",
                            3500=>"Prodige",
                            5350=>"Maître",
                            9999=>"Légende"},
       
                      5 => {0=>"Néophyte",                       #Katana
                            100=>"Initié",                
                            500=>"Apprenti",
                            1200=>"Confirmé",            
                            2000=>"Expert",
                            3250=>"Prodige",
                            5000=>"Maître",
                            9999=>"Légende"},
                      
                      6 => {0=>"Néophyte",                       #Arc
                            120=>"Initié",                
                            600=>"Apprenti",
                            1400=>"Confirmé",            
                            2400=>"Expert",
                            3800=>"Prodige",
                            5500=>"Maître",
                            9999=>"Légende"},
      
                      7 => {0=>"Néophyte",                       #Dague
                            135=>"Initié",                
                            750=>"Apprenti",
                            1600=>"Confirmé",            
                            2800=>"Expert",
                            4400=>"Prodige",
                            6500=>"Maître",
                            9999=>"Légende"},
      
                      8 => {0=>"Néophyte",                       #Massue
                            65=>"Initié",                
                            300=>"Apprenti",
                            900=>"Confirmé",            
                            1650=>"Expert",
                            2450=>"Prodige",
                            3750=>"Maître",
                            9999=>"Légende"},
      
                      9 => {0=>"Néophyte",                       #Bâton
                            50=>"Initié",                
                            250=>"Apprenti",
                            850=>"Confirmé",            
                            1500=>"Expert",
                            2350=>"Prodige",
                            3450=>"Maître",
                            9999=>"Légende"},
                      
                     10 => {0=>"Néophyte",                       #Arme à feu
                            125=>"Initié",                
                            650=>"Apprenti",
                            1450=>"Confirmé",            
                            2500=>"Expert",
                            4000=>"Prodige",
                            6000=>"Maître",
                            9999=>"Légende"}}
                                           
  #Pour définir une autre attaque que celle de base pour le décompte des points,
  #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



Index du forum > Entraide > [RESOLU] [RPG Maker VX Ace] Maîtrise des types d'armes

repondre up

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers