Day.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", (...) / Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

505 connectés actuellement

29438594 visiteurs
depuis l'ouverture

4672 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

RPG Maker Détente

Eclipso

Zarok

Alex d'Or

Lumen

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RPGM XP - RESOLU] Ne pas afficher certains objets (menu vente)


Wingan - posté le 10/09/2015 à 10:32:32 (10 messages postés)

❤ 0

Domaine concerné: Script
Logiciel utilisé: RPGM XP
Bonjour tout le monde !

Après de nombreuses recherches et tentatives infructueuses en fouillant des scripts (merci mon niveau 0 en Ruby), je n'ai toujours pas trouvé de solution à mon problème.

Je souhaiterais que dans le menu vente, certains objets n'apparaissent jamais.

On va dire que ma requête a 2 niveaux : un "simple" et un "difficile". Répondre à la requête simple me suffirait, mais la difficile serait encore mieux !


Ainsi, comment répondre à l'une ou l'autre de ces requêtes, qui sont :

- Niveau "facile" : seuls les objets dont les id dans la base de donnée sont inférieurs à 500 sont présents dans la vente (ou, formulé autrement, ceux dont l'id est supérieur à 500 n'apparaissent pas)

- Niveau "difficile" : les objets dont les id sont compris dans des fourchettes prédéfinies apparaissent/n'apparaissent pas dans la vente (par exemple : objets dont les id vont de 15 à 20 et ceux entre 100 et 150 n'apparaissent pas en vente)


Voici le script qui régit mes magasins. J'imagine que ça se joue dans "Window_Shop_List" et avec l'insertion d'une ligne style "if item_id < 500", mais j'ai rien réussi à faire.

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
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
#===============================================================================
#  Leon's Shopping System
#-------------------------------------------------------------------------------
#  3/10/2007
#  v. 1.0
#-------------------------------------------------------------------------------
#  Instructions:
#   Place above main, and below the other default scripts.
#     (Yes, that is all of the instructions)
#
#  Features:
#   Replaces the default shop system.
#
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Info
#===============================================================================
class Window_Shop_Info < Window_Base
  def initialize
    super(160, 0, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh(selection = 0)
    self.contents.clear
    if selection == 0
      self.contents.font.name = "Georgia"
      self.contents.draw_text(0, 0, 448, 32, "Que souhaitez-vous faire?", 1)
    else
      self.contents.draw_text(0, 0, 448, 32, "Z: effets de l'arme/l'équip. sur les perso. - Q/W: défilement rapide", 1)
    end
  end
end
#===============================================================================
#  END Window_Shop_Info
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Option
#===============================================================================
class Window_Shop_Option < Window_Selectable
  def initialize
    super(0, 0, 160, 128)
    @option = ["Acheter", "Vendre", "Quitter"]
    @item_max = @option.size
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.active = true
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...@option.size
      y = i * 32
      self.contents.font.name = "Georgia"
      self.contents.draw_text(0, y, 128, 32, @option[i], 1)
    end
  end
end
#===============================================================================
#  END Window_Shop_Option
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Gold
#===============================================================================
class Window_Shop_Gold < Window_Base
  def initialize
    super(0, 128, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    self.contents.font.name = "Georgia"
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 60, 32, $data_system.words.gold + ":")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 128, 32, $game_party.gold.to_s, 2)
  end
end
#===============================================================================
#  END Window_Shop_Gold
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Own
#===============================================================================
class Window_Shop_Own < Window_Base
  def initialize
    super(0, 192, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    item = nil
    refresh(item)
  end
  
  def refresh(item)
    self.contents.font.name = "Georgia"
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 70, 32, "En stock:") # 48 et non 70
    if item == nil
      return
    end
    self.contents.font.color = normal_color
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    self.contents.draw_text(0, 0, 128, 32, number.to_s, 2)
  end
end
#===============================================================================
#  END Window_Shop_Own
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_List
#===============================================================================
class Window_Shop_List < Window_Selectable
  def initialize(shop_goods)
    super(160, 64, 480, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.active = false
    self.index = 0
    self.visible = false
    @shop_goods = shop_goods
    @sell = false
  end
  
  def item
    if @data != nil
      return @data[index]
    end
  end
  
  def refresh
    @sell = false
    @option_index = nil
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  
  def refresh_sell(option_index)
    @sell = true
    @option_index = option_index
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1... $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        @data.push($data_weapons[i])
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        @data.push($data_armors[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if @option_index == nil
      if item.price <= $game_party.gold and number < 99
        self.contents.font.name = "Georgia"
        self.contents.font.color = normal_color
      else
        self.contents.font.name = "Georgia"
        self.contents.font.color = disabled_color
      end
    else
      self.contents.font.name = "Georgia"
      self.contents.font.color = normal_color
    end
    x = 4
    y = index * 32
    if item.price == 0
      self.contents.font.name = "Georgia"
      self.contents.font.color = disabled_color
    else
      self.contents.font.name = "Georgia"
      self.contents.font.color = normal_color
    end
    if @sell == false
      if item.price <= $game_party.gold and number < 99
        self.contents.font.name = "Georgia"
        self.contents.font.color = normal_color
      else
        self.contents.font.name = "Georgia"
        self.contents.font.color = disabled_color
      end
    end
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.font.name = "Georgia"
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    if @option_index == nil
      self.contents.font.name = "Georgia"
      self.contents.draw_text(x + 350, y, 88, 32, item.price.to_s, 2)
    else
      item_price = (item.price / 4).round # VENTE
      self.contents.font.name = "Georgia"
      self.contents.draw_text(x + 350, y, 88, 32, item_price.to_s, 2)
    end
  end
end
#===============================================================================
#  END Window_Shop_List
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Description_Item
#===============================================================================
class Window_Shop_Description_Item < Window_Base
  def initialize
    super(90, 256, 460, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    item = nil
    refresh(item)
  end
  
  def refresh(item)
    self.contents.clear
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.font.name = "Georgia"
    self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(28, 0, 400, 32, item.name) # ici 120, pas 400
    self.contents.draw_text(0, 32, 428, 32, item.description)  # ici 428, pas 450
    self.contents.font.color = system_color
    self.contents.draw_text(0, 64, 120, 32, "Cible(s)")
    self.contents.draw_text(0, 96, 140, 32, "% PV max rendus")
    self.contents.draw_text(0, 128, 140, 32, "% PM max rendus")
    self.contents.draw_text(230, 96, 120, 32, "PV rendus")
    self.contents.draw_text(230, 128, 120, 32, "PM rendus")
    self.contents.font.color = normal_color
    self.contents.draw_text(150, 96, 90, 32, item.recover_hp_rate.to_s)
    self.contents.draw_text(150, 128, 90, 32, item.recover_sp_rate.to_s)
    self.contents.draw_text(360, 96, 90, 32, item.recover_hp.to_s)
    self.contents.draw_text(360, 128, 90, 32, item.recover_sp.to_s)
    case item.scope
    when 0
      self.contents.draw_text(70, 64, 120, 32, "Personne")
    when 1
      self.contents.draw_text(70, 64, 120, 32, "1 ennemi")
    when 2
      self.contents.draw_text(70, 64, 120, 32, "Tous les ennemis")
    when 3
      self.contents.draw_text(70, 64, 120, 32, "1 allié")
    when 4
      self.contents.draw_text(70, 64, 120, 32, "Tous les alliés")
    when 5
      self.contents.draw_text(70, 64, 120, 32, "1 allié KO")
    when 6
      self.contents.draw_text(70, 64, 120, 32, "Tous les alliés KO")
    when 7
      self.contents.draw_text(70, 64, 120, 32, "L'utilisateur")
    end
  end
end
#===============================================================================
#  END Window_Shop_Description_Item
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Description_Equipment
#===============================================================================
class Window_Shop_Description_Equipment < Window_Base
  def initialize
    super(0, 256, 640, 224)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    item = nil
    refresh(item)
  end
  
  def refresh(item)
    self.contents.clear
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.font.name = "Georgia"
    self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(28, 0, 400, 32, item.name) # ici 120, pas 400
    self.contents.draw_text(0, 32, 590, 32, item.description) # ici 590, pas 470
    self.contents.font.color = system_color
    if item.is_a?(RPG::Weapon)
      self.contents.draw_text(0, 64, 75, 32, "Atq:")
      self.contents.draw_text(0, 96, 120, 32, "Déf Phys")
      self.contents.draw_text(0, 128, 120, 32, "Déf Mag")
      self.contents.draw_text(165, 64, 120, 32, "For")
      self.contents.draw_text(165, 96, 120, 32, "Cha")
      self.contents.draw_text(165, 128, 120, 32, "Agi")
      self.contents.draw_text(165, 160, 120, 32, "Mag")
      self.contents.draw_text(310, 64, 120, 32, "Statut(s) infligé(s)")
    else
      self.contents.draw_text(0, 64, 120, 32, "Déf Phys")
      self.contents.draw_text(0, 96, 120, 32, "Déf Mag")
      self.contents.draw_text(0, 128, 120, 32, "Esq")
      self.contents.draw_text(0, 160, 120, 32, "Bonus")
      self.contents.draw_text(165, 64, 120, 32, "For")
      self.contents.draw_text(165, 96, 120, 32, "Cha")
      self.contents.draw_text(165, 128, 120, 32, "Agi")
      self.contents.draw_text(165, 160, 120, 32, "Mag")
    end
    self.contents.font.color = normal_color
    if item.is_a?(RPG::Weapon)
      self.contents.draw_text(60, 64, 75, 32, item.atk.to_s)
      self.contents.draw_text(90, 96, 75, 32, item.pdef.to_s)
      self.contents.draw_text(90, 128, 75, 32, item.mdef.to_s)
      self.contents.draw_text(195, 64, 50, 32, item.str_plus.to_s, 2)
      self.contents.draw_text(195, 96, 50, 32, item.dex_plus.to_s, 2)
      self.contents.draw_text(195, 128, 50, 32, item.agi_plus.to_s, 2)
      self.contents.draw_text(195, 160, 50, 32, item.int_plus.to_s, 2)
      self.contents.font.size = 14
      for i in 0...item.plus_state_set.size
        x = 275 + i % 2 * 75
        y = 80 + i / 2 * 14
        self.contents.draw_text(x, y, 120, 32, $data_states[item.plus_state_set[i]].name)
      end
    else
      self.contents.draw_text(90, 64, 75, 32, item.pdef.to_s)
      self.contents.draw_text(90, 96, 75, 32, item.mdef.to_s)
      self.contents.draw_text(60, 128, 75, 32, item.eva.to_s)
      if $data_states[item.auto_state_id] != nil
        self.contents.draw_text(55, 160, 110, 32, $data_states[item.auto_state_id].name)
      end
      self.contents.draw_text(195, 64, 50, 32, item.str_plus.to_s, 2)
      self.contents.draw_text(195, 96, 50, 32, item.dex_plus.to_s, 2)
      self.contents.draw_text(195, 128, 50, 32, item.agi_plus.to_s, 2)
      self.contents.draw_text(195, 160, 50, 32, item.int_plus.to_s, 2)
      self.contents.font.size = 14
    end
    self.contents.font.size = 22
  end
end
#===============================================================================
#  END Window_Shop_Description_Equipment
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Actors
#===============================================================================
class Window_Shop_Actors < Window_Base
  def initialize
    super(84, 32, 472, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.active = false
    self.z += 100
    item = nil
    refresh(item)
  end
  
  def refresh(item)
    self.contents.clear
    if item == nil
      return
    end
    for i in 0...$game_party.actors.size
      x = i%2 * 236
      y = i/2 * 192
      self.contents.font.name = "Georgia"
      draw_actor_name($game_party.actors[i], x + 48, y + 8)
      pdef1 = item.pdef
      mdef1 = item.mdef
      str1 = item.str_plus
      dex1 = item.dex_plus
      agi1 = item.agi_plus
      int1 = item.int_plus
      atk2 = 0
      eva2 = 0
      pdef2 = 0
      mdef2 = 0
      str2 = 0
      dex2 = 0
      agi2 = 0
      int2 = 0
      if item.is_a?(RPG::Weapon)
        if $data_weapons[$game_party.actors[i].weapon_id] != nil
          atk1 = item.atk
          atk2 = $data_weapons[$game_party.actors[i].weapon_id].atk
          pdef2 = $data_weapons[$game_party.actors[i].weapon_id].pdef
          mdef2 = $data_weapons[$game_party.actors[i].weapon_id].mdef
          str2 = $data_weapons[$game_party.actors[i].weapon_id].str_plus
          dex2 = $data_weapons[$game_party.actors[i].weapon_id].dex_plus
          agi2 = $data_weapons[$game_party.actors[i].weapon_id].agi_plus
          int2 = $data_weapons[$game_party.actors[i].weapon_id].int_plus
        end
      else
        eva1 = item.eva
        case item.kind
        when 0
        if $data_armors[$game_party.actors[i].armor1_id] != nil
          eva2 = $data_armors[$game_party.actors[i].armor1_id].eva
          pdef2 = $data_armors[$game_party.actors[i].armor1_id].pdef
          mdef2 = $data_armors[$game_party.actors[i].armor1_id].mdef
          str2 = $data_armors[$game_party.actors[i].armor1_id].str_plus
          dex2 = $data_armors[$game_party.actors[i].armor1_id].dex_plus
          agi2 = $data_armors[$game_party.actors[i].armor1_id].agi_plus
          int2 = $data_armors[$game_party.actors[i].armor1_id].int_plus
        end
        when 1
        if $data_armors[$game_party.actors[i].armor2_id] != nil
          eva2 = $data_armors[$game_party.actors[i].armor2_id].eva
          pdef2 = $data_armors[$game_party.actors[i].armor2_id].pdef
          mdef2 = $data_armors[$game_party.actors[i].armor2_id].mdef
          str2 = $data_armors[$game_party.actors[i].armor2_id].str_plus
          dex2 = $data_armors[$game_party.actors[i].armor2_id].dex_plus
          agi2 = $data_armors[$game_party.actors[i].armor2_id].agi_plus
          int2 = $data_armors[$game_party.actors[i].armor2_id].int_plus
        end
        when 2
        if $data_armors[$game_party.actors[i].armor3_id] != nil
          eva2 = $data_armors[$game_party.actors[i].armor3_id].eva
          pdef2 = $data_armors[$game_party.actors[i].armor3_id].pdef
          mdef2 = $data_armors[$game_party.actors[i].armor3_id].mdef
          str2 = $data_armors[$game_party.actors[i].armor3_id].str_plus
          dex2 = $data_armors[$game_party.actors[i].armor3_id].dex_plus
          agi2 = $data_armors[$game_party.actors[i].armor3_id].agi_plus
          int2 = $data_armors[$game_party.actors[i].armor3_id].int_plus
        end
        when 3
        if $data_armors[$game_party.actors[i].armor4_id] != nil
          eva2 = $data_armors[$game_party.actors[i].armor4_id].eva
          pdef2 = $data_armors[$game_party.actors[i].armor4_id].pdef
          mdef2 = $data_armors[$game_party.actors[i].armor4_id].mdef
          str2 = $data_armors[$game_party.actors[i].armor4_id].str_plus
          dex2 = $data_armors[$game_party.actors[i].armor4_id].dex_plus
          agi2 = $data_armors[$game_party.actors[i].armor4_id].agi_plus
          int2 = $data_armors[$game_party.actors[i].armor4_id].int_plus
        end
        end
      end
      color1 = Color.new(25, 210, 25, 255)
      color2 = Color.new(210, 25, 25, 255)
      if $game_party.actors[i].equippable?(item)
        self.contents.font.color = normal_color
        # PDEF
        if (pdef1 - pdef2) > 0
        self.contents.font.color = color1
        elsif (pdef1 - pdef2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 25, y + 80, 70, 32, (pdef1 - pdef2).to_s, 2)
        # MDEF
        if (mdef1 - mdef2) > 0
          self.contents.font.color = color1
        elsif (mdef1 - mdef2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 25, y + 112, 70, 32, (mdef1 - mdef2).to_s, 2)
        # STR
        if (str1 - str2) > 0
          self.contents.font.color = color1
        elsif (str1 - str2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 125, y + 48, 70, 32, (str1 - str2).to_s, 2)
        # DEX
        if (dex1 - dex2) > 0
          self.contents.font.color = color1
        elsif (dex1 - dex2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 125, y + 80, 70, 32, (dex1 - dex2).to_s, 2)
        # AGI
        if (agi1 - agi2) > 0
          self.contents.font.color = color1
        elsif (agi1 - agi2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 125, y + 112, 70, 32, (agi1 - agi2).to_s, 2)
        # INT
        if (int1 - int2) > 0
          self.contents.font.color = color1
        elsif (int1 - int2) < 0
          self.contents.font.color = color2
        else
          self.contents.font.color = normal_color
        end
        self.contents.draw_text(x + 125, y + 144, 70, 32, (int1 - int2).to_s, 2)
        if item.is_a?(RPG::Weapon)
          self.contents.font.color = system_color
          self.contents.draw_text(x, y + 48, 80, 32, "Atq")
          self.contents.draw_text(x, y + 80, 80, 32, "Déf Phys")
          self.contents.draw_text(x, y + 112, 80, 32, "Déf Mag")
          self.contents.draw_text(x + 110, y + 48, 80, 32, "For")
          self.contents.draw_text(x + 110, y + 80, 80, 32, "Cha")
          self.contents.draw_text(x + 110, y + 112, 80, 32, "Agi")
          self.contents.draw_text(x + 110, y + 144, 80, 32, "Mag")
          self.contents.font.color = normal_color
          #  ATTACK
          if (atk1 - atk2) > 0
            self.contents.font.color = color1
          elsif (atk1 - atk2) < 0
            self.contents.font.color = color2
          else
            self.contents.font.color = normal_color
          end
          self.contents.draw_text(x + 25, y + 48, 70, 32, (atk1 - atk2).to_s, 2)
          #  ELSE if armor...
        else
          self.contents.font.color = system_color
          self.contents.draw_text(x, y + 48, 80, 32, "Esq")
          self.contents.draw_text(x, y + 80, 80, 32, "Déf Phys")
          self.contents.draw_text(x, y + 112, 80, 32, "Déf Mag")
          self.contents.draw_text(x + 110, y + 48, 80, 32, "For")
          self.contents.draw_text(x + 110, y + 80, 80, 32, "Cha")
          self.contents.draw_text(x + 110, y + 112, 80, 32, "Agi")
          self.contents.draw_text(x + 110, y + 144, 80, 32, "Mag")
          self.contents.font.color = normal_color
          if (eva1 - eva2) > 0
            self.contents.font.color = color1
          elsif (eva1 - eva2) < 0
            self.contents.font.color = color2
          else
            self.contents.font.color = normal_color
          end
          self.contents.draw_text(x + 25, y + 48, 70, 32, (eva1 - eva2).to_s, 2)
        end
      else
        self.contents.font.color = disabled_color
        self.contents.draw_text(x + 10, y + 80, 120, 32, "Ne peut être équipé(e)")
        self.contents.font.color = normal_color
      end
    end
  end
end
#===============================================================================
#  END Window_Shop_Actors
#===============================================================================
 
 
#===============================================================================
#  Window_Shop_Amount
#===============================================================================
class Window_Shop_Amount < Window_Selectable
  
  attr_accessor :amount
  
  def initialize
    super(80, 208, 480, 96)
    @item_max = 1
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z += 100
    @amount = 1
    item = $data_items[1]
    option_index = 0
    refresh(item, option_index)
  end
  
  def refresh(item, option_index)
    self.contents.clear
    if item == nil
      return
    end
    if option_index == nil
      return
    end
    if option_index == 0
      self.contents.font.name = "Georgia"
      self.contents.font.color = system_color
      self.contents.draw_text(0, 0, 200, 32, "Combien?")
      self.contents.font.color = normal_color
      if $game_party.gold < (@amount * item.price)
        self.contents.font.color = disabled_color
      end
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(0, 36, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(28, 32, 200, 32, item.name) # 120 et non 200
      self.contents.draw_text(335, 32, 10, 32, "x")
      self.contents.draw_text(280, 32, 30, 32, @amount.to_s, 2)
      self.cursor_rect.set(284, 32, 32, 32)
      self.contents.draw_text(370, 32, 70, 32, (@amount * item.price).to_s, 2)
    else
      self.contents.font.color = system_color
      self.contents.draw_text(0, 0, 200, 32, "Combien?")
      self.contents.font.color = normal_color
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(0, 36, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(28, 32, 200, 32, item.name) # 120 et non 200
      self.contents.draw_text(335, 32, 10, 32, "x")
      self.contents.draw_text(280, 32, 30, 32, @amount.to_s, 2)
      self.cursor_rect.set(284, 32, 32, 32)
      self.contents.draw_text(370, 32, 70, 32, (@amount * (item.price / 4)).to_s, 2) #
    end
  end
end
#===============================================================================
#  END Window_Shop_Amount
#===============================================================================
 
 
#===============================================================================
#  Scene_Shop
#===============================================================================
class Scene_Shop
  def main
    @counter = 0
    @info_window = Window_Shop_Info.new
    @option_window = Window_Shop_Option.new
    @gold_window = Window_Shop_Gold.new
    @own_window = Window_Shop_Own.new
    @list_window = Window_Shop_List.new($game_temp.shop_goods)
    @desc_item_window = Window_Shop_Description_Item.new
    @desc_equip_window = Window_Shop_Description_Equipment.new
    @actor_window = Window_Shop_Actors.new
    @amount_window = Window_Shop_Amount.new
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    
    @info_window.dispose
    @option_window.dispose
    @gold_window.dispose
    @own_window.dispose
    @list_window.dispose
    @desc_item_window.dispose
    @desc_equip_window.dispose
    @actor_window.dispose
    @amount_window.dispose
  end
  
  def update
    @info_window.update
    @option_window.update
    @gold_window.update
    @own_window.update
    @list_window.update
    @desc_item_window.update
    @desc_equip_window.update
    @actor_window.update
    @amount_window.update
    
    if @option_window.active
      update_option
      return
    end
    
    if @list_window.active
      update_list
      return
    end
    
    if @actor_window.visible
      update_actors
      return
    end
    
    if @amount_window.active and @option_window.index == 0
      update_amount
      return
    end
    
    if @amount_window.active and @option_window.index == 1
      update_sell
      return
    end
  end
  
  def update_option
    @info_window.refresh(0)
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @option_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @list_window.refresh
        @option_window.active = false
        @list_window.visible = true
        @list_window.active = true
        @list_window.index = 0
      when 1
        $game_system.se_play($data_system.decision_se)
        @list_window.refresh_sell(@option_window.index)
        @option_window.active = false
        @list_window.visible = true
        @list_window.active = true
        @list_window.index = 0
      when 2
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
    end
  end
  
  def update_list
    @info_window.refresh(1)
    @item = @list_window.item
    if @counter != 1
      if @item.is_a?(RPG::Item)
        @desc_item_window.refresh(@item)
        @counter = 1
      else
        @desc_equip_window.refresh(@item)
        @counter = 1
      end
    end
    @own_window.refresh(@list_window.item)
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      @counter = 0
    end
    if @item.is_a?(RPG::Item)
      if @counter != 1
        @desc_item_window.refresh(@item)
        @counter = 1
      end
      @desc_item_window.visible = true
      @desc_equip_window.visible = false
    else
      if @counter != 1
        @desc_equip_window.refresh(@item)
        @counter = 1
      end
      @desc_item_window.visible = false
      @desc_equip_window.visible = true
    end
    if Input.trigger?(Input::B)
      @counter = 0
      $game_system.se_play($data_system.cancel_se)
      @desc_item_window.visible = false
      @desc_equip_window.visible = false
      @desc_item_window.refresh(nil)
      @desc_equip_window.refresh(nil)
      @option_window.active = true
      @list_window.visible = false
      @list_window.active = false
      @own_window.refresh(nil)
      return
    end
    if Input.trigger?(Input::A)
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.decision_se)
        @actor_window.refresh(@item)
        @actor_window.visible = true
        @list_window.active = false
        return
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
    if Input.trigger?(Input::C)
      if @item == nil or @item.id == 0 or @item.price == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @option_window.index == 0
        case @item
        when RPG::Item
          if $game_party.item_number(@item.id) >= 99
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        when RPG::Weapon
         if $game_party.weapon_number(@item.id) >= 99
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        when RPG::Armor
          if $game_party.armor_number(@item.id) >= 99
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        end
      end
      $game_system.se_play($data_system.decision_se)
      @amount_window.visible = true
      @amount_window.active = true
      @list_window.active = false
      return
    end
  end
  
  def update_actors
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @actor_window.visible = false
      @list_window.active = true
    end
  end
  
  def update_amount
    @amount_window.refresh(@item, @option_window.index)
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @amount_window.amount = 1
      @amount_window.visible = false
      @amount_window.active = false
      @list_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.gold >= (@amount_window.amount * @item.price)
        $game_system.se_play($data_system.decision_se)
        $game_party.lose_gold(@amount_window.amount * @item.price)
        case @item
        when RPG::Item
          $game_party.gain_item(@item.id, @amount_window.amount)
        when RPG::Weapon
          $game_party.gain_weapon(@item.id, @amount_window.amount)
        when RPG::Armor
          $game_party.gain_armor(@item.id, @amount_window.amount)
        end
        @gold_window.refresh
        @amount_window.amount = 1
        @amount_window.visible = false
        @amount_window.active = false
        @list_window.active = true
        @list_window.refresh
        return
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
    if Input.trigger?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount -= 1
      if @amount_window.amount == 0
        @amount_window.amount = 1
      end
      return
    end
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount += 1
      case @item
      when RPG::Item
        if ($game_party.item_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.item_number(@item.id))
        end
      when RPG::Weapon
        if ($game_party.weapon_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.weapon_number(@item.id))
        end
      when RPG::Armor
        if ($game_party.armor_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.armor_number(@item.id))
        end
      end
      return
    end
    if Input.trigger?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount += 10
      case @item
      when RPG::Item
        if ($game_party.item_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.item_number(@item.id))
        end
      when RPG::Weapon
        if ($game_party.weapon_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.weapon_number(@item.id))
        end
      when RPG::Armor
        if ($game_party.armor_number(@item.id) + @amount_window.amount) > 99
          @amount_window.amount = (99 - $game_party.armor_number(@item.id))
        end
      end
      return
    end
    if Input.trigger?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount -= 10
      if @amount_window.amount < 1
        @amount_window.amount = 1
      end
      return
    end
  end
  
  def update_sell
    @amount_window.refresh(@item, @option_window.index)
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @amount_window.amount = 1
      @amount_window.visible = false
      @amount_window.active = false
      @list_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      if @item.price == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      case @item
      when RPG::Item
        $game_party.gain_gold(@amount_window.amount * (@item.price / 4)) #
        $game_party.lose_item(@item.id, @amount_window.amount)
      when RPG::Weapon
        $game_party.gain_gold(@amount_window.amount * (@item.price / 4)) #
        $game_party.lose_weapon(@item.id, @amount_window.amount)
      when RPG::Armor
        $game_party.gain_gold(@amount_window.amount * (@item.price / 4)) #
        $game_party.lose_armor(@item.id, @amount_window.amount)
      end
      @gold_window.refresh
      @amount_window.amount = 1
      @amount_window.visible = false
      @amount_window.active = false
      @list_window.active = true
      @list_window.refresh_sell(@option_window.index)
      @desc_equip_window.refresh(nil)
      @desc_item_window.refresh(nil)
    end
    if Input.trigger?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount -= 1
      if @amount_window.amount < 1
        @amount_window.amount = 1
      end
    end
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      case @item
      when RPG::Item
        @amount_window.amount += 1
        if @amount_window.amount > $game_party.item_number(@item.id)
          @amount_window.amount = $game_party.item_number(@item.id)
        end
      when RPG::Weapon
        @amount_window.amount += 1
        if @amount_window.amount > $game_party.weapon_number(@item.id)
          @amount_window.amount = $game_party.weapon_number(@item.id)
        end
      when RPG::Armor
        @amount_window.amount += 1
        if @amount_window.amount > $game_party.armor_number(@item.id)
          @amount_window.amount = $game_party.armor_number(@item.id)
        end
      end
    end
    if Input.trigger?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      case @item
      when RPG::Item
        @amount_window.amount += 10
        if @amount_window.amount > $game_party.item_number(@item.id)
          @amount_window.amount = $game_party.item_number(@item.id)
        end
      when RPG::Weapon
        @amount_window.amount += 10
        if @amount_window.amount > $game_party.weapon_number(@item.id)
          @amount_window.amount = $game_party.weapon_number(@item.id)
        end
      when RPG::Armor
        @amount_window.amount += 10
        if @amount_window.amount > $game_party.armor_number(@item.id)
          @amount_window.amount = $game_party.armor_number(@item.id)
        end
      end
    end
    if Input.trigger?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @amount_window.amount -= 10
      if @amount_window.amount < 1
        @amount_window.amount = 1
      end
    end
  end
  
end





Merci d'avance à quiconque m'aidera régler ce problème qui fait tâche dans mon projet !


arttroy - posté le 10/09/2015 à 13:41:47 (2394 messages postés)

❤ 0

Just working

Ligne 188 tu as ça :

Portion de code : Tout sélectionner

1
2
3
4
5
    for i in 1... $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end



changes par :

Portion de code : Tout sélectionner

1
2
3
4
5
    for i in 1..500 $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end



Pour tes intervalles suffit de dupliquer cette partie et tu changes pour ton exemple 15 à 20 et 100 à 150 n'apparaissent pas :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    for i in 1..14 $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    for i in 21..99 $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    for i in 151..500 $data_items.size ###################
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end



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


Wingan - posté le 10/09/2015 à 14:05:56 (10 messages postés)

❤ 0

Merci beaucoup pour ta réponse. Hélas, que ce soit dans mon projet avec ce script ou dans un vierge avec le script Window_ShopSell de base, dès que je lance le jeu il est dit qu'il y a une "SyntaxError" à la ligne où je fais la petite modification. J'ai pourtant bien retiré le 3ème point juste avant de mettre le 500. Tu aurais une idée ?

Edition !

Aaaaah, mystère résolu ! Il fallait ajouter un retour à la ligne. Le code doit donner ceci pour que ça marche :

Portion de code : Tout sélectionner

1
2
3
4
5
6
    for i in 1..500 
       $data_items.size 
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end



Affaire classée, mille mercis !


arttroy - posté le 10/09/2015 à 16:56:08 (2394 messages postés)

❤ 0

Just working

Erf oui désolé j'avais pas fait attention ^^.

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

Index du forum > Entraide > [RPGM XP - RESOLU] Ne pas afficher certains objets (menu vente)

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