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: Star Trek: Glorious Wolf - (...) / Sorties: Dread Mac Farlane - episode 3 / News: Plein d'images cools créées par (...) / Sorties: Star Trek: Glorious Wolf - (...) / Jeux: Final Fantasy 2.0 / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

327 connectés actuellement

29185317 visiteurs
depuis l'ouverture

5582 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Alex d'Or

Le Temple de Valor

Planète Glutko

Offgame

Lumen

Tous nos partenaires

Devenir
partenaire



KMS_MiniMap

Affiche une mini map sur la carte, avec pas mal d'options à configurer.

Script pour RPG Maker VX Ace
Ecrit par Kameo (site de l'auteur)
Publié par Kingdo (lui envoyer un message privé)
Signaler un script cassé

❤ 0

Auteur : Kamesoft (KGC)
Logiciel : RPG Maker VX Ace
Nombre de scripts : 1
Source : http://ytomy.sakura.ne.jp/tkool/rpgtech/php/tech.php?tool=VXAce&cat=tech_vxace/map&tech=minimap

Bonjour,
Je n'ai pas réalisé ce script, je l'ai trouvé et j'ai ajouté des explications car ceux-ci sont en japonais.
Néanmoins j'ai trouvé ce script très abouti et j'ai pensé à en faire profiter les autres. image

Je tiens à préciser que j'ai effectué quelques changements pour une utilisation plus simple (à mon avis), mais la ligne de code d'origine est notée en commentaire juste à côté. Cela dit, les modifications sont minimes (les mots-clés à utiliser).

Installation
A placer au-dessus de Main.

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
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ ミニマップ - KMS_MiniMap ◆ VX Ace ◆
#_/    ◇ Last update : 2012/02/12  (TOMY@Kamesoft) ◇
#_/----------------------------------------------------------------------------
#_/  ミニマップ表示機能を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
#==============================================================================
# ★ 設定項目 - BEGIN Setting ★
#==============================================================================
 
module KMS_MiniMap
  # ◆ ミニマップ表示切替ボタン
  #  nil にするとボタン切り替え無効。
  SWITCH_BUTTON = :Z #c'est le boutton D
 
  # ◆ ミニマップ表示位置・サイズ (X, Y, 幅, 高さ) Position de la minicarte dans le jeu
  MAP_RECT = Rect.new(364, 20, 160, 120)
  # ◆ ミニマップの Z 座標
  #  大きくしすぎると色々なものに被ります。
  MAP_Z = 0
  # ◆ 1マスのサイズ
  #  3 以上を推奨。
  GRID_SIZE = 5
 
  # ◆ ミニマップカラー
  FOREGROUND_COLOR = Color.new(224, 224, 255, 160)  # 前景色 (通行可)
  BACKGROUND_COLOR = Color.new(  0,   0,   0, 160)  # 背景色 (通行不可)
  POSITION_COLOR   = Color.new(255,   0,   0, 192)  # 現在位置 joueur
  MOVE_EVENT_COLOR = Color.new(255, 160,   0, 100)  # マップ移動イベント tout les events
  VEHICLE_COLOR    = Color.new( 96, 128,   0, 192)  # 乗り物 
 
  # ◆ オブジェクトの色 (Red, Green, Blue, Opacity)
  #  要素の先頭から順に OBJ1, OBJ2, ... に対応。
  OBJECT_COLOR = [
    Color.new(255,   0,   0, 192),  # OBJ 1 -> Ennemi (rouge)
    Color.new(  0, 160, 160, 192),  # OBJ 2 -> membre du groupe (cyan)
    Color.new(160,   0, 160, 192),  # OBJ 3 -> marchand (violet)
    Color.new(204, 204,   0, 192),  # OBJ 4 -> item, tresors (jaune)
    Color.new(255, 255, 255, 192),  # OBJ 5 -> (bleu marine)
    Color.new(  0, 128,   0, 192),  # OBJ 6 -> PNJ (vert)
  ]  # ← この ] は消さないこと!Ne pas toucher cette ligne
 
  # ◆ アイコンの点滅の強さ lumière clignotante
  #  5 ~ 8 あたりを推奨。 a definir entre 5 et 8.
  BLINK_LEVEL = 7
 
  # ◆ マップのキャッシュ数
  #  この数を超えると、長期間参照していないものから削除。
  CACHE_NUM = 10
end
 
#==============================================================================
# ☆ 設定ここまで - END Setting ☆
#==============================================================================
 
$kms_imported = {} if $kms_imported == nil
$kms_imported["MiniMap"] = true
 
module KMS_MiniMap
  # ミニマップ非表示 hoter la mini map 
  # il faut mettre dans la "note" de la map : <cacherminicarte>
  REGEX_NO_MINIMAP_NOTE = /<cacherminicarte>/i   # /<(?:cacher|MINIMAP)\s*(?:minicarte|HIDE)>/i -> c'est celui d'origine
  REGEX_NO_MINIMAP_NAME = /\[NOMAP\]/i
 
  
  # 障害物 L'event va apparaitre sur la carte comme une partie inccessible.
  # il faut mettre en "commentaire" dans l'event : <obstacle>
  REGEX_WALL_EVENT =   /<obstacle>/i   # /<(?:ミニマップ|MINIMAP)\s*(?:壁|障害物|WALL)>/i -> c'est celui d'origine
 
  # 移動イベント Pour voir les Events qui n'ont pas d'utilité fixe.
  # il faut mettre en "commentaire" dans l'event : <envent>
  REGEX_MOVE_EVENT =  /<envent>/i  #/<(?:ミニマップ|MINIMAP)\s*(?:移動|MOVE)>/i -> c'est celui d'origine
 
  # オブジェクト Donne une couleurs particulière aux évent. A définir à la ligne 36->41:
  #Possibilité d'en rajouter à volonté. Utile pour donner une couleur aux events un peu plus important.
  # il faut mettre en "commentaire" dans l'event : <objet objN> -> exemple <objet obj1>
  REGEX_OBJECT = /<(?:objet|MINIMAP)\s+OBJ(?:ECT)?\s*(\d+)>/i
end
 
# *****************************************************************************
 
#==============================================================================
# □ KMS_Commands
#==============================================================================
 
module KMS_Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ ミニマップを表示 J'affiche une mini-carte
  #--------------------------------------------------------------------------
  def show_minimap
    $game_temp.minimap_manual_visible = true
    $game_system.minimap_show         = true
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップを隠す Je cache une mini-carte
  #--------------------------------------------------------------------------
  def hide_minimap
    $game_system.minimap_show = false
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ表示状態の取得 
  #--------------------------------------------------------------------------
  def minimap_showing?
    return $game_system.minimap_show
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップをリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_minimap
    return unless SceneManager.scene_is?(Scene_Map)
 
    $game_map.refresh if $game_map.need_refresh
    SceneManager.scene.refresh_minimap
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップのオブジェクトを更新
  #--------------------------------------------------------------------------
  def update_minimap_object
    return unless SceneManager.scene_is?(Scene_Map)
 
    $game_map.refresh if $game_map.need_refresh
    SceneManager.scene.update_minimap_object
  end
end
 
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
 
class Game_Interpreter
  # イベントコマンドから直接コマンドを叩けるようにする
  include KMS_Commands
end
 
#==============================================================================
# ■ RPG::Map
#==============================================================================
 
class RPG::Map
  #--------------------------------------------------------------------------
  # ○ ミニマップのキャッシュ生成
  #--------------------------------------------------------------------------
  def create_minimap_cache
    @__minimap_show = true
 
    note.each_line { |line|
      if line =~ KMS_MiniMap::REGEX_NO_MINIMAP_NOTE  # マップ非表示
        @__minimap_show = false
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ表示
  #--------------------------------------------------------------------------
  def minimap_show?
    create_minimap_cache if @__minimap_show.nil?
    return @__minimap_show
  end
end
 
#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
 
class RPG::MapInfo
  #--------------------------------------------------------------------------
  # ● マップ名取得
  #--------------------------------------------------------------------------
  def name
    return @name.gsub(/\[.*\]/) { "" }
  end
  #--------------------------------------------------------------------------
  # ○ オリジナルマップ名取得
  #--------------------------------------------------------------------------
  def original_name
    return @name
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップのキャッシュ生成
  #--------------------------------------------------------------------------
  def create_minimap_cache
    @__minimap_show = !(@name =~ KMS_MiniMap::REGEX_NO_MINIMAP_NAME)
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ表示
  #--------------------------------------------------------------------------
  def minimap_show?
    create_minimap_cache if @__minimap_show == nil
    return @__minimap_show
  end
end
 
#==============================================================================
# ■ Game_Temp
#==============================================================================
 
class Game_Temp
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :minimap_manual_visible  # ミニマップ手動表示切り替えフラグ
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KMS_MiniMap initialize
  def initialize
    initialize_KMS_MiniMap
 
    @minimap_manual_visible = true
  end
end
 
#==============================================================================
# ■ Game_System
#==============================================================================
 
class Game_System
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :minimap_show  # ミニマップ表示フラグ
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KMS_MiniMap initialize
  def initialize
    initialize_KMS_MiniMap
 
    @minimap_show = true
  end
end
 
#==============================================================================
# ■ Game_Map
#==============================================================================
 
class Game_Map
  #--------------------------------------------------------------------------
  # ○ 定数 le nombre fixe
  #--------------------------------------------------------------------------
  MINIMAP_FADE_NONE = 0  # ミニマップ フェードなし Il n'y a aucune disparition de la carte
  MINIMAP_FADE_IN   = 1  # ミニマップ フェードイン Mini-carte s'efface in
  MINIMAP_FADE_OUT  = 2  # ミニマップ フェードアウト Mini-carte s'efface out
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :minimap_fade
  #--------------------------------------------------------------------------
  # ○ ミニマップを表示するか
  #--------------------------------------------------------------------------
  def minimap_show?
    return $data_mapinfos[map_id].minimap_show? && @map.minimap_show?
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップをフェードイン
  #--------------------------------------------------------------------------
  def fadein_minimap
    @minimap_fade = MINIMAP_FADE_IN
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップをフェードアウト
  #--------------------------------------------------------------------------
  def fadeout_minimap
    @minimap_fade = MINIMAP_FADE_OUT
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KMS_MiniMap refresh
  def refresh
    refresh_KMS_MiniMap
 
    SceneManager.scene.refresh_minimap if SceneManager.scene_is?(Scene_Map)
  end
end
 
#==============================================================================
# ■ Game_Event
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # ○ ミニマップ用のキャッシュを作成
  #--------------------------------------------------------------------------
  def __create_minimap_cache
    @__last_page = @page
    @__minimap_wall_event  = false
    @__minimap_move_event  = false # Rend visible ou invisible la totalité des évents .Atention, les évent innactif et ceux servant aux scénario apparaisse aussi
    @__minimap_object_type = -1
 
    return if @page.nil?
 
    @page.list.each { |cmd|
      # 注釈以外に到達したら離脱
      break unless [108, 408].include?(cmd.code)
 
      # 正規表現判定
      case cmd.parameters[0]
      when KMS_MiniMap::REGEX_WALL_EVENT
        @__minimap_wall_event = true
      when KMS_MiniMap::REGEX_MOVE_EVENT
        @__minimap_move_event = true
      when KMS_MiniMap::REGEX_OBJECT
        @__minimap_object_type = $1.to_i
      end
    }
  end
  private :__create_minimap_cache
  #--------------------------------------------------------------------------
  # ○ グラフィックがあるか
  #--------------------------------------------------------------------------
  def graphic_exist?
    return (character_name != "" || tile_id > 0)
  end
  #--------------------------------------------------------------------------
  # ○ 障害物か
  #--------------------------------------------------------------------------
  def is_minimap_wall_event?
    if @__minimap_wall_event.nil? || @__last_page != @page
      __create_minimap_cache
    end
 
    return @__minimap_wall_event
  end
  #--------------------------------------------------------------------------
  # ○ 移動イベントか
  #--------------------------------------------------------------------------
  def is_minimap_move_event?
    if @__minimap_move_event.nil? || @__last_page != @page
      __create_minimap_cache
    end
 
    return @__minimap_move_event
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップオブジェクトか
  #--------------------------------------------------------------------------
  def is_minimap_object?
    if @__minimap_object_type.nil? || @__last_page != @page
      __create_minimap_cache
    end
 
    return @__minimap_object_type > 0
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップオブジェクトタイプ
  #--------------------------------------------------------------------------
  def minimap_object_type
    if @__minimap_object_type.nil? || @__last_page != @page
      __create_minimap_cache
    end
 
    return @__minimap_object_type
  end
end
 
#==============================================================================
# □ Game_MiniMap
#------------------------------------------------------------------------------
#   ミニマップを扱うクラスです。
#==============================================================================
 
class Game_MiniMap
  #--------------------------------------------------------------------------
  # ○ 構造体
  #--------------------------------------------------------------------------
  Point = Struct.new(:x, :y)
  Size  = Struct.new(:width, :height)
  PassageCache = Struct.new(:map_id, :table, :scan_table)
  #--------------------------------------------------------------------------
  # ○ クラス変数
  #--------------------------------------------------------------------------
  @@passage_cache = []  # 通行フラグテーブルキャッシュ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(tilemap)
    @map_rect  = KMS_MiniMap::MAP_RECT
    @grid_size = [KMS_MiniMap::GRID_SIZE, 1].max
 
    @x = 0
    @y = 0
    @grid_num = Point.new(
      (@map_rect.width  + @grid_size - 1) / @grid_size,
      (@map_rect.height + @grid_size - 1) / @grid_size
    )
    @draw_grid_num    = Point.new(@grid_num.x + 2, @grid_num.y + 2)
    @draw_range_begin = Point.new(0, 0)
    @draw_range_end   = Point.new(0, 0)
    @tilemap = tilemap
 
    @last_x = $game_player.x
    @last_y = $game_player.y
 
    @showing = false
    @hiding  = false
 
    create_sprites
    refresh
 
    unless $game_temp.minimap_manual_visible
      self.opacity = 0
    end
  end
  #--------------------------------------------------------------------------
  # ○ スプライト作成
  #--------------------------------------------------------------------------
  def create_sprites
    @viewport   = Viewport.new(@map_rect)
    @viewport.z = KMS_MiniMap::MAP_Z
 
    # ビットマップサイズ計算
    @bmp_size = Size.new(
      (@grid_num.x + 2) * @grid_size,
      (@grid_num.y + 2) * @grid_size
    )
    @buf_bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)
 
    # マップ用スプライト作成
    @map_sprite   = Sprite.new(@viewport)
    @map_sprite.x = -@grid_size
    @map_sprite.y = -@grid_size
    @map_sprite.z = 0
    @map_sprite.bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)
 
    # オブジェクト用スプライト作成
    @object_sprite   = Sprite_MiniMapIcon.new(@viewport)
    @object_sprite.x = -@grid_size
    @object_sprite.y = -@grid_size
    @object_sprite.z = 1
    @object_sprite.bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)
 
    # 現在位置スプライト作成
    @position_sprite   = Sprite_MiniMapIcon.new
    @position_sprite.x = @map_rect.x + @grid_num.x / 2 * @grid_size
    @position_sprite.y = @map_rect.y + @grid_num.y / 2 * @grid_size
    @position_sprite.z = @viewport.z + 2
    bitmap = Bitmap.new(@grid_size, @grid_size)
    bitmap.fill_rect(bitmap.rect, KMS_MiniMap::POSITION_COLOR)
    @position_sprite.bitmap = bitmap
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @buf_bitmap.dispose
    @map_sprite.bitmap.dispose
    @map_sprite.dispose
    @object_sprite.bitmap.dispose
    @object_sprite.dispose
    @position_sprite.bitmap.dispose
    @position_sprite.dispose
    @viewport.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 可視状態取得
  #--------------------------------------------------------------------------
  def visible
    return @map_sprite.visible
  end
  #--------------------------------------------------------------------------
  # ○ 可視状態設定
  #--------------------------------------------------------------------------
  def visible=(value)
    @viewport.visible        = value
    @map_sprite.visible      = value
    @object_sprite.visible   = value
    @position_sprite.visible = value
  end
  #--------------------------------------------------------------------------
  # ○ 不透明度取得
  #--------------------------------------------------------------------------
  def opacity
    return @map_sprite.opacity
  end
  #--------------------------------------------------------------------------
  # ○ 不透明度設定
  #--------------------------------------------------------------------------
  def opacity=(value)
    @map_sprite.opacity      = value
    @object_sprite.opacity   = value
    @position_sprite.opacity = value
  end
  #--------------------------------------------------------------------------
  # ○ リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    update_draw_range
    update_passage_table
    update_object_list
    update_position
    draw_map
    draw_object
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ○ フェードイン
  #--------------------------------------------------------------------------
  def fadein
    @showing = true
    @hiding  = false
  end
  #--------------------------------------------------------------------------
  # ○ フェードアウト
  #--------------------------------------------------------------------------
  def fadeout
    @showing = false
    @hiding  = true
  end
  #--------------------------------------------------------------------------
  # ○ キー入力更新
  #--------------------------------------------------------------------------
  def update_input
    return if KMS_MiniMap::SWITCH_BUTTON.nil?
 
    if Input.trigger?(KMS_MiniMap::SWITCH_BUTTON)
      if opacity < 255 && !@showing
        $game_temp.minimap_manual_visible = true
        fadein
      elsif opacity > 0 && !@hiding
        $game_temp.minimap_manual_visible = false
        fadeout
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 描画範囲更新
  #--------------------------------------------------------------------------
  def update_draw_range
    range = []
    (2).times { |i| range[i] = @draw_grid_num[i] / 2 }
 
    @draw_range_begin.x = $game_player.x - range[0]
    @draw_range_begin.y = $game_player.y - range[1]
    @draw_range_end.x   = $game_player.x + range[0]
    @draw_range_end.y   = $game_player.y + range[1]
  end
  #--------------------------------------------------------------------------
  # ○ 通行可否テーブル更新
  #--------------------------------------------------------------------------
  def update_passage_table
    cache = get_passage_table_cache
    @passage_table      = cache.table
    @passage_scan_table = cache.scan_table
 
    update_around_passage_table
  end
  #--------------------------------------------------------------------------
  # ○ 通行可否テーブルのキャッシュを取得
  #--------------------------------------------------------------------------
  def get_passage_table_cache
    map_id = $game_map.map_id
    cache  = @@passage_cache.find { |c| c.map_id == map_id }
 
    # キャッシュミスしたら新規作成
    if cache == nil
      cache = PassageCache.new(map_id)
      cache.table      = Table.new($game_map.width, $game_map.height)
      cache.scan_table = Table.new(
        ($game_map.width  + @draw_grid_num.x - 1) / @draw_grid_num.x,
        ($game_map.height + @draw_grid_num.y - 1) / @draw_grid_num.y
      )
    end
 
    # 直近のキャッシュは先頭に移動し、古いキャッシュは削除
    @@passage_cache.unshift(cache)
    @@passage_cache.delete_at(KMS_MiniMap::CACHE_NUM)
 
    return cache
  end
  #--------------------------------------------------------------------------
  # ○ 通行可否テーブルのキャッシュをクリア
  #--------------------------------------------------------------------------
  def clear_passage_table_cache
    return if @passage_scan_table == nil
 
    table = @passage_scan_table
    @passage_scan_table = Table.new(table.xsize, table.ysize)
  end
  #--------------------------------------------------------------------------
  # ○ 通行可否テーブルの探索
  #     x, y : 探索位置
  #--------------------------------------------------------------------------
  def scan_passage(x, y)
    dx = x / @draw_grid_num.x
    dy = y / @draw_grid_num.y
 
    # 探索済み
    return if @passage_scan_table[dx, dy] == 1
 
    # マップ範囲外
    return unless dx.between?(0, @passage_scan_table.xsize - 1)
    return unless dy.between?(0, @passage_scan_table.ysize - 1)
 
    rx = (dx * @draw_grid_num.x)...((dx + 1) * @draw_grid_num.x)
    ry = (dy * @draw_grid_num.y)...((dy + 1) * @draw_grid_num.y)
    mw = $game_map.width  - 1
    mh = $game_map.height - 1
 
    # 探索範囲内の通行テーブルを生成
    rx.each { |x|
      next unless x.between?(0, mw)
      ry.each { |y|
        next unless y.between?(0, mh)
 
        # 通行方向フラグ作成
        # (↓、←、→、↑ の順に 1, 2, 4, 8 が対応)
        flag = 0
        [2, 4, 6, 8].each{ |d|
          flag |= 1 << (d / 2 - 1) if $game_map.passable?(x, y, d)
        }
        @passage_table[x, y] = flag
      }
    }
    @passage_scan_table[dx, dy] = 1
  end
  #--------------------------------------------------------------------------
  # ○ 周辺の通行可否テーブル更新
  #--------------------------------------------------------------------------
  def update_around_passage_table
    gx = @draw_grid_num.x
    gy = @draw_grid_num.y
    dx = $game_player.x - gx / 2
    dy = $game_player.y - gy / 2
    scan_passage(dx,      dy)
    scan_passage(dx + gx, dy)
    scan_passage(dx,      dy + gy)
    scan_passage(dx + gx, dy + gy)
  end
  #--------------------------------------------------------------------------
  # ○ オブジェクト一覧更新
  #--------------------------------------------------------------------------
  def update_object_list
    events = $game_map.events.values
 
    # WALL
    @wall_events = events.find_all { |e| e.is_minimap_wall_event? }
 
    # MOVE
    @move_events = events.find_all { |e| e.is_minimap_move_event? }
 
    # OBJ
    @object_list = events.find_all { |e| e.is_minimap_object? }
  end
  #--------------------------------------------------------------------------
  # ○ 位置更新
  #--------------------------------------------------------------------------
  def update_position
    # 移動量算出
    pt = Point.new($game_player.x, $game_player.y)
    ox = ($game_player.real_x - pt.x) * @grid_size
    oy = ($game_player.real_y - pt.y) * @grid_size
 
    @viewport.ox = ox
    @viewport.oy = oy
 
    # 移動していたらマップ再描画
    if pt.x != @last_x || pt.y != @last_y
      draw_map
      @last_x = pt.x
      @last_y = pt.y
    end
  end
  #--------------------------------------------------------------------------
  # ○ 描画範囲内判定
  #--------------------------------------------------------------------------
  def in_draw_range?(x, y)
    rb = @draw_range_begin
    re = @draw_range_end
    return (x.between?(rb.x, re.x) && y.between?(rb.y, re.y))
  end
  #--------------------------------------------------------------------------
  # ○ マップ範囲内判定
  #--------------------------------------------------------------------------
  def in_map_range?(x, y)
    mw = $game_map.width
    mh = $game_map.height
    return (x.between?(0, mw - 1) && y.between?(0, mh - 1))
  end
  #--------------------------------------------------------------------------
  # ○ マップ描画
  #--------------------------------------------------------------------------
  def draw_map
    update_around_passage_table
 
    bitmap  = @map_sprite.bitmap
    bitmap.fill_rect(bitmap.rect, KMS_MiniMap::BACKGROUND_COLOR)
 
    draw_map_foreground(bitmap)
    draw_map_move_event(bitmap)
  end
  #--------------------------------------------------------------------------
  # ○ 通行可能領域の描画
  #--------------------------------------------------------------------------
  def draw_map_foreground(bitmap)
    range_x = (@draw_range_begin.x)..(@draw_range_end.x)
    range_y = (@draw_range_begin.y)..(@draw_range_end.y)
    map_w   = $game_map.width  - 1
    map_h   = $game_map.height - 1
    rect    = Rect.new(0, 0, @grid_size, @grid_size)
 
    range_x.each { |x|
      next unless x.between?(0, map_w)
      range_y.each { |y|
        next unless y.between?(0, map_h)
        next if @passage_table[x, y] == 0
        next if @wall_events.find { |e| e.x == x && e.y == y }  # 壁
 
        # グリッド描画サイズ算出
        rect.set(0, 0, @grid_size, @grid_size)
        rect.x = (x - @draw_range_begin.x) * @grid_size
        rect.y = (y - @draw_range_begin.y) * @grid_size
        flag = @passage_table[x, y]
        if flag & 0x01 == 0  # 下通行不能
          rect.height -= 1
        end
        if flag & 0x02 == 0  # 左通行不能
          rect.x     += 1
          rect.width -= 1
        end
        if flag & 0x04 == 0  # 右通行不能
          rect.width -= 1
        end
        if flag & 0x08 == 0  # 上通行不能
          rect.y      += 1
          rect.height -= 1
        end
        bitmap.fill_rect(rect, KMS_MiniMap::FOREGROUND_COLOR)
      }
    }
  end
  #--------------------------------------------------------------------------
  # ○ 移動イベントの描画
  #--------------------------------------------------------------------------
  def draw_map_move_event(bitmap)
    rect = Rect.new(0, 0, @grid_size, @grid_size)
    @move_events.each { |e|
      rect.x = (e.x - @draw_range_begin.x) * @grid_size
      rect.y = (e.y - @draw_range_begin.y) * @grid_size
      bitmap.fill_rect(rect, KMS_MiniMap::MOVE_EVENT_COLOR)
    }
  end
  #--------------------------------------------------------------------------
  # ○ アニメーション更新
  #--------------------------------------------------------------------------
  def update_animation
    if @showing
      # フェードイン
      self.opacity += 16
      if opacity == 255
        @showing = false
      end
    elsif @hiding
      # フェードアウト
      self.opacity -= 16
      if opacity == 0
        @hiding = false
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ オブジェクト描画
  #--------------------------------------------------------------------------
  def draw_object
    # 下準備
    bitmap = @object_sprite.bitmap
    bitmap.clear
    rect = Rect.new(0, 0, @grid_size, @grid_size)
 
    # オブジェクト描画
    @object_list.each { |obj|
      next unless in_draw_range?(obj.x, obj.y)
 
      color = KMS_MiniMap::OBJECT_COLOR[obj.minimap_object_type - 1]
      next if color.nil?
 
      rect.x = (obj.real_x - @draw_range_begin.x) * @grid_size
      rect.y = (obj.real_y - @draw_range_begin.y) * @grid_size
      bitmap.fill_rect(rect, color)
    }
 
    # 乗り物描画
    $game_map.vehicles.each { |vehicle|
      next if vehicle.transparent
 
      rect.x = (vehicle.real_x - @draw_range_begin.x) * @grid_size
      rect.y = (vehicle.real_y - @draw_range_begin.y) * @grid_size
      bitmap.fill_rect(rect, KMS_MiniMap::VEHICLE_COLOR)
    }
  end
  #--------------------------------------------------------------------------
  # ○ 更新
  #--------------------------------------------------------------------------
  def update
    update_input
 
    return unless need_update?
 
    update_draw_range
    update_position
    update_animation
    draw_object
 
    @map_sprite.update
    @object_sprite.update
    @position_sprite.update
  end
  #--------------------------------------------------------------------------
  # ○ 更新判定
  #--------------------------------------------------------------------------
  def need_update?
    return (visible && opacity > 0) || @showing || @hiding
  end
end
 
#==============================================================================
# □ Sprite_MiniMapIcon
#------------------------------------------------------------------------------
#   ミニマップ用アイコンのクラスです。
#==============================================================================
 
class Sprite_MiniMapIcon < Sprite
  DURATION_MAX = 60
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     viewport : ビューポート
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    super(viewport)
    @duration = DURATION_MAX / 2
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    @duration += 1
    if @duration == DURATION_MAX
      @duration = 0
    end
    update_effect
  end
  #--------------------------------------------------------------------------
  # ○ エフェクトの更新
  #--------------------------------------------------------------------------
  def update_effect
    self.color.set(255, 255, 255,
      (@duration - DURATION_MAX / 2).abs * KMS_MiniMap::BLINK_LEVEL
    )
  end
end
 
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
 
class Spriteset_Map
  attr_reader :minimap
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KMS_MiniMap initialize
  def initialize
    initialize_KMS_MiniMap
 
    create_minimap
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップの作成
  #--------------------------------------------------------------------------
  def create_minimap
    @minimap = Game_MiniMap.new(@tilemap)
    @minimap.visible = $game_system.minimap_show && $game_map.minimap_show?
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  alias dispose_KMS_MiniMap dispose
  def dispose
    dispose_KMS_MiniMap
 
    dispose_minimap
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップの解放
  #--------------------------------------------------------------------------
  def dispose_minimap
    @minimap.dispose
    @minimap = nil
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KMS_MiniMap update
  def update
    update_KMS_MiniMap
 
    update_minimap
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ更新
  #--------------------------------------------------------------------------
  def minimap_show?
    return $game_map.minimap_show? && $game_system.minimap_show
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ更新
  #--------------------------------------------------------------------------
  def update_minimap
    return if @minimap.nil?
 
    # 表示切替
    if minimap_show?
      @minimap.visible = true
    else
      @minimap.visible = false
      return
    end
 
    # フェード判定
    case $game_map.minimap_fade
    when Game_Map::MINIMAP_FADE_IN
      @minimap.fadein
      $game_map.minimap_fade = Game_Map::MINIMAP_FADE_NONE
    when Game_Map::MINIMAP_FADE_OUT
      @minimap.fadeout
      $game_map.minimap_fade = Game_Map::MINIMAP_FADE_NONE
    end
 
    @minimap.update
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ全体をリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_minimap
    return if @minimap.nil?
 
    @minimap.clear_passage_table_cache
    @minimap.refresh
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップのオブジェクトを更新
  #--------------------------------------------------------------------------
  def update_minimap_object
    @minimap.update_object_list unless @minimap.nil?
  end
end
 
#==============================================================================
# ■ Scene_Map
#==============================================================================
 
class Scene_Map
  #--------------------------------------------------------------------------
  # ● 場所移動後の処理
  #--------------------------------------------------------------------------
  alias post_transfer_KMS_MiniMap post_transfer
  def post_transfer
    refresh_minimap
 
    post_transfer_KMS_MiniMap
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップ全体をリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_minimap
    @spriteset.refresh_minimap unless @spriteset.nil?
  end
  #--------------------------------------------------------------------------
  # ○ ミニマップのオブジェクトを更新
  #--------------------------------------------------------------------------
  def update_minimap_object
    @spriteset.update_minimap_object unless @spriteset.nil?
  end
end



Utilisation
Alors pour l'utilisation,C'est en fait assez simple, la map s'affiche automatiquement dans le jeu.
On peut l'activer ou la désactiver en appuyant sur la touche "D".

MAP_RECT sert à définir la taille et l'emplacement de la minimap.

Si l'on veut que la map ne s'affiche jamais sur une carte, il suffit d'y inclure dans la partie "note".

Pour y insérer un 'obstacle', on écrit en commentaire sur un event.
Cela aura pour effet que la map affichera l'event de la même couleur que les parties non praticables dans le jeu.

Pour montrer un event dit "classique" ont écrit en commentaire.
PS: je dis "classique" car le point apparent sur la map ne clignotera pas.

Ensuite il y a les objets, c'est ce qui est pour moi la petite merveille qu'est ce script.
1- On définit une couleur pour un objet qui aura un numéro.
2- On met en commentaire
Exemple:
PS: Chaque objet clignotera sur la map.

Pour finir les couleurs, on choisit l’intensité de la couleur entre 0 et 255.
-Foreground correspond à la partie praticable
-Background a la partie non praticable.
-Position color, c'est le joueur.
-Move event c'est la couleur de l'évent ()
-Vehicle correspond aux véhicules.

Les chiffres correspondent à cet ordre.
Rouge, vert, bleu et l'opacité.

Ensuite, les OBJECT_COLOR, ici vous définissez la couleur des , vous pouvez en rajouter autant que vous voulez.
J'ai pris la liberté d'assigner les couleurs à un type d'event mais vu qu'il faut les placer au cas par cas, vous pouvez changer comme il vous plaît.

Voilà nous avons fait le tour de mes connaissances sur ce script, j'espère qu'il vous plaira.image


Mis à jour le 11 novembre 2020.






Rizzen - posté le 24/03/2015 à 23:53:02 (1 messages postés)

❤ 0

Bonjour, déja, bravo pour le travail de tout ces scripts ( je tenais a le souligner ) .
J'ai une question, je ne vois pas les PNJ ni les objets sur la mini map... Comment je peut faire pour les voir ?


kingdommangas - posté le 28/03/2015 à 19:01:17 (409 messages postés)

❤ 0

Youtubeur/Scenariste

Bonjour, pour voir les png sur la minimap, il faut ajouter un commentaire tout en haut, après cela dépend du pnj. S'il "fait partie du décor" tu écris event entre crochets.
ex: <event>

Pour les pnj ou les items importants "sauvegarde",'objet de quête", etc. il y a le système de couleur. En commentaire, tu écris objet obj1 1,2, 3 et autant que tu veux en fonction de la couleur attribuée. Ceux-ci clignoteront sur la map.
ex: <obj1>, <obj2>, <obj3>, etc...

C'est tout. Il faut juste mettre en commentaire les mots qui définissent le png que tu veux voir apparaitre. Le commentaire doit être en haut de la page et le texte entre crochet.

Tand que j'y pense, il faut écrire le commentaire sur toutes les pages de l'évènement. Sinon, l'icône disparaît de la map au changement de page. Cela permet de par exemple: prendre un objet-clé et l'icône sur la map n'est plus présente après saisir de l'objet.

Voilà, j'espère avoir pu t'aider.:D

Mes jeux: Astyria~Ouroboros~Chaine Youtube: RM Test| Inscription Chaine Youtube


Lalouu - posté le 28/10/2015 à 18:59:41 (1 messages postés)

❤ 0

Bonjour, tout d'abord merci a toi pour ce script complètement génial ! J'ai juste une question, j'aimerais désactivé la minimap quand on rentre dans une maison par exemple, comment je peux faire ? En lisant bien se que tu as mis " Si l'on veut que la map ne s'affiche jamais sur une carte, il suffit d'y inclure dans la partie "note" " Or tu n'as pas spécifier se qu'il faut inclure pour la désactivé. ^^


Nemau - posté le 28/10/2015 à 19:49:10 (52124 messages postés) - honor -

❤ 0

The Inconstant Gardener

Peu de chances que quelqu'un réponde à ton problème ici, pose plutôt ta question dans la section entraide du forum (en mettant un lien vers ce script).



Quel RPG Maker choisir ?Ocarina of Time PCPolaris 03 • Le matérialisme c'est quand tu as du matériel.


Kingdommangas - posté le 03/12/2015 à 00:38:36 (409 messages postés)

❤ 0

Youtubeur/Scenariste

Bonjour/soir.

Désoler du retard, je ne sais pas si je t'aiderai mais j'aiderai au moins ceux à qui cela aidera voilà.

Pour désactiver la minimap, il faut faire un appel de script et écrire ceci

Portion de code : Tout sélectionner

1
$game_system.minimap_show = false



¨Pour la réactiver, il faut écrire (en appel de script toujours) ceci:

Portion de code : Tout sélectionner

1
$game_system.minimap_show = true



Voilà, j'espère avoir aider. :grossourire

Mes jeux: Astyria~Ouroboros~Chaine Youtube: RM Test| Inscription Chaine Youtube


Firebestio - posté le 10/03/2018 à 15:57:05 (1 messages postés)

❤ 0

Bonjour. Je souhaite utiliser ce script, et en particulier les couleurs pour les personnages ou objets sur la mini-map, mais cela ne fonctionne pas. Si quelqu'un a une solution, je suis preneur. (PS: je ne sais pas comment écrire un commentaire sur le logiciel :doute5)

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