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

373 connectés actuellement

29413678 visiteurs
depuis l'ouverture

6217 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Lumen

Guelnika & E-magination

Hellsoft

RPG Fusion

Level Up!

Tous nos partenaires

Devenir
partenaire



Messages postés par cortez
Nombre de messages référencés sur Oniromancie (non supprimés): 469

Aller à la page: 1 2 3 4 5 6 7 8 9 10 11 12

Posté dans Forum - [VX Ace] besoin d'aide théorique sur la génération aléat

Cortez - posté le 11/04/2013 à 09:39:12. (523 messages postés)

D'abord parce qu'il à précisé ne pas vouloir retomber sur les même map dans son jeu (calcule un peu la quantité de map et donc de variables pour que chaque donjon soit strictement différent...)

Donc je continue avec la suite du script. (la première partie n'est pas complète)

colle à la suite du précédent :

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
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
# Actually it makes
    for make_stat in @makedata
      time += 1
      if time%2 == 0
        Graphics.update
      end
      case make_stat[0]
      when 0    # Object modification   (p1[0=Height 1=Topography], p2[0=Substitution 1=Addition])
        rndmap_chtarget(make_stat[1],make_stat[2])
      when 1    # Argument setting   (minx, miny, maxz, maxy)
        rndmap_setstat(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
      when 2    # Mask modification (p1[-1:Entirely], p2[ 0=false 1=true 2=onlytrue])
        rndmap_chmask(make_stat[1],make_stat[2])
      when 3    # Road compilation     (Value,Relay score,Deep water guaranty,Type)
        rndmap_mkroad(make_stat[1],make_stat[2],make_stat[3],make_stat[4],make_stat[5])
      when 4    # Expansion       (Object,Vertical width,Breadth,Type)
        rndmap_plus(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
      when 5    # All modification     (Value)
        rndmap_allchg(make_stat[1])
      when 6    # Designated point     (Value, PositionX, PositionY)
        rndmap_putpos(make_stat[1],make_stat[2],make_stat[3])
      when 7    # Around       (Value)
        rndmap_edge(make_stat[1])
      end
    end
    # Use map tile acquisition
    @tilesetting = Table.new(3,40,3)
    for i in [0,1,2]
      for k in 0...40
        for j in [0,1,2]
          @tilesetting[j,k,i] = @map.data[j,k,i]
        end
      end
    end
    # It revises
    time = 0
    for k in 0...@map.height
      for j in 0...@map.width
        time += 1
        # Because time it is required, periodic picture renewal
        if time%500 == 0
          Graphics.update
        end
        # If tile under wall hole modification to land
        if @heightdata[j,k] == 1
          if @heightdata[j,k+1]==-1
            @heightdata[j,k+1] = 0
            if @heightdata[j,k+2]==-1 and
              @heightdata[j,k+3] == 0
              @heightdata[j,k+2] = 0
            end
          end
        end
      end
    end
    # Land compilation that one >> It lays temporarily
    time = 0
    for k in 0...@map.height
      for j in 0...@map.width
        time += 1
        # Because time it is required, periodic picture renewal
        if time%500 == 0
          Graphics.update
        end
        if @heightdata[j,k] == 0
          if @heightdata[j,k+1] == -1 or
            @heightdata[j,k-1] == -1 or
            @heightdata[j+1,k] == -1 or
            @heightdata[j-1,k] == -1
            set_mapdata2(j,k,0,8)
          else
            set_mapdata2(j,k,0,0)
          end
        elsif @heightdata[j,k] == 1
          if @heightdata[j,k+1] == -1 or
            @heightdata[j,k-1] == -1 or
            @heightdata[j+1,k] == -1 or
            @heightdata[j-1,k] == -1
            set_mapdata2(j,k,0,8)
          elsif @heightdata[j,k+1] == 0 or
            @heightdata[j,k-1] == 0 or
            @heightdata[j+1,k] == 0 or
            @heightdata[j-1,k] == 0
            set_mapdata2(j,k,0,0)
          else
            set_mapdata2(j,k,1,4)
          end
        else
          set_mapdata2(j,k,0,8)
        end
      end
    end
    # Land compilation that two >> [etsuji] compilation of hole
    time = 0
    for k in 0...@map.height
      for j in 0...@map.width
        time += 1
        # Because time it is required, periodic picture renewal
        if time%500 == 0
          Graphics.update
        end
        if @heightdata[j,k] == 0
          if @heightdata[j,k+1] == -1
            # Under hole------------------
            if @heightdata[j-1,k] == -1
              # The left hole
              for i in [0,1,2]
                set_mapdata(j,k+i,0,13+i,1)
              end
            elsif @heightdata[j+1,k] == -1
              # The right hole
              for i in [0,1,2]
                set_mapdata(j,k+i,2,13+i,1)
              end
            else
              # Both sides land
              for i in [0,1,2]
                set_mapdata(j,k+i,1,13+i,1)
              end
            end
          elsif @heightdata[j,k-1] == -1
            # On hole------------------
            if @heightdata[j-1,k] == -1 or
            (@heightdata[j-1,k] == 1 and
            @heightdata[j-1,k-1] == -1)
              # The left hole
              set_mapdata(j,k,0,11,2)
            elsif @heightdata[j+1,k] == -1 or
            (@heightdata[j+1,k] == 1 and
            @heightdata[j+1,k-1] == -1)
              # The right hole
              set_mapdata(j,k,2,11,2)
            else
              # Both sides land
              set_mapdata(j,k,1,11,2)
            end
          elsif @heightdata[j-1,k] == -1 or
            (@heightdata[j-1,k] == 1 and
            @heightdata[j-1,k-1] == -1)
            # The left hole------------------
            set_mapdata(j,k,0,12,1)
          elsif @heightdata[j+1,k] == -1 or
            (@heightdata[j+1,k] == 1 and
            @heightdata[j+1,k-1] == -1)
            # The right hole------------------
            set_mapdata(j,k,2,12,1)
          elsif @heightdata[j-1,k-1] == -1
            # With respect to the left hole------------------
            set_mapdata(j,k,0,9,1)
          elsif @heightdata[j-1,k+1] == -1
            # Under the left hole------------------
            set_mapdata(j,k,0,10,1)
          elsif @heightdata[j+1,k-1] == -1
            # With respect to the right hole------------------
            set_mapdata(j,k,1,9,1)
          elsif @heightdata[j+1,k+1] == -1
            # Under the right hole------------------
            set_mapdata(j,k,1,10,1)
          end
        end
        if @heightdata[j,k] == 1 and
          @heightdata[j,k-1] != -1
          if @heightdata[j,k+1] == -1
            # Found a totally non-functional piece of code here
            # It was 'commented' out.
          elsif @heightdata[j,k-1] == -1
            # On hole------------------
            if @heightdata[j-1,k] == -1
              # The left hole
              set_mapdata(j,k,0,11,2)
            elsif @heightdata[j+1,k] == -1
              # The right hole
              set_mapdata(j,k,2,11,2)
            else
              # Both sides land
              set_mapdata(j,k,1,11,2)
            end
          elsif @heightdata[j-1,k] == -1
            # The left hole------------------
            set_mapdata(j,k,0,12,1)
          elsif @heightdata[j+1,k] == -1
            # The right hole------------------
            set_mapdata(j,k,2,12,1)
          elsif @heightdata[j-1,k-1] == -1
            # With respect to the left hole------------------
            set_mapdata(j,k,0,9,1)
          elsif @heightdata[j-1,k+1] == -1
            # Under the left hole------------------
            set_mapdata(j,k,0,10,1)
          elsif @heightdata[j+1,k-1] == -1
            # With respect to the right hole------------------
            set_mapdata(j,k,1,9,1)
          elsif @heightdata[j+1,k+1] == -1
            # Under the right hole------------------
            set_mapdata(j,k,1,10,1)
          end
        end
      end
    end
    # The going/participating of land compilation >> [etsuji] compilation of wall
    time = 0
    for k in 0...@map.height
      for j in 0...@map.width
        time += 1
        # Because time it is required, periodic picture renewal
        if time%500 == 0
          Graphics.update
        end
        if @heightdata[j,k] == 1
          if @heightdata[j,k+1] == 0 or
            @heightdata[j,k+1] == -1
            # Under hole------------------
            if @heightdata[j-1,k] == 0 or
              @heightdata[j-1,k] == -1
              # The left hole
              set_mapdata(j,k+0,0,5+0,5)
              set_mapdata(j,k+1,0,5+1,5)
              set_mapdata(j,k+2,0,5+2,4)
              if @heightdata[j,k+3] != 0 and
                @heightdata[j,k+2] != 1 and
                (@heightdata[j,k+2] != 0 or @heightdata[j-1,k+2] != 0)
                set_mapdata(j,k+2,0,16,5)
                for i in [0,1]
                  set_mapdata(j,k+3+i,0,14+i,1)
                  if @heightdata[j,k+3+i] != -1
                    break
                  end
                end
              end
            elsif @heightdata[j+1,k] == 0 or
              @heightdata[j+1,k] == -1
              # The right hole
              set_mapdata(j,k+0,2,5+0,5)
              set_mapdata(j,k+1,2,5+1,5)
              set_mapdata(j,k+2,2,5+2,4)
              if @heightdata[j,k+3] != 0 and
                @heightdata[j,k+2] != 1 and
                (@heightdata[j,k+2] != 0 or @heightdata[j+1,k+2] != 0)
                set_mapdata(j,k+2,2,16,5)
                for i in [0,1]
                  set_mapdata(j,k+3+i,2,14+i,1)
                  if @heightdata[j,k+3+i] != -1
                    break
                  end
                end
              end
            else
              # Both sides land
              set_mapdata(j,k+0,1,5+0,5)
              set_mapdata(j,k+1,1,5+1,5)
              set_mapdata(j,k+2,1,5+2,4)
              if @heightdata[j,k+3] != 0 and
                 @heightdata[j,k+2] != 1
                set_mapdata(j,k+2,1,16,5)
                for i in [0,1]
                  set_mapdata(j,k+3+i,1,14+i,1)
                  if @heightdata[j,k+3+i] != -1
                    break
                  end
                end
              end
            end
          elsif @heightdata[j,k-1] == 0 or
              @heightdata[j,k-1] == -1
            # On hole------------------
            if @heightdata[j-1,k] == 0 or
              @heightdata[j-1,k] == -1
              # The left hole
              set_mapdata(j,k,0,3,4)
            elsif @heightdata[j+1,k] == 0 or
              @heightdata[j+1,k] == -1
              # The right hole
              set_mapdata(j,k,2,3,4)
            else
              # Both sides land
              set_mapdata(j,k,1,3,4)
            end
          elsif @heightdata[j-1,k] == 0 or
              @heightdata[j-1,k] == -1
            # The left hole------------------
            set_mapdata(j,k,0,4,4)
          elsif @heightdata[j+1,k] == 0 or
              @heightdata[j+1,k] == -1
            # The right hole------------------
            set_mapdata(j,k,2,4,4)
          elsif @heightdata[j-1,k-1] == 0 or
              @heightdata[j-1,k-1] == -1
            # With respect to the left hole------------------
            set_mapdata(j,k,0,1,4)
          elsif @heightdata[j-1,k+1] == 0 or
              @heightdata[j-1,k+1] == -1
            # Under the left hole------------------
            set_mapdata(j,k,0,2,4)
          elsif @heightdata[j+1,k-1] == 0 or
              @heightdata[j+1,k-1] == -1
            # With respect to the right hole------------------
            set_mapdata(j,k,1,1,4)
          elsif @heightdata[j+1,k+1] == 0 or
              @heightdata[j+1,k+1] == -1
            # Under the right hole------------------
            set_mapdata(j,k,1,2,4)
          end
        end
      end
    end
    # Adjusting the position of the player
    playerpos_reset($game_temp.player_new_x,$game_temp.player_new_y)
    @oneventdata[$game_temp.player_new_x,$game_temp.player_new_y] = 1
    time = 0
    for i in @map.events.keys.sort
      time += 1
      if time%100 == 0
        Graphics.update
      end
      # Event installation type >> P-Fixed(Highest priority)
      case event_settype(i)
      when 3
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
      end
    end
    for i in @map.events.keys.sort
      time += 1
      if time%100 == 0
        Graphics.update
      end
      # Event installation type >> Relay point
      case event_settype(i)
      when 1
        set_defeventpos(i,@map.events[i].x,@map.events[i].y)
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
      end
    end
    # Adjusting the position of the event
    for i in @map.events.keys.sort
      time += 1
      if time%100 == 0
        Graphics.update
      end
      j = event_settype(i)
      case j
      when 0  # Random
        set_defeventpos(i,rand(@map.width-4)+2,rand(@map.width-4)+2)
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
      when 2  # Fixed
        set_defeventpos(i,@map.events[i].x,@map.events[i].y)
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
      when 100..199  # Wall installation
        set_defeventpos_wall(i,rand(@map.width-4)+2,rand(@map.width-4)+2,j-100)
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
        @oneventdata[@map.events[i].x,@map.events[i].y-1] = 1
        for k in 1..(j-100)
          @oneventdata[@map.events[i].x+k,@map.events[i].y] = 1
          @oneventdata[@map.events[i].x+k,@map.events[i].y-1] = 1
          @oneventdata[@map.events[i].x-k,@map.events[i].y] = 1
          @oneventdata[@map.events[i].x-k,@map.events[i].y-1] = 1
        end
      when 200..299  # Wall installation fixing
        set_defeventpos_wall(i,@map.events[i].x,@map.events[i].y,j-200)
        @oneventdata[@map.events[i].x,@map.events[i].y] = 1
        @oneventdata[@map.events[i].x,@map.events[i].y-1] = 1
        for k in 1..(j-200)
          @oneventdata[@map.events[i].x+k,@map.events[i].y] = 1
          @oneventdata[@map.events[i].x+k,@map.events[i].y-1] = 1
          @oneventdata[@map.events[i].x-k,@map.events[i].y] = 1
          @oneventdata[@map.events[i].x-k,@map.events[i].y-1] = 1
        end
      end
    end
    # The obstacle is put in place
    for i in 0...(rand(objcnt)+objcnt/2)
      time += 1
      if time%500 == 0
        Graphics.update
      end
      j = rand(@map.width)
      k = rand(@map.width)
      case rand(10)
      when 0..4
        if standable_newtile?(1,0)
          set_mapdata(j,k,1,0,6) if standable?(j,k)
        else
          set_mapdata(j,k,1,0,6) if standable2?(j,k)
        end
      when 5..7
        if standable_newtile?(2,0)
          set_mapdata(j,k,2,0,6) if standable?(j,k)
        else
          set_mapdata(j,k,2,0,6) if standable2?(j,k)
        end
      when 8..9
        if standable2?(j,k)
          if @map.data[j,k-1,2]==0 and
            (@map.data[j,k,1]==0 or @map.data[j,k,2]==0)
            set_mapdata(j,k,2,2,4)    # 4>6?
            set_mapdata(j,k-1,2,1,4)  # 4>2?
          end
        end
      end
    end
    # Contents opening of variable(It is done now kana?)
    @heightdata.resize(0,0)
    @maskdata.resize(0,0)
    @oneventdata.resize(0,0)
    @masksetting.clear
    @makedata.clear
    @tilesetting.resize(0,0,0)
    # If the map save feature is enabled
    if TONBI_AUTO_MAP_SAVE != nil
      # Retention system
      save_data(@map,sprintf("Data/Map%03d.rxdata", TONBI_AUTO_MAP_SAVE))
      maplist  = load_data("Data/MapInfos.rxdata")
      mapinfo = RPG::MapInfo.new
      mapinfo.name = sprintf("Random automatic saving(%s)", maplist[@map_id].name)
      mapinfo.parent_id = 0
      mapinfo.order = TONBI_AUTO_MAP_SAVE
      mapinfo.expanded = true
      mapinfo.scroll_x = 0
      mapinfo.scroll_y = 0
      
      maplist[TONBI_AUTO_MAP_SAVE]=mapinfo
      save_data(maplist,"Data/MapInfos.rxdata")
    end
  end
  #--------------------------------------------------------------------------
  # * Position type acquisition of event
  #--------------------------------------------------------------------------
  def event_settype(i)
    return 1 if @map.events[i].subname == "Relay"
    return 2 if @map.events[i].subname == "Fixed"
    return 3 if @map.events[i].subname == "P-Fixed"
    for j in 0..1000
      if @map.events[i].pages[0].list[j].code != 108
        break
      end
      # If the relay point it is in comment
      return 1 if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == "Relay"
      # If Fixed it is in comment
      return 2 if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == "Fixed"
      # If P-Fixed it is in comment
      return 3 if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == "P-Fixed"
      # If Wall it is in comment
      if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == "Wall"
        if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1] == nil
          return 100
        else
          k = @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1]
          k = k.to_i
          return 100+k
        end
      end
      # If P-Wall is in comment
      if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == "P-Wall"
        if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1] == nil
          return 200
        else
          k = @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1]
          k = k.to_i
          return 200+k
        end
      end
    end
    return 0
  end
  #--------------------------------------------------------------------------
  # * Event installation near designated position
  #--------------------------------------------------------------------------
  def set_defeventpos(id,x,y)
    if standable2?(x,y)
      @map.events[id].x=x
      @map.events[id].y=y
      return
    end
    for i in 1..([@map.width,@map.height].max)
      if standable2?(x,y+i)
        @map.events[id].x=x
        @map.events[id].y=y+i
        return
      end
      for j in 1..i
        if standable2?(x-j,y+i)
          @map.events[id].x=x-j
          @map.events[id].y=y+i
          return
        end
        if standable2?(x+j,y+i)
          @map.events[id].x=x+j
          @map.events[id].y=y+i
          return
        end
        if standable2?(x-j,y-i)
          @map.events[id].x=x-j
          @map.events[id].y=y-i
          return
        end
        if standable2?(x+j,y-i)
          @map.events[id].x=x+j
          @map.events[id].y=y-i
          return
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Event installation to wall near designated position
  #     p4   Width
  #--------------------------------------------------------------------------
  def set_defeventpos_wall(id,x,y,p4)
    if standable3?(x,y,p4)
      @map.events[id].x=x
      @map.events[id].y=y
      return
    end
    for i in 1..([@map.width,@map.height].max)
      if standable3?(x,y+i,p4)
        @map.events[id].x=x
        @map.events[id].y=y+i
        return
      end
      for j in 1..i
        if standable3?(x-j,y+i,p4)
          @map.events[id].x=x-j
          @map.events[id].y=y+i
          return
        end
        if standable3?(x+j,y+i,p4)
          @map.events[id].x=x+j
          @map.events[id].y=y+i
          return
        end
        if standable3?(x-j,y-i,p4)
          @map.events[id].x=x-j
          @map.events[id].y=y-i
          return
        end
        if standable3?(x+j,y-i,p4)
          @map.events[id].x=x+j
          @map.events[id].y=y-i
          return
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Prayer installation near designated position
  #--------------------------------------------------------------------------
  def playerpos_reset(x,y)
    if standable?(x,y)
      $game_temp.player_new_x=x
      $game_temp.player_new_y=y
      return
    end
    for i in 1..([@map.width,@map.height].max)
      if standable?(x,y+i)
        $game_temp.player_new_x=x
        $game_temp.player_new_y=y+i
        return
      end
      for j in 0..i
        if standable?(x-j,y+i)
          $game_temp.player_new_x=x-j
          $game_temp.player_new_y=y+i
          return
        end
        if standable?(x+j,y+i)
          $game_temp.player_new_x=x+j
          $game_temp.player_new_y=y+i
          return
        end
        if standable?(x-j,y-i)
          $game_temp.player_new_x=x-j
          $game_temp.player_new_y=y-i
          return
        end
        if standable?(x+j,y-i)
          $game_temp.player_new_x=x+j
          $game_temp.player_new_y=y-i
          return
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * You can pass by your?(Obstacle tile)
  #     p1,p2 Position X,Y
  #--------------------------------------------------------------------------
  def standable_newtile?(p1,p2)
    for i in [2, 1, 0]
      tile_id = @tilesetting[p1, p2, i]
      if tile_id == nil
        return false
      elsif @passages[tile_id] & 0x0f == 0x0f
        return false
      elsif @priorities[tile_id] == 0
        return true
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * It can stand to designated position?
  #     p1,p2 Position X,Y
  #--------------------------------------------------------------------------
  def standable?(p1,p2)
    if @heightdata[p1,p2] != 0
      return false
    end
    if @oneventdata[p1,p2] ==1
      return false
    end
    for i in [2, 1, 0]
      tile_id = @map.data[p1, p2, i]
      if tile_id == nil
        return false
      elsif @passages[tile_id] & 0x0f == 0x0f
        return false
      elsif @priorities[tile_id] == 0
        return true
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Putting on designated position, all right?(Consideration edition such as event around)
  #     p1,p2 Position X, Y
  #--------------------------------------------------------------------------
  def standable2?(p1,p2)
    # The position decision
    unless standable?(p1,p2)
      return false
    end
    # Event check around (it doesn't become dead end?)
    #It passes through to length, the [re] [ru]?
    if standable?(p1+1,p2-1) == false or
      standable?(p1+1,p2) == false or
      standable?(p1+1,p2+1) == false
      if standable?(p1-1,p2-1) == false or
        standable?(p1-1,p2) == false or
        standable?(p1-1,p2+1) == false
        # Originally when it passes through to length and there is no [re] disregard
        if standable?(p1,p2-1) == true and
          standable?(p1,p2+1) == true
          return false
        end
      end
    end
    # It passes through to side, the [re] [ru]?
    if standable?(p1+1,p2+1) == false or
      standable?(p1,p2+1) == false or
      standable?(p1-1,p2+1) == false
      if standable?(p1+1,p2-1) == false or
        standable?(p1,p2-1) == false or
        standable?(p1-1,p2-1) == false
        # Originally when it passes through to side and there is no [re] disregard
        if standable?(p1-1,p2) == true and
          standable?(p1+1,p2) == true
          return false
        end
      end
    end
    if standable?(p1,p2-1) == false and
      (standable?(p1-1,p2+1) == false or 
      standable?(p1,p2+1) == false or
      standable?(p1+1,p2+1) == false)
      return false
    end
    if standable?(p1,p2+1) == false and
      (standable?(p1-1,p2-1) == false or 
      standable?(p1+1,p2-1) == false or
      standable?(p1+1,p2-1) == false)
      return false
    end
    if standable?(p1-1,p2) == false and
      (standable?(p1+1,p2-1) == false or 
      standable?(p1+1,p2) == false or
      standable?(p1+1,p2+1) == false)
      return false
    end
    if standable?(p1+1,p2) == false and
      (standable?(p1-1,p2-1) == false or 
      standable?(p1-1,p2) == false or
      standable?(p1-1,p2+1) == false)
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Putting on wall edition designated position, all right?(Wall edition)
  #     p1,p2 Position X, Y
  #     p3    Width
  #--------------------------------------------------------------------------
  def standable3?(p1,p2,p3)
    # If the bottom cannot stand originally, failure
    unless standable?(p1,p2+1)
      return false
    end
    # The position decision
    if @oneventdata[p1,p2] == 1 or
      @oneventdata[p1,p2-1] == 1 or
      @heightdata[p1,p2-2] != 1 or
      @heightdata[p1,p2-1] == 1 or
      @heightdata[p1,p2+1] != 0
      return false
    end
    for i in 1...p3+1
      if@heightdata[p1+i,p2-2] != 1 or
        @heightdata[p1+i,p2-1] == 1 or
        @heightdata[p1+i,p2+1] != 0
        return false
      end
      if@heightdata[p1-i,p2-2] != 1 or
        @heightdata[p1-i,p2-1] == 1 or
        @heightdata[p1-i,p2+1] != 0
        return false
      end
    end
    for i in 1...p3+1
      if @oneventdata[p1+i,p2] == 1 or
        @oneventdata[p1+i,p2-1] == 1
        return false
      end
      if @oneventdata[p1-i,p2] == 1 or
        @oneventdata[p1-i,p2-1] == 1
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Map tile information modification
  #     p1,p2 Position ahead writing out X,Y
  #     p3,p4 Original reference positionX,Y
  #     p5  Insertion method 0:Normality 1:Lower layer 2:Upper layer 3:From under 4:From above 5:Both
  #--------------------------------------------------------------------------
  def set_mapdata(p1,p2,p3,p4,p5 = 0)
    unless self.valid?(p1, p2)
      return
    end
    if @tilesetting[p3,p4,0] != 0 # You put in place the layer 0 normally
      @map.data[p1,p2,0] = @tilesetting[p3,p4,0]
    end
    case p5
    when 0 # Normality
      if @tilesetting[p3,p4,1] != 0
        @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
      end
      if @tilesetting[p3,p4,2] != 0
        @map.data[p1,p2,2] = @tilesetting[p3,p4,2]
      end
    when 1 # You place under
      if @tilesetting[p3,p4,1] != 0
        @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
      end
    when 2 # You place on
      if @tilesetting[p3,p4,1] != 0
        @map.data[p1,p2,2] = @tilesetting[p3,p4,1]
      end
    when 3 # You put from under
      if @tilesetting[p3,p4,1] != 0
        if @map.data[p1,p2,1] != 0
          @map.data[p1,p2,2] = @map.data[p1,p2,1]
        end
        @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
      end
    when 4 # You put from above
      if @tilesetting[p3,p4,1] != 0
        if @map.data[p1,p2,2] != 0
          @map.data[p1,p2,1] = @map.data[p1,p2,2]
        end
        @map.data[p1,p2,2] = @tilesetting[p3,p4,1]
      end
    when 5 # You place in both
      if @tilesetting[p3,p4,1] != 0
        @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
      end
      if @tilesetting[p3,p4,1] != 0
        @map.data[p1,p2,2] = @tilesetting[p3,p4,1]
      end
    when 6 # You can put, if you put
      if @map.data[p1,p2,1] == 0
        @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
      elsif @map.data[p1,p2,2] == 0
        @map.data[p1,p2,2] = @tilesetting[p3,p4,1]
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Map tile information modification 2 >>There is no decision and the like outside the range ver
  #     p1,p2 Position ahead writing out X,Y
  #     p3,p4 Original reference position,Y
  #--------------------------------------------------------------------------
  def set_mapdata2(p1,p2,p3,p4)
    @map.data[p1,p2,0] = @tilesetting[p3,p4,0]
    @map.data[p1,p2,1] = @tilesetting[p3,p4,1]
    @map.data[p1,p2,2] = @tilesetting[p3,p4,2]
  end
  #--------------------------------------------------------------------------
  # * Information modification of designated position
  #     p1,p2 Position X,Y
  #     p3    Value
  #--------------------------------------------------------------------------
  def set_height(p1,p2,p3)
    return if p1<0
    return if p1>=@map.width
    return if p2<0
    return if p2>=@map.height
    @heightdata[p1,p2]=p3
  end
  #--------------------------------------------------------------------------
  # * Information modification of designated position
  #     p1,p2 Position X,Y
  #     p3    Value
  #--------------------------------------------------------------------------
  def set_grounddata(p1,p2,p3)
    return if p1<0
    return if p1>=@map.width
    return if p2<0
    return if p2>=@map.height
    if @masksetting[@maskdata[p1,p2]] == true
      if @targettype==0
        if @chgtype==0
          @heightdata[p1,p2]=p3
        elsif @chgtype==1
          @heightdata[p1,p2]+=p3
        end
      elsif @targettype==1
        if @chgtype==0
          @maskdata[p1,p2]=p3
        elsif @chgtype==1
          @maskdata[p1,p2]+=p3
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Operation methodological appointment
  #     p1  Object   >> =0:Height =1:Topography  (Presently, height 0=Land 1=Wall)
  #     p2  M Method >> =0:Substitution =1:Addition As for topography in only mask decision use
  #--------------------------------------------------------------------------
  def rndmap_chtarget(p1,p2)
    @targettype=p1
    @chgtype=p2
  end
  #--------------------------------------------------------------------------
  # * Set the value used in other commands
  #     p1,p2 Smallest X,Y
  #     p3,p4 Maximum X,Y  You use for the start point and end point set etc of road production
  #--------------------------------------------------------------------------
  def rndmap_setstat(p1,p2,p3,p4)
    @minx=p1
    @miny=p2
    @maxx=p3
    @maxy=p4
  end
  #--------------------------------------------------------------------------
  # * Set the topographical mask
  #     p1 = Object topography  (-1= Entirely)
  #     p2 = Modification value (0= Prohibed  1= Permitted  2=Topography only)
  #--------------------------------------------------------------------------
  def rndmap_chmask(p1,p2)
    if p1>=0
      if p2==0
        @masksetting[p1]=false
      elsif p2 == 1
        @masksetting[p1]=true
      elsif p2 == 2
        for i in 0...100
          @masksetting[i]=false
        end
        @masksetting[p1]=true
      end
    end
    if p1==-1
      if p2==0
        for i in 0...100
          @masksetting[i]=false
        end
      else   
        for i in 0...100
          @masksetting[i]=true
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Make the road connection points
  #     Set starting and end points with the rndmap_setstat method.
  #     p1 = Writing the value which is changed
  #     p2 = If halfway score (0 map size 40*40 in standard relative change)
  #     p3 = The width which is guaranteed in the deep water
  #     p4 = How to tie the halfway point (0=You tie in the straight line  1=Perpendicular line (?)So you tie)
  #     p5 = Distance of the relay point which you ignore
  #--------------------------------------------------------------------------
  def rndmap_mkroad(p1,p2,p3,p4,p5 = 5)
    p5 = 5 if p5 == nil
    localdata = Table.new(@map.width,@map.height)
    aposx = []
    aposy = []
    aflag = []
    for i in 0...@map.width
      for j in 0...@map.height
        localdata[i,j] = 0
      end
    end
    p2 = (p2*-1) * @map.width * @map.height / 40 / 40 if p2 < 0    
    aposx[0]=@minx
    aposy[0]=@miny
    aposx[1]=@maxx
    aposy[1]=@maxy
    aposx[0]=@map.width+aposx[0]              if aposx[0]<0
    aposx[0]=@map.width*(aposx[0]-1000)/100   if (aposx[0]>=1000) and (aposx[0]<=1100)
    aposy[0]=@map.height+aposy[0]             if aposy[0]<0
    aposy[0]=@map.height*(aposy[0]-1000)/100  if (aposy[0]>=1000) and (aposy[0]<=1100)
    aposx[1]=@map.width+aposx[1]              if aposx[1]<0
    aposx[1]=@map.width*(aposx[1]-1000)/100   if (aposx[1]>=1000) and (aposx[1]<=1100)
    aposy[1]=@map.height+aposy[1]             if aposy[1]<0
    aposy[1]=@map.height*(aposy[1]-1000)/100  if (aposy[1]>=1000) and (aposy[1]<=1100)
    if p4==0 or p4==1 or p4==2
      i4 = rand(2) if p4 == 2
      aflag[0] = true
      aflag[1] = false
      for i in 2...(p2+2)
        aposx[i] = rand(@map.width-p3*2) + p3
        aposy[i] = rand(@map.height-p3*2) + p3
        aflag[i] = false
      end
      i3=0
      i1=aposx[i3]
      i2=aposy[i3]
      localdata[i1,i2] = 1
      for i in 0...p2+2
        i7=5000000
        for j in 0...p2+2
          if aflag[j] == false
            i4 = aposx[j]-i1
            i4=i4*-1 if i4 < 0
            i5 = aposy[j]-i2
            i5=i5*-1 if i5 < 0
            if (i4**2+i5**2) <=(p5**2) and j != 1
              aflag[j] = true
            elsif i7 > (i4**2+i5**2)
              i7=(i4**2+i5**2)
              i6=j
            end
          end
        end
        #  Starting point ID:i3   End point ID:i6
        if p4==0
          if aposx[i3] > aposx[i6]
            i8 = aposx[i3]
            i9 = aposy[i3]
            i10 = aposx[i6]
            i11 = aposy[i6]
          else
            i8 = aposx[i6]
            i9 = aposy[i6]
            i10 = aposx[i3]
            i11 = aposy[i3]
          end
          if i8!=i10
            for i in 0..(i8-i10)
              localdata[i+i10,(i9-i11)*i/(i8-i10)+i11] = 1
            end
          end
          if aposy[i3] > aposy[i6]
            i8 = aposx[i3]
            i9 = aposy[i3]
            i10 = aposx[i6]
            i11 = aposy[i6]
          else
            i8 = aposx[i6]
            i9 = aposy[i6]
            i10 = aposx[i3]
            i11 = aposy[i3]
          end
          if i9!=i11
            for i in 0..(i9-i11)
              localdata[(i8-i10)*i/(i9-i11)+i10,i+i11] = 1
            end
          end
        end
        if p4==1
          i4 = rand(2)
          if i4==0
            for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
              localdata[i+[aposx[i3],aposx[i6]].min,aposy[i3]] = 1
            end
            for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
              localdata[aposx[i6],i+[aposy[i3],aposy[i6]].min] = 1
            end
          else
            for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
              localdata[i+[aposx[i3],aposx[i6]].min,aposy[i6]] = 1
            end
            for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
              localdata[aposx[i3],i+[aposy[i3],aposy[i6]].min] = 1
            end
          end
        end
        i3=i6
        i1=aposx[i3]
        i2=aposy[i3]
        aflag[i3]=true
        break if i3==1
      end
    end
    for i in 0...@map.width
      for j in 0...@map.height
        set_grounddata(i,j,p1) if localdata[i,j] == 1
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Expanding the object
  #     p1       Object
  #     p2,p3    The width which it expands X,Y
  #     p4       Extended method (0=Cross  1=Square)
  #--------------------------------------------------------------------------
  def rndmap_plus(p1, p2, p3, p4)
    localdata = Table.new(@map.width,@map.height)
    for i in 0...@map.width
      for j in 0...@map.height
        if @targettype==0
          localdata[i,j] = @heightdata[i,j]
        elsif @targettype==1
          localdata[i,j] = @maskdata[i,j]
        end
      end
    end
    if p4 == 0
      for i in 0...@map.width
        for j in 0...@map.height
          if p1==localdata[i,j]
            for k in 1..p2
              set_grounddata(i+k,j,p1)
              set_grounddata(i-k,j,p1)
            end
            for k in 1..p3
              set_grounddata(i,j+k,p1)
              set_grounddata(i,j-k,p1)
            end
          end
        end
      end
    elsif p4 == 1
      for i in 0...@map.width
        for j in 0...@map.height
          if p1==localdata[i,j]
            for k in (i-p2)..(i+p2)
              for l in (j-p3)..(j+p3)
                set_grounddata(k,l,p1)
              end
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * It sets entirely
  #     p1       Value
  #--------------------------------------------------------------------------
  def rndmap_allchg(p1)
    for i in 0...@map.width
      for j in 0...@map.height
        set_grounddata(i,j,p1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Designated point
  #     p1       Value
  #     p2,p3    Position X,Y
  #--------------------------------------------------------------------------
  def rndmap_putpos(p1, p2, p3)
    i = rand(@maxx-@minx+1)+@minx
    j = rand(@maxy-@miny+1)+@miny
    for k in (p2-i)..(p2+i)
      for l in (p3-j)..(p3+j)
        set_grounddata(k,l,p1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Around
  #     p1       Value
  #--------------------------------------------------------------------------
  def rndmap_edge(p1)
    for i in 0...@map.width
      set_grounddata(i,0,p1)
      set_grounddata(i,@map.height-1,p1)
    end
    for i in 0...@map.height
      set_grounddata(0,i,p1)
      set_grounddata(@map.width-1,i,p1)
    end
  end
end
 
 
 
#==============================================================================
# ** RPG::MapInfo >> Sub name..","Thing of letter of later subname Acquisition
#==============================================================================
module RPG
  class MapInfo
    #------------------------------------------------------------------------
    # * Name
    #------------------------------------------------------------------------    
    def name
      name = @name.split(/,/)[0]
      return name != nil ? name : ''
    end
    #------------------------------------------------------------------------
    # * Name=
    #     str : string value
    #------------------------------------------------------------------------    
    def name=(str)
      str2 = @name[/^[^,]*(&#65292;.*)/, 1]
      @name = str2 != nil ? str + str2 : str
    end
    #------------------------------------------------------------------------
    # * Subname
    #     i : split position integer
    #------------------------------------------------------------------------    
    def subname(i = 1)
      name = @name.split(/,/)[i]
      return name != nil ? name : ""
    end
  end
end
 
 
 
#==============================================================================
# ** RPG::Event >>Sub name. " " Thing of letter of later subname Acquisition
#==============================================================================
module RPG
  class Event
    #------------------------------------------------------------------------
    # * Name
    #------------------------------------------------------------------------    
    def name
      name = @name.split(/,/)[0]
      return name != nil ? name : ''
    end
    #------------------------------------------------------------------------
    # * Name=
    #     str : string value
    #------------------------------------------------------------------------    
    def name=(str)
      str2 = @name[/^[^,]*(&#65292;.*)/, 1]
      @name = str2 != nil ? str + str2 : str
    end
    #------------------------------------------------------------------------
    # * Subname
    #     i : split position integer
    #------------------------------------------------------------------------    
    def subname(i = 1)
      name = @name.split(/,/)[i]
      return name != nil ? name : ""
    end
  end
end



Les autres explications :

Pour les évent dans la map aléatoire tu disposes de plusieurs options. Il faut juste donner le bon nom aux évènements.

Relay -> Oblige le générateur à placer un chemin passant par chacun des event Relay (pratique pour faire varier la forme du donjon en déplaçant juste les Relay)

Fixed -> Place cet évènement sur la case traversable la plus proche. Pratique pour des coffres et interrupteurs mais aussi les npc et monstres.

P-Fixed -> Fixe complètement l'évent sur sa position, il reste à la même position donc il peut être placé sur un mur ou au plafond.

Wall -> Place l'évent sur la case de mur la plus proche. Pratique pour les torches et décoration sur les murs.
Wall,1 place l'évent sur la 1ere case du mur (en bas)
Wall,2 place l'évent sur la 2e case du mur (en haut)

P-Wall -> Pareil que pour Wall, il permet de placer des portes (pour se téléporter)
Et comme Wall tu peux ajouter un chiffre après pour définir la hauteur de l'évent, P-Wall,1 / P-Wall,2

Enfin dans le script, le jeu génère la map en double et la sauvegarde sur la map 999 (il faut que tu crées la map 999 d'abord)

Donc petite astuce, si tu as un menu custom (qui téléporte vers une autre map.) Ou tout autre chose qui peut être activé par le héro pendant qu'il est sur une map random, lorsque tu retourne sur la map elle aura changé, pour éviter cela téléporte le joueur sur la map 999 qui est une copie la map qu'il a quitté.
Ainsi le joueur n'y verra que du feu.

Le système est compatible avec le XAS 3.51 (place le script Après le XAS). Il est compatible avec tous les systèmes de combats excepté le GTBS XP (pour que ça marche, il faut que la map ou l'on combat ne soit pas random.)

Les configurations des maps :

Le chiffre après Random permet d'indiquer au script quelle map dessiner mais il faut aussi paramétrer correctement mapping pour que tout marche.

Voici les configurations possibles :
imageimageimageimageimageimage

Posté dans Forum - [VX Ace] besoin d'aide théorique sur la génération aléat

Cortez - posté le 10/04/2013 à 21:17:57. (523 messages postés)

Tu peux utiliser un script (ou le décortiquer pour savoir comment il marche.)

Mini tuto :

Pour que le script fonctionne, il faut que la map soit nomée avec
Random,1,100
image
- random active le script
- 1 indique le type de map (expliqué dans le script)
- 100 indique la quantité d'objet généré sur la map(rocher et autre)

Et mapper la carte comme ça (je te montre la couche 1)
Tout le reste est placé sur la 2e couche.

image

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
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
#==============================================================================
#     Random Map Generator Script v0.80   by tonbi            (January 2, 2006)
#------------------------------------------------------------------------------
#     This script automatically creates random maps.
#==============================================================================
#
#     Place this script under Scene_Debug and above Main for use.
#
#     Because of the 'light weight conversion system'(abridged edition) already
#     installed, do not use with the Light Weight Conversion script.
#
#==============================================================================
#
#     ** How to use 
#
#     This system uses a three-stage creation process:
#
#     1) It requires  that random maps  have a properly defined name  that uses 
#        the word 'random'  followed by  a series  of values to assist  in it's 
#        creation.
#
#     2) The maps themselves  must contain  one or more  sets of  tile patterns
#        which are used by the generator to draw the map itself.
#
#     3) The custom events  within the  generated map  should be tagged  with a
#        special flag  in either the event's name  or in a comment in the first
#        page of the event.
#
#------------------------------------------------------------------------------
#
#     == Map Creation / Map Name and Tiles ==
#
#     When crafting  a randomly generated map,  you must have  an appropriately
#     created map map and name your random map with the following syntax:
#
#                       mapname, random, YYY, ZZZ
#     
#     1) The very first parameter is the traditional map name.
#     2) The second parameter is the key word 'Random'.   This informs the sys-
#        tem that this will be a randomly generate map.
#     3) The third patameter is the YYY value.  It indicates how many formation
#        patterns are available  in the map's tileset (see formation patterns).
#     4) And the fourth parameter is the ZZZ value.   It indicates how many ob-
#        stacles and/or tiles are drawn in the generated map (see random ob-
#        stacles).
#
#
#------------------------------------------------------------------------------
#
#     == Formation Patterns ==
#
#     The upper left corner  of your map  contains a series  of tiles used when
#     drawing the randomly created map.   Below is the layout  of the tiles and
#     how they will appear  when you're  readying them for  generating a random 
#     map.
#
#     +---+
#     |   | <----- Floor Tile
#     +---+---+
#     |/     \|
#     |       | <--- Ceilings (corners)
#     |\     /|
#     +---+---+---+
#     | /-------\ |
#     ||  +---+  ||
#     ||  |   |  || <---Ceiling (visible ledge borders w/ center ceiling tile)
#     ||  +---+  ||
#     | \-------/ |
#     +---+---+---+
#     |           |
#     |           | <---Walls
#     |           |
#     +---+---+---+
#
#     The floor tile  is the basic tile  your character can walk upon.   As you
#         walk on the floor tile,  it must be  a 1st layer graphic...  and thus
#         drawm in the 1st layer of your map.
#
#     The ceiling tiles (corners followed by borders)  are the area your player
#         will not be  able to walk upon.   However,  the top layer of 'Ceiling
#         border' may be set  to passable  with a priority of '1' so it can ap-
#         pear the player  is walking 'under' the ledge.   Still,  nearly every
#         ceiling tile must be drawn in the 2nd layer  of your map with the ex-
#         ception of the CENTER ceiling tile.
#
#   And the wall tiles are last, and set up to be impassable.  Like the ceiling
#         tiles, they must be drawn in the 2nd layer of your map.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#
#     You can create maps that have two different sets of map tiles like...
#
#     +-+
#     | |  <---- Floor
#     +-+-+
#     +   + <----Ceiling (corners)
#     +-+-+-+
#     |     |
#     |     | <---Ceiling (ledge)
#     +-+-+-+
#     |     | <-- Walls
#     +-+-+-+
#     | | <------ 2nd Floor
#     +-+-+
#     +   + < --- 2nd ceiling (corners)
#     +-+-+-+
#     |     |
#     |     | <--- Etc.
#     +-+-+-+
#     |     |
#     +-+-+-+
#
#     Or even more than two sets of tiles, this number of Formation Patterns is
#     set in the mapname under the YYY value as described above.
#
#------------------------------------------------------------------------------
#
#     == Random Obstacles in the Formation Patterns ==
#     
#     If you were to generate a random map,  you would see  a bare floor with a
#     series of walls  going this way or that.   While the walls may branch out
#     in various directions, the floor itself 'would' be pretty much plain.  It
#     is by setting up some 'random obstacles' that you may have a floor in the
#     generated map that makes it appear less drab.
#
#     The obstacles that are drawn on the map floor come in two varieties, they
#     may be  single tile graphics  or graphics  that are two tiles  in height.
#     The obstacles are defined within the  'Formation Pattern'  tiles as I had
#     described above.   However, when I described the formation pattern tiles,
#     I had not included the obstacles themselves.
#
#     Allow me to present a section of a formation pattern layout  with the ad-
#     dition of map obstacles.
#
#
#        +-------- Floor Tile
#        |  +---------------------- An obstacle (single tile)
#        V  V
#     +---+---+---+
#     |   |   |   | <-------------- An obstacle (single tile)
#     +---+---+---+---+ 
#     |/     \|   | <-------------- An obstacle (two tiles tall)
#     |       |   |   |
#     |\     /|   |   | <-----------An obstacle (two tiles tall)
#     +---+---+---+---+
#        ^
#        +-------- Ceilings (corners)
#
#
#     The very first row in the formation starts off with the floor tile,  just 
#     like before.  But following the floor tiles are the single-tile obstacles
#     like rocks or bushes or anything that is drawn with a single tile.  These
#     tiles may  be passable  or they may block  the player  so he  has to move
#     around the obstacles. Either way, these obstacles are drawn in the second
#     layer so they are drawn (over) the regularly drawn floor tiles.
#
#     The next row(s)  where the first set of ceiling tiles  are drawn is where
#     you define the two-tile tall obstacles. More often, these tiles are drawn
#     with the bottom tile being blocked  while the second tile  being passable 
#     and with a 'priority' setting of 1 so the player appears to be moving be-
#     hind the tile.  These tiles/obstacles are also drawn in the second layer.
#
#     You can set up  a number of  single or two-tile tall  obstacles  in their 
#     defined rows.  There does not seem  to be any set limit to the total num-
#     ber you may create. 
#
#     There are no 'three-tile tall' obstacles.
#
#
#------------------------------------------------------------------------------
#
#     == Map Creation / Special Event Placement ==
#
#     By adding special names or comments to an event, you can applay a special
#     attibute such as fixing it in place, or to alter the way the map is made.
#
#     Names/Codes are as follows:
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     Name of event, Relay”
#     Events that hold the text of 'Relay' (in either the name or in a comment)
#     allows you to set up area generated in which the player/party can wander.
#
#     When with it does, the position by all means becomes the land.
#     Keeping connecting this relay point, to the order of event, ID it makes the map.
#     (With the reason which has tied in the straight line of course it is not)
#     If possible, please make the relay point in both deep waters of the map.
#     In addition, please can be less crowded the deep water a little. (5 tiles) the wall is gone.
#     However, there is no this relay point and the map is drawn up also the [te], once.
#     In addition, when the relay point is increased too much, the wall decreases.
#     Because it is sufficient with several, please pay attention.
#     The recommendation at three is setting in shape of 3 rectangularities
#
#     In the event other than the relay point, those which do not have especially appointment random are moved to land.
#
#     Name of event, "Fixed"
#     Events that hold the text of 'Fixed' (in either the name or in a comment)
#     will be positioned to the closest nearby passable tile.  This allows for
#     you to position one or more events to a general location so you can group
#     like events together and still have a little randomness.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     Name of event, "P-Fixed"
#     Events that hold the text of 'P-Fixed' (in either the name or the comment)
#     allows you to fix the position of that event on the map.  This is differ-
#     ent from the 'Fixed' variation as this does not force the event to a pas-
#     sable tile but also allows these events to be drawn on walls and ceiling
#     tiles that are normally impassable by the player.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     Name of event, "Wall"
#     Events that hold the text of 'Wall' within a comment in the first page
#     will move to a random position within a generated wall.  This would be 
#     useful to position random doors or wall decorations like torches within
#     the randomly generated map.
#
#     If the statement is followed by a ',1' ... like "Wall,1" ...then it takes
#     the width and height of the event into consideration when positioning the
#     event.  As such, it is recommended to add the ',1' to the event name.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     Name of event, "P-Wall"
#     Events that hold the text of 'P-Wall' within a comment in the first page
#     will move to the closest generated wall on the map. This would be useful
#     to position doorways or portals within the randomly generated map.
#
#     If the statement is followed by a ',1' ... like "Wall,1" ...then it takes
#     the width and height of the event into consideration when positioning the
#     event.  As such, it is recommended to add the ',1' to the event name.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     In addition, it is possible to add additional event calls to the case
#     system if necessary.  'Scripters only.
#'
#
#==============================================================================
#
#     ** How to configure
#
#     == Caterpillar/Train Actor by Fukuyama ==
#     
#     You have  the option  to use  this system  with Fukuyama's famous  'Train
#     Actor' script. For compatability, set the TONBI_USE_TRAIN_ACTOR switch to
#     true, otherwise keep this value set to false.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     == Clipping/Refresh Range System ==
#
#     This system allows you  to adjust the range  where active sprites  on the
#     map are refreshed rather than having them refresh when out of the party's
#     visual range. By increasing the values stored within the TONBI_DRAWRANGEX
#     and TONBI_DRAWRANGEY values, sprite graphics may refresh further from the
#     party.   On the opposite end of the spectrum,  lowering these values will
#     force the graphics to only refresh when closer to the player.
#
#     If you deal with larger character sets,  you may wish to increase the set
#     values.  Reducing the default values is not recommended.
#
#     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#
#     == Map Retention System ==
#     
#     This system stores a copy  of the most recently created random map in the
#     your savegames,  so you can return  to a random map without difficulty...
#     even if you have multiple savegames with random maps each.
#
#     However, you have the option  to create a separate game map  which may be 
#     added/ammended to your project's MapInfos data file.   This can be useful
#     if you wish to create random maps to save and re-use later.
#
#     Initially, Tonbi's original version used a 'true/false' switch to utilize
#     this system,  but this version  has been slightly modified.   Rather than
#     having a preset and hardcoded  MapID of 999  for your generated map (thus
#     creating  'only'  Map999.rxdata),  this version  gives you  the luxury of
#     creating the ID number  of the map yourself.   If you wish  your randomly
#     created map to be Map789.rxdata... you can,  just by setting the modified
#     TONBI_AUTO_MAP_SAVE value to 789.  
#
#     Maps generated  with this system  will be visible  in your  MapInfos.data
#     list in the bottom-left window of your map editor, right under your tiles
#     window.  The name will read  'Random automatic saving(mapname...)'.   The
#     map will use  the same tileset  as the random map itself,  and the events
#     will be copied over with no problem.
#
#     Setting TONBI_AUTO_MAP_SAVE to nil will turn the system off.
#
#==============================================================================
#
#     ** Compatability issues
#
#     This system was created exclusively for RPGMaker XP, an RGSS system.   It
#     is not RMXP SDK compliant  and might not be compatible with other scripts
#     that edit or modify the RMXP mapping/movement system.
#
#     However,  the rewritten sections in this script have been highlighted for
#     the intermediate scripter.  An example of a rewritten line is as follows:
#
#        #########################################################
#        # Modification:  New 'onscreen' array
#        #
#        $onscreen = []
#        #########################################################
#
#     As such,  it should be very easy  to trace all the edits  to the default
#     RGSS system that have been performed.
#
#     Please take note of the methods that have been altered for this system.
#
#     == Methods Aliased ==
#     Game_Temp.initialize, Game_Character.update
#
#
#     == Methods Rewritten ==
#     Spriteset_Map.initialize, Spriteset_Map.dispose, Spriteset_Map.update,
#     Game_Map.setup, RPG::MapInfo.name, RPG::Event.name
#
#
#==============================================================================
 
  
             # ----------------------------------------------- #
             #                                                 #
             #      C  O  N  F  I  G  U  R  A  B  L  E  S      #
             #                                                 #
             # ----------------------------------------------- #
             
             
  TONBI_USE_TRAIN_ACTOR = false   # Set to true if using Fukuyama's Train Actor
                                  # script.  Set to false by default.
                                  
  TONBI_DRAWRANGEX      = 1920    # Used to increase / decrease the range where
  TONBI_DRAWRANGEY      = 1664    # charset graphics are permitted to refresh.
                                  # Recommended:  Do not decrease.
                                  
  TONBI_AUTO_MAP_SAVE   = 999     # The MapID where the generated map is saved.
                                  # Set to nil if it doesn't save the map.
                        
 
                                  
                                  
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
 
class Game_Temp
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------  
  alias initialize_tonbi1 initialize
  def initialize
    initialize_tonbi1
    $onscreen = []                        # Flag inside sprite picture
  end
end
 
 
 
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================
 
class Game_Character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_tonbi1 update
  def update
    # Position on picture
    sx = @real_x - $game_map.display_x - 1280
    sy = @real_y - $game_map.display_y - 960
    # Absolute value is calculated
    abs_sx = sx > 0 ? sx : -sx
    abs_sy = sy > 0 ? sy-3 : -sy
    # When length or side is left above the TONBI_DRAWRANGE tile,
    if abs_sx > TONBI_DRAWRANGEX or abs_sy > TONBI_DRAWRANGEY
      # It makes sprite non renewal
      $onscreen[@id]=false
    else
      # There is sprite renewal and does
      $onscreen[@id]=true
    end
    # Original Call
    update_tonbi1
  end
end
 
 
 
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================
 
class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character_sprites
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------  
  def initialize
    
    #########################################################
    # Modification:  New 'onscreen' array
    #
    $onscreen = []
    #########################################################
    
    # Make viewports
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport2.z = 200
    @viewport3.z = 5000
    # Make tilemap
    @tilemap = Tilemap.new(@viewport1)
    @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
    end
    @tilemap.map_data = $game_map.data
    @tilemap.priorities = $game_map.priorities
    # Make panorama plane
    @panorama = Plane.new(@viewport1)
    @panorama.z = -1000
    # Make fog plane
    @fog = Plane.new(@viewport1)
    @fog.z = 3000
    
    #########################################################
    # Modification  Party Sprite array/routines and $onscreen
    #               values were added.
    #               @party_sprites.push now substitutes for 
    #               the original @character_sprites.push line.
    #
    # Drawing up character sprite
    @character_sprites = []
    @party_sprites = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites[i]=sprite
      $onscreen[i] = true
    end
    @party_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    #########################################################
    
    # Make weather
    @weather = RPG::Weather.new(@viewport1)
    # Make picture sprites
    @picture_sprites = []
    for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport2, 
        $game_screen.pictures[i]))
    end
    # Make timer sprite
    @timer_sprite = Sprite_Timer.new
    # Frame update
    update
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Dispose of tilemap
    @tilemap.tileset.dispose
    for i in 0..6
      @tilemap.autotiles[i].dispose
    end
    @tilemap.dispose
    # Dispose of panorama plane
    @panorama.dispose
    # Dispose of fog plane
    @fog.dispose
    
    ############################################################
    # Modification  Different method for disposing of character
    #               sprites and the new party sprites. Will not
    #               dispose of sprite if sprite value is 'nil'.
    #               System added to prevent crashes.
    #
    # Dispose of character sprites
    for i in @character_sprites
      i.dispose if i != nil
    end
    # Dispose of party sprites
    for i in @party_sprites
      i.dispose if i != nil
    end
    ############################################################
   
    # Dispose of weather
    @weather.dispose
    # Dispose of picture sprites
    for sprite in @picture_sprites
      sprite.dispose
    end
    # Dispose of timer sprite
    @timer_sprite.dispose
    # Dispose of viewports
    @viewport1.dispose
    @viewport2.dispose
    @viewport3.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    refresh_token if $game_map.need_refresh_token #===============================
    # If panorama is different from current one
    if @panorama_name != $game_map.panorama_name or
       @panorama_hue != $game_map.panorama_hue
      @panorama_name = $game_map.panorama_name
      @panorama_hue = $game_map.panorama_hue
      if @panorama.bitmap != nil
        @panorama.bitmap.dispose
        @panorama.bitmap = nil
      end
      if @panorama_name != ""
        @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
      end
      Graphics.frame_reset
    end
    # If fog is different from current fog
    if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
      @fog_name = $game_map.fog_name
      @fog_hue = $game_map.fog_hue
      if @fog.bitmap != nil
        @fog.bitmap.dispose
        @fog.bitmap = nil
      end
      if @fog_name != ""
        @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
      end
      Graphics.frame_reset
    end
    # Update tilemap
    @tilemap.ox = $game_map.display_x / 4
    @tilemap.oy = $game_map.display_y / 4
    @tilemap.update
    # Update panorama plane
    @panorama.ox = $game_map.display_x / 8
    @panorama.oy = $game_map.display_y / 8
    # Update fog plane
    @fog.zoom_x = $game_map.fog_zoom / 100.0
    @fog.zoom_y = $game_map.fog_zoom / 100.0
    @fog.opacity = $game_map.fog_opacity
    @fog.blend_type = $game_map.fog_blend_type
    @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
    @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    @fog.tone = $game_map.fog_tone
    
    ############################################################
    # Modification  Different method for refresh the character
    #               sprites and the new party sprites. Refresh
    #               the sprites if outside the visual range as
    #               defined with the TONBI_DRAWRANGEX and the
    #               TONBI_DRAWRANGEY values.
    #
    #========================================================================
    # Update character sprites
    for i in @character_sprites
      i.update if !i.nil?
    end
    # Update character sprites
  #  for i in $game_map.events.keys
  #    @character_sprites[i].update if $onscreen[i] and !@character_sprites[i].nil?
  #  end
    # Update party sprites
    for i in @party_sprites
      i.update
    end   
  
    #####################################################
    
    # Update weather graphic
    @weather.type = $game_screen.weather_type
    @weather.max = $game_screen.weather_max
    @weather.ox = $game_map.display_x / 4
    @weather.oy = $game_map.display_y / 4
    @weather.update
    # Update picture sprites
    for sprite in @picture_sprites
      sprite.update
    end
    # Update timer sprite
    @timer_sprite.update
    # Set screen color tone and shake position
    @viewport1.tone = $game_screen.tone
    @viewport1.ox = $game_screen.shake
    # Set screen flash color
    @viewport3.color = $game_screen.flash_color
    # Update viewports
    @viewport1.update
    @viewport3.update
  end
end
 
 
 
#==============================================================================
# ** Fukuyama's Train-Actor modification
#==============================================================================
if TONBI_USE_TRAIN_ACTOR == true
  module Train_Actor
    module Spriteset_Map_Module
      def setup_actor_character_sprites(characters)
        if !setup_actor_character_sprites?
          for character in characters.reverse
            @party_sprites.unshift(
              Sprite_Character.new(@viewport1, character)
            )
          end
          @setup_actor_character_sprites_flag = true
        end
      end
    end
  end
end
 
 
 
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
 
class Game_Map
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  def setup(map_id)
    # Put map ID in @map_id memory
    @map_id = map_id
    # Load map from file and set @map
    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
    # set tile set information in opening instance variables
    tileset = $data_tilesets[@map.tileset_id]
    @tileset_name = tileset.tileset_name
    @autotile_names = tileset.autotile_names
    @panorama_name = tileset.panorama_name
    @panorama_hue = tileset.panorama_hue
    @fog_name = tileset.fog_name
    @fog_hue = tileset.fog_hue
    @fog_opacity = tileset.fog_opacity
    @fog_blend_type = tileset.fog_blend_type
    @fog_zoom = tileset.fog_zoom
    @fog_sx = tileset.fog_sx
    @fog_sy = tileset.fog_sy
    @battleback_name = tileset.battleback_name
    @passages = tileset.passages
    @priorities = tileset.priorities
    @terrain_tags = tileset.terrain_tags
    # Initialize displayed coordinates
    @display_x = 0
    @display_y = 0
    
    #########################################################
    # Modification:  New routine to check for 'special' maps
    #
    check_special_map 
    #########################################################
    
    # Clear refresh request flag
    @need_refresh = false
    # Set map event data
    @events = {}
    for i in @map.events.keys
      @events[i] = Game_Event.new(@map_id, @map.events[i])
    end
    # Set common event data
    @common_events = {}
    for i in 1...$data_common_events.size
      @common_events[i] = Game_CommonEvent.new(i)
    end
    # Initialize all fog information
    @fog_ox = 0
    @fog_oy = 0
    @fog_tone = Tone.new(0, 0, 0, 0)
    @fog_tone_target = Tone.new(0, 0, 0, 0)
    @fog_tone_duration = 0
    @fog_opacity_duration = 0
    @fog_opacity_target = 0
    # Initialize scroll information
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
  end
  #--------------------------------------------------------------------------
  # * Check Special Maps
  #--------------------------------------------------------------------------
  def check_special_map
    # Get Map Information
    mapinfo  = load_data("Data/MapInfos.rxdata")
    # If the 'subname' of map is "Random"
    if mapinfo[@map_id].subname == "Random"      
      if mapinfo[@map_id].subname(3)=="" or mapinfo[@map_id].subname(3) == nil
        p3 = 0
      else
        p3 = mapinfo[@map_id].subname(3).to_i
      end
      if mapinfo[@map_id].subname(4)=="false"
        p4 = false
      end
      make_random_map(2, mapinfo[@map_id].subname(2).to_i, p3, p4)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw the Random Map
  #     wall = Height of wall >> At present time it is invalid
  #     type = Wall production type >> Only 0 making, increases is (also sweat designation method is undecided
  #     thoughplayer = Also does the player include to the relay point??
  #     connect = How to tie the relay point >> true= Continuation false=Independence 2 at a time
  #
  #    * Also it is possible to throw to business under all argument omitting,
  #     ex. make_random_map(2,0,,true)
  #--------------------------------------------------------------------------
  def make_random_map(wall = 2, type = 0, objcnt = 0, connect = true)
    # The measure of parameter abnormality
    wall = 0 if wall == nil
    type = 0 if type == nil
    objcnt = 0 if objcnt == nil
    unless objcnt.is_a?(Numeric)
      objcnt = 0
    end
    if objcnt < 0
      objcnt = 0
    end
    connect = true if connect != false
    # Height data array
    @heightdata = Table.new(@map.width,@map.height)
    # Topographical data array
    @maskdata = Table.new(@map.width,@map.height)
    # Arrangement data array such as event
    @oneventdata = Table.new(@map.width,@map.height)
    # Mask setting data array
    @masksetting = []
    # Production methodological data
    @makedata = []
    # Operation methodological initialization
    @targettype=0
    @chgtype=0
    time = -1
    # Each data initialization
    for i in 0...@map.width
      for j in 0...@map.height
        time += 1
        if time%2000 == 0
          Graphics.update
        end
        @heightdata[i,j] = 0
        @maskdata[i,j] = 0
      end
    end
    for i in 0...100
      @masksetting[i] = true
    end
    # Relay point information acquisition
    needposx = []
    needposy = []
    # Adding event the “relay point”
    for i in @map.events.keys.sort
      time += 1
      if time%200 == 0
        Graphics.update
      end
      if event_settype(i) == 1
        if connect == true
          needposx.push(@map.events[i].x)
          needposy.push(@map.events[i].y)
          needposx.push(@map.events[i].x)
          needposy.push(@map.events[i].y)
        else
          needposx.push(@map.events[i].x)
          needposy.push(@map.events[i].y)
        end
      end
    end
    if connect == true
      needposx.shift
      needposy.shift
    end
    loop do
      if needposx.size <= 2
        needposx.push(rand(@map.width))
        needposy.push(rand(@map.height))
      else
        break
      end
    end
    # The production methodological data is set here
    case type
    when 0
      # Type 0  >> 2 layer natural type
      @makedata.push([0,1,0])
      @makedata.push([5,1])
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,0,-15,4,0])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,0,needposx[i*2],needposy[i*2]])
        @makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
      end
      @makedata.push([4,0,1,1,1])
      @makedata.push([4,0,1,1,1])
      @makedata.push([4,1,1,1,1])
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,0])
      @makedata.push([2,1,2])
      @makedata.push([5,1])
    when 1
      # Type 1 >> 2 layer artificial type
      @makedata.push([0,1,0])
      @makedata.push([5,1])
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,0,-6,4,1,10])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,0,needposx[i*2],needposy[i*2]])
        @makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
      end
      @makedata.push([4,0,2,3,1])
      @makedata.push([4,1,2,2,1])
      @makedata.push([4,0,1,1,1])
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,0])
      @makedata.push([2,1,2])
      @makedata.push([5,1])
    when 2
      # Type 2 >> 2 layer natural convex type
      @makedata.push([0,1,0])
      @makedata.push([5,1])
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,0,-15,4,0])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,0,needposx[i*2],needposy[i*2]])
        @makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
      end
      @makedata.push([4,0,2,2,1])
      @makedata.push([4,1,1,1,1])
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,0])
      @makedata.push([2,1,2])
      @makedata.push([5,-1])
    when 3
      # Type 2 >> 2 layer artificial convex type
      @makedata.push([0,1,0])
      @makedata.push([5,1])
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,0,-15,4,1,10])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,0,needposx[i*2],needposy[i*2]])
        @makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
      end
      @makedata.push([4,0,2,2,1])
      @makedata.push([4,1,1,1,1])
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,0])
      @makedata.push([2,1,2])
      @makedata.push([5,-1])
    when 4
      # Type 4 >> 2 layer natural type that 1
      # Topography [0:Hole 1:Land 2:Wall]
      # Basic setting
      @makedata.push([0,1,0])
      @makedata.push([5,0])
      # The wall is put in place
      @makedata.push([1,0,0,-1,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,0,-1,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,-1,0,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,0,-1,0,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([4,2,2,2,1])
      # The hole is put in place with random
      for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
        @makedata.push([1,3,3,8,8])
        @makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
      end
      # Around wall compilation
      @makedata.push([7,2])
      @makedata.push([4,2,1,1,1])
      # Road compilation
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,1,-8,4,0,5])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,1,needposx[i*2],needposy[i*2]])
        @makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
      end
      # Expansion processing
      @makedata.push([4,1,1,1,1])
      @makedata.push([4,1,0,1,1])
      @makedata.push([2,0,0])
      @makedata.push([4,1,1,0,1])
      @makedata.push([2,-1,1])
      @makedata.push([4,2,1,1,1])
      # Height setting
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,-1])
      @makedata.push([2,1,2])
      @makedata.push([5,0])
      @makedata.push([2,2,2])
      @makedata.push([5,1])
    when 5
      # Type 5 >> 2 layer artificial type that 1
      # Topography[0:Hole 1:Land 2:Wall]
      # Basic setting
      @makedata.push([0,1,0])
      @makedata.push([5,0])
      # The wall is put in place
      @makedata.push([1,0,0,-1,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,0,-1,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,-1,0,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,0,-1,0,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([4,2,2,2,1])
      # The hole is put in place with random
      for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
        @makedata.push([1,3,3,8,8])
        @makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
      end
      # Around wall compilation
      @makedata.push([7,2])
      @makedata.push([4,2,1,1,1])
      # Road compilation
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,1,-8,4,1,5])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,1,needposx[i*2],needposy[i*2]])
        @makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
      end
      # Expansion processing
      @makedata.push([4,1,1,1,1])
      @makedata.push([4,1,0,1,1])
      @makedata.push([2,0,0])
      @makedata.push([4,1,1,0,1])
      @makedata.push([2,-1,1])
      @makedata.push([4,2,1,1,1])
      # Height setting
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,-1])
      @makedata.push([2,1,2])
      @makedata.push([5,0])
      @makedata.push([2,2,2])
      @makedata.push([5,1])
    when 6
      # Type 6 >> 2 layer natural type that 2
      # Topography [0: Hole 1: Land 2: Wall]
      # Basic setting
      @makedata.push([0,1,0])
      @makedata.push([5,0])
      # The wall is put in place
      @makedata.push([1,0,0,-1,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,0,-1,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,-1,0,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,0,-1,0,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([4,2,2,2,1])
      # The wall is put in place
      for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
        @makedata.push([1,1,1,3,3])
        @makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
      end
      # Hole enlargement
      @makedata.push([4,0,2,2,0])
      @makedata.push([4,0,1,2,1])
      # Around wall compilation
      @makedata.push([7,2])
      @makedata.push([4,2,1,1,1])
      # Road compilation
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,1,-15,4,0,5])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,1,needposx[i*2],needposy[i*2]])
        @makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
      end
      # Expansion processing
      @makedata.push([4,1,1,1,1])
      @makedata.push([4,1,0,1,1])
      @makedata.push([2,0,0])
      @makedata.push([4,1,1,0,1])
      @makedata.push([2,-1,1])
      @makedata.push([4,2,1,1,1])
      # Height setting
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,-1])
      @makedata.push([2,1,2])
      @makedata.push([5,0])
      @makedata.push([2,2,2])
      @makedata.push([5,1])
    when 7
      # Type 7 >> 2 layer artificial type that 2
      # Topography [0: Hole 1: Land 2: Wall]
      # Basic setting
      @makedata.push([0,1,0])
      @makedata.push([5,0])
      # The wall is put in place
      @makedata.push([1,0,0,-1,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,0,-1,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,-1,-1,0,-1])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([1,0,-1,0,0])
      @makedata.push([3,2,-6,1,0])
      @makedata.push([4,2,2,2,1])
      # The hole is put in place with random
      for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
        @makedata.push([1,1,1,3,3])
        @makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
      end
      # Hole enlargement
      @makedata.push([4,0,2,2,0])
      @makedata.push([4,0,1,2,1])
      # Around wall compilation
      @makedata.push([7,2])
      @makedata.push([4,2,1,1,1])
      # Road compilation
      for i in 0...(needposx.size/2)
        @makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
        @makedata.push([3,1,-15,4,1,5])
        @makedata.push([1,1,1,1,1])
        @makedata.push([6,1,needposx[i*2],needposy[i*2]])
        @makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
      end
      # Expansion processing
      @makedata.push([4,1,1,1,1])
      @makedata.push([4,1,0,1,1])
      @makedata.push([2,0,0])
      @makedata.push([4,1,1,0,1])
      @makedata.push([2,-1,1])
      @makedata.push([4,2,1,1,1])
      # Height setting
      @makedata.push([0,0,0])
      @makedata.push([2,0,2])
      @makedata.push([5,-1])
      @makedata.push([2,1,2])
      @makedata.push([5,0])
      @makedata.push([2,2,2])
      @makedata.push([5,1])
    end



Posté dans Forum - [vx ace] Probleme de saut sous vx ace

Cortez - posté le 10/04/2013 à 13:42:07. (523 messages postés)

Pour un event commun avec les variables Pos X et Y.
Il faut que tu le places en processus parallèle activé par un interrupteur que tu actives par un event sur tes map.

Je viens de me rendre compte que lorsque tu paramètres un saut, si tu coche "ignorer la commande si impossible", le jeu calcule tout seul si la case d'arrivée est traversable ou non.
Donc t'as peut-être pas besoin de l'évent qui vérifie le saut.

Pour ce qui est de la chenille, certains script fond sauter les personnages suiveurs tout seul. Essaye-en plusieurs.

Posté dans Forum - [VX Ace] VX Ace - Sp1

Cortez - posté le 10/04/2013 à 11:11:25. (523 messages postés)

Avec un petit coup de Google trad c'est de suite plus clair ...
Ce script corrige les bug et problèmes des script de base du logiciel. Il est utile donc garde le.

Ce qu'il corrige :

Evenement
-> l'ajout d'un statut en double fesait échouer les deux en même temps.
-> Correction de la commande "ignorer le mouvement si impossible"

Animation
-> Afficher une animation sur la map fixe l'animation sur les coordonnées de la map. (teste avec et sans pour comprendre)

Combat
-> Correction de l'auto-combat qui ne sélectionnait pas bien les attaques.
-> Correction du status "Reflet magique" qui ne protège plus de l'altération "reflet magique".

Equipement
-> Correction de la commande déséquiper et équiper.

Images
-> Les images effacés ne sont plus conservée en mémoire (réduction du lag).

Menu
-> Correction des polices en italique et en gras.

Posté dans Forum - [XP] Déplacer un événement d'un bout à l'autre de la map en continu

Cortez - posté le 10/04/2013 à 10:46:21. (523 messages postés)

Meme pas besoin de faire tous ces truc de variable, si ta voiture ne rencontre aucun obstacle (héro, ou autre) et qu'elle se contente d'aller tout droit.

Il faut faire ça dans l'event de la voiture en processus parallèle


déplacer event X (vers la direction choisie)
cocher la case répéter le déplacement
et cocher la case ignorer si impossible.

juste après tu place une ligne

téléporter l'évent (cet event) vers la position X,Y (le début de la route)

Et c'est tout ... et en plus ça marche vraiment !

Idée originale : Joke's
Lien du tutoriel : http://www.rpg-maker.fr/tutoriels-182-joke-s-tuts-une-course-d-obstacle-en-un-seul-petit-evenement-simple-.html


Autre astuce pour XP,VX,VXace, lorsque tu fait un déplacement, tu ajoutes un attendre X frames après pour que les mouvements se fassent. Mais tu dois calculer la durée du mouvement.
Pour éviter cela met à la place un "tout déplacer" le jeu attendra la fin du déplacement précédent pour continuer.

Posté dans Forum - [vx ace] Probleme de saut sous vx ace

Cortez - posté le 09/04/2013 à 19:06:31. (523 messages postés)

Super encore un script ... c'est fesable en évent.

Dans la base de donnée :

Tu vas dans la gestion des tileset
Tu vas dans la gestion des Id de terrain
et tu met le chiffre 7 sur chaque case non traversable.

Sur la map :

Il faut créer un event vide et traversable.
Le placer en processus parallèle.
mettre les commandes suivantes :
rendre la variable X égale à id terrain de cet évent.

Ensuite dans ton event pour faire sauter le héro:

Juste avant de faire sauter le héro
Tu place l'évent que tu as crée sur la case actuelle du héro
tu fait sauter l'évent que tu as crée. (comme si c'était le joueur)
Puis tu place une contition,
si variable X = 7
Tu ne fait pas sauter le joueur (tu peux ajouter un bruit)
sinon
tu fait sauter le joueur et tu place l'évent à la case x=0,y=0
pour éviter qu'il gène au milieu.

Note : De mémoire je ne sais pas si Ace propose des Id de terrains. Du coup c'est pas forcément fesable sans aucun script. -> Foutu VXace, moins bien que rmXP et que rm2k3

Posté dans Forum - [RPG Maker 2003] Utilisation basique d'un variable

Cortez - posté le 09/04/2013 à 18:55:05. (523 messages postés)

En fait son soucis n'est pas sur ces connaissances en variables mais sur un soucis dans l'un des evenement du jeu.

J'ai eu le même problème sous 2003, il faut que tu vérifies tous tes évènements, l'un d'entre eux tourne en automatique et rend la variable égale à 4.

Il faut juste trouver l'évènement en question et effacer la ligne qui modifie la variable.

Après cette astuce est ultra utile et je te conseille tout de même les tutos de joke's pour maitriser les variables.

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

Cortez - posté le 09/04/2013 à 18:47:37. (523 messages postés)

Demande d'aide pour syntaxe

Je suis en train d'apprendre quelques truc en ruby, notamment la traduction en script des commandes d'évènement. Je lis donc les script interpreter 1-7 et je trouve dans le numéro 5 une ligne un peu compliquée :

Portion de code : Tout sélectionner

1
2
3
# Show picture
    $game_screen.pictures[number].show(@parameters[1], @parameters[2],
      x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])



Je voudrais savoir à quoi renvoie les nombreux "parameters"
ainsi que leur syntaxe et les valeur qu'il peuvent prendre (true/false, suite de mot, nombres, nom de fichier.)

Puisque dans l'idéal j'aimerais afficher une image selon un chiffre stocké dans une variable.
Exemple V[2] = 3 on affiche en image 1, l'image du nom de 3.png
si V[2] = 9 on affiche en image 1, l'image du nom de 9.png

Posté dans Forum - Questions idiotes sur RM [PAS Script]

Cortez - posté le 26/03/2013 à 15:02:40. (523 messages postés)

Je profite de la demande précédente pour rebondir.
J'ai trouvé un petit script qui fait mieux :

A placer au dessus de main :
La ligne SPEED = 3 indique la vitesse.
- 0 autotiles non animés
- 1 vitesse normale
- 2 vitesse doublée
- ...
- (-2) vitesse 2 fois plus lente
- ...

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Tilemap
  SPEED = 3
  alias drow_autotiles_speed_update update
  def update
    if SPEED >= 0
      SPEED.times{drow_autotiles_speed_update}
    else
      @counter ||= 0
      @counter += 1
      if @counter >= SPEED.abs
        @counter = 0
        drow_autotiles_speed_update
      end
    end
  end
end



Cependant la vitesse est fixée pour tous les autotiles.

Alors que le script suivant, ajuste la vitesse des autotiles en fonction de leur longueur (nbr de frames) et on peut utiliser des autotiles de 32 pixels de haut (comme dans rm2003.)
Ligne 35 tu peux changer la vitesse en frames des autotiles (15 c'est pas mal)

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
#==============================================================================
# ** poccil's Tilemap Rewrite
#------------------------------------------------------------------------------
# By: poccil
#  http://www.hbgames.org/forums/viewtopic.php?f=11&t=37433&start=2
# 
# minor edit and Comment additions by Draycos Goldaryn
#==============================================================================
#==============================================================================
# ** Custom Tilemap Autotiles
#------------------------------------------------------------------------------
#  This class handles the autotiles
#==============================================================================
class CustomTilemapAutotiles
  attr_accessor :changed
  def initialize
   @changed=true
   @tiles=[nil,nil,nil,nil,nil,nil,nil]
  end
  def []=(i,value)
   @tiles[i]=value
   @changed=true
  end
  def [](i)
   return @tiles[i]
  end
end
 
#==============================================================================
# ** Tilemap (hidden class)
#------------------------------------------------------------------------------
#  This class handles the map data to screen processing
#==============================================================================
class Tilemap
  Animated_Autotiles_Frames = 15 #60
  Autotiles = [
    [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27,  6, 33, 34], [ 5,  6, 33, 34],
      [27, 28, 33, 12], [ 5, 28, 33, 12], [27,  6, 33, 12], [ 5,  6, 33, 12] ],
    [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27,  6, 11, 34], [ 5,  6, 11, 34],
      [27, 28, 11, 12], [ 5, 28, 11, 12], [27,  6, 11, 12], [ 5,  6, 11, 12] ],
    [ [25, 26, 31, 32], [25,  6, 31, 32], [25, 26, 31, 12], [25,  6, 31, 12],
      [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
    [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
      [39, 40, 45, 46], [ 5, 40, 45, 46], [39,  6, 45, 46], [ 5,  6, 45, 46] ],
    [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
      [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
    [ [37, 38, 43, 44], [37,  6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
      [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1,  2,  7,  8] ]
  ]
  FlashOpacity=[100,90,80,70,80,90]
  attr_reader :tileset
  attr_reader :autotiles
  attr_reader :map_data
  attr_accessor :flash_data
  attr_accessor :priorities
  attr_reader :visible
  attr_accessor :ox
  attr_accessor :oy
  attr_reader :viewport
  def initialize(viewport)
    @tileset    = nil  # Refers to Map Tileset Name
    @autotiles  = CustomTilemapAutotiles.new
    @map_data   = nil  # Refers to 3D Array Of Tile Settings
    @flash_data = nil  # Refers to 3D Array of Tile Flashdata
    @priorities = nil  # Refers to Tileset Priorities
    @visible    = true # Refers to Tileset Visibleness
    @ox         = 0    # Bitmap Offsets
    @oy         = 0    # bitmap Offsets
    @plane       = false
    #this line is edited from the original
#    @selfviewport=Viewport.new(0,0,Game_Window.width,Game_Window.height)
    @viewport=viewport ? viewport : @selfviewport
    @tiles=[]
    @autotileInfo=[]
    @regularTileInfo=[]
    @oldOx=0
    @oldOy=0
    @layer0=Sprite.new(viewport)
    @layer0.visible=true
    @nowshown=false
    @layer0.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
    @flash=nil
    @layer0.ox=0
    @layer0.oy=0
    @oxLayer0=0
    @oyLayer0=0
    @oxFlash=0
    @oyFlash=0
    @layer0.z=0
    @priotiles=[]
    @prioautotiles=[]
    @autosprites=[]
    @framecount=[]
    @tilesetChanged=true
    @flashChanged=false
    @firsttime=true
    @disposed=false
    @usedsprites=false
    @layer0clip=true
    @firsttimeflash=true
    @fullyrefreshed=false
    @fullyrefreshedautos=false
  end
  def disposed?
   return @disposed
  end
  def flash_data=(value)
   @flash_data=value
   @flashChanged=true  
  end
  def update
    if @autotiles.changed
      refresh_autotiles
      repaintAutotiles
    end
    if @flashChanged
      refresh_flash
    end
    if @tilesetChanged
      refresh_tileset
    end
    if @flash
     @flash.opacity=FlashOpacity[(Graphics.frame_count/2) % 6]
    end
    if !(@oldOx==@ox && @oldOy==@oy &&
           !@tilesetChanged &&
           !@autotiles.changed)
      refresh
    end
    if (Graphics.frame_count % Animated_Autotiles_Frames == 0) || @nowshown
      repaintAutotiles
      refresh(true)
    end
    @nowshown=false
    @autotiles.changed=false
    @tilesetChanged=false
  end
def priorities=(value)
  @priorities=value
  @tilesetChanged=true
end
def tileset=(value)
  @tileset=value
  @tilesetChanged=true
end
def shown?
   return false if !@visible
   ysize=@map_data.ysize
   xsize=@map_data.xsize
   xStart=(@ox/32)-1
   xEnd=((@ox+@viewport.rect.width)/32)+1
   yStart=(@oy/32)-1
   yEnd=((@oy+@viewport.rect.height)/32)+1
   xStart=0 if xStart<0
   xStart=xsize-1 if xStart>=xsize
   xEnd=0 if xEnd<0
   xEnd=xsize-1 if xEnd>=xsize
   yStart=0 if yStart<0
   yStart=ysize-1 if yStart>=ysize
   yEnd=0 if yEnd<0
   yEnd=ysize-1 if yEnd>=ysize
   return (xStart<xEnd && yStart<yEnd)
end
def dispose
return if disposed?
@help.dispose if @help
@help=nil
i=0;len=@autotileInfo.length;while i<len
  if @autotileInfo[i]
     @autotileInfo[i].dispose
     @autotileInfo[i]=nil
  end
  i+=1
end
i=0;len=@regularTileInfo.length;while i<len
  if @regularTileInfo[i]
     @regularTileInfo[i].dispose
     @regularTileInfo[i]=nil
  end
  i+=1
end
i=0;len=@tiles.length;while i<len
  @tiles[i].dispose
  @tiles[i]=nil
  i+=2
end
i=0;len=@autosprites.length;while i<len
  @autosprites[i].dispose
  @autosprites[i]=nil
  i+=2
end
if @layer0
  @layer0.bitmap.dispose if !@layer0.disposed?
  @layer0.bitmap=nil if !@layer0.disposed?
  @layer0.dispose
  @layer0=nil
end
if @flash
  @flash.bitmap.dispose if !@flash.disposed?
  @flash.bitmap=nil if !@flash.disposed?
  @flash.dispose
  @flash=nil
end
for i in 0...7
  self.autotiles[i]=nil
end
@tiles.clear
@autosprites.clear
@autotileInfo.clear
@regularTileInfo.clear
@tilemap=nil
@tileset=nil
@priorities=nil
@selfviewport.dispose
@selfviewport=nil
@disposed=true
end
 
def bltAutotile(bitmap,x,y,id,frame)
  return if frame<0
  autotile=@autotiles[id/48-1]
  return if !autotile
  if autotile.height==32
    anim=frame*32
    src_rect=Rect.new(anim,0,32,32)
    bitmap.blt(x,y,autotile,src_rect)
  else
    anim=frame*96
    id%=48
    tiles = Autotiles[id>>3][id&7]
    src=Rect.new(0,0,0,0)
    for i in 0...4
      tile_position = tiles[i] - 1
      src.set(tile_position % 6 * 16 + anim,
       tile_position / 6 * 16, 16, 16)
      bitmap.blt(i%2*16+x,i/2*16+y, autotile, src)
    end
  end
end
 
def autotileNumFrames(id)
  autotile=@autotiles[id/48-1]
  return 0 if !autotile || autotile.disposed?
  frames=1
  if autotile.height==32
   frames=autotile.width/32
  else
   frames=autotile.width/96
  end
  return frames
end
 
def autotileFrame(id)
  autotile=@autotiles[id/48-1]
  return -1 if !autotile || autotile.disposed?
  frames=1
  if autotile.height==32
   frames=autotile.width/32
  else
   frames=autotile.width/96
  end
  return (Graphics.frame_count/Animated_Autotiles_Frames)%frames
end
 
def repaintAutotiles
for i in 0...@autotileInfo.length
  next if !@autotileInfo[i]
  frame=autotileFrame(i)
  bltAutotile(@autotileInfo[i],0,0,i,frame)
end
end
 
def getAutotile(sprite,id)
  anim=autotileFrame(id)
  return if anim<0
  bitmap=@autotileInfo[id]
  if !bitmap
    bitmap=Bitmap.new(32,32)
    bltAutotile(bitmap,0,0,id,anim)
    @autotileInfo[id]=bitmap
  end
  sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
end
 
def getRegularTile(sprite,id)
if false
  sprite.bitmap=@tileset if !sprite.equal?(@tileset) || sprite.bitmap!=@tileset
  sprite.src_rect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
else
  bitmap=@regularTileInfo[id]
  if !bitmap
   bitmap=Bitmap.new(32,32)
   rect=Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
   bitmap.blt(0,0,@tileset,rect)
   @regularTileInfo[id]=bitmap
  end
  sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
end
end
 
def addTile(tiles,count,xpos,ypos,id)
   if id>=384
     if count>=tiles.length
      sprite=Sprite.new(@viewport)
      tiles.push(sprite,0)
     else
      sprite=tiles[count]
      tiles[count+1]=0
     end
     sprite.visible=@visible
     sprite.x=xpos
     sprite.y=ypos
     getRegularTile(sprite,id)
     spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
     sprite.z=spriteZ
     count+=2
   else
     if count>=tiles.length
      sprite=Sprite.new(@viewport)
      tiles.push(sprite,1)
     else
      sprite=tiles[count]
      tiles[count+1]=1
     end
     sprite.visible=@visible
     sprite.x=xpos
     sprite.y=ypos
     getAutotile(sprite,id)
     spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
     sprite.z=spriteZ
     count+=2
   end
   return count
end
 
def refresh_tileset
i=0;len=@regularTileInfo.length;while i<len
  if @regularTileInfo[i]
     @regularTileInfo[i].dispose
     @regularTileInfo[i]=nil
  end
  i+=1
end
@regularTileInfo.clear
@priotiles.clear
ysize=@map_data.ysize
xsize=@map_data.xsize
zsize=@map_data.zsize
if xsize>100 || ysize>100
  @fullyrefreshed=false
else
  for z in 0...zsize
   for y in 0...ysize
    for x in 0...xsize
     id = @map_data[x, y, z]
     next if id==0 || !@priorities[id]
     next if @priorities[id]==0
     @priotiles.push([x,y,z,id])
    end
   end
  end
  @fullyrefreshed=true
end
end
 
def refresh_flash
if @flash_data && !@flash
  @flash=Sprite.new(viewport)
  @flash.visible=true
  @flash.z=1
  @flash.blend_type=1
  @flash.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
  @firsttimeflash=true
elsif !@flash_data && @flash
  @flash.bitmap.dispose if @flash.bitmap
  @flash.dispose
  @flash=nil
  @firsttimeflash=false
end
end
 
def refresh_autotiles
i=0;len=@autotileInfo.length;while i<len
  if @autotileInfo[i]
     @autotileInfo[i].dispose
     @autotileInfo[i]=nil
  end
  i+=1
end
i=0;len=@autosprites.length;while i<len
  if @autosprites[i]
     @autosprites[i].dispose
     @autosprites[i]=nil
  end
  i+=2
end
@autosprites.clear
@autotileInfo.clear
@prioautotiles.clear
hasanimated=false
for i in 0...7
  numframes=autotileNumFrames(48*(i+1))
  hasanimated=true if numframes>=2
  @framecount[i]=numframes
end
if hasanimated
  ysize=@map_data.ysize
  xsize=@map_data.xsize
  zsize=@map_data.zsize
  if xsize>100 || ysize>100
    @fullyrefreshedautos=false
  else
    for y in 0...ysize
     for x in 0...xsize
      haveautotile=false
      for z in 0...zsize
       id = @map_data[x, y, z]
       next if id==0 || id>=384 || @priorities[id]!=0 || !@priorities[id]
       next if @framecount[id/48-1]<2
       haveautotile=true
       break
      end
      @prioautotiles.push([x,y]) if haveautotile
     end
    end
    @fullyrefreshedautos=true
  end
else
  @fullyrefreshedautos=true
end
end
 
def map_data=(value)
@map_data=value
@tilesetChanged=true
end
 
def refreshFlashSprite
return if !@flash || @flash_data.nil?
ptX=@ox-@oxFlash
ptY=@oy-@oyFlash
if !@firsttimeflash && !@usedsprites &&
    ptX>=0 && ptX+@viewport.rect.width<=@flash.bitmap.width &&
    ptY>=0 && ptY+@viewport.rect.height<=@flash.bitmap.height
  @flash.ox=0
  @flash.oy=0
  @flash.src_rect.set(ptX.round,ptY.round,
     @viewport.rect.width,@viewport.rect.height)
  return
end
width=@flash.bitmap.width
height=@flash.bitmap.height
bitmap=@flash.bitmap
ysize=@map_data.ysize
xsize=@map_data.xsize
zsize=@map_data.zsize
@firsttimeflash=false
@oxFlash=@ox-(width>>2)
@oyFlash=@oy-(height>>2)
@flash.ox=0
@flash.oy=0
@flash.src_rect.set(width>>2,height>>2,
     @viewport.rect.width,@viewport.rect.height)
@flash.bitmap.clear
@oxFlash=@oxFlash.floor
@oyFlash=@oyFlash.floor
xStart=(@oxFlash>>5)
xStart=0 if xStart<0
yStart=(@oyFlash>>5)
yStart=0 if yStart<0
xEnd=xStart+(width>>5)+1
yEnd=yStart+(height>>5)+1
xEnd=xsize if xEnd>=xsize
yEnd=ysize if yEnd>=ysize
if xStart<xEnd && yStart<yEnd
  yrange=yStart...yEnd
  xrange=xStart...xEnd
  tmpcolor=Color.new(0,0,0,0)
  for y in yrange
   ypos=(y<<5)-@oyFlash
   for x in xrange
     xpos=(x<<5)-@oxFlash
     id = @flash_data[x, y, 0]
     r=(id>>8)&15
     g=(id>>4)&15
     b=(id)&15
     tmpcolor.set(r*16,g*16,b*16)
     bitmap.fill_rect(xpos,ypos,32,32,tmpcolor)
   end
  end
end
end
 
 
def refreshLayer0(autotiles=false)
ptX=@ox-@oxLayer0
ptY=@oy-@oyLayer0
if !autotiles && !@firsttime && !@usedsprites &&
    ptX>=0 && ptX+@viewport.rect.width<=@layer0.bitmap.width &&
    ptY>=0 && ptY+@viewport.rect.height<=@layer0.bitmap.height
  if @layer0clip
   @layer0.ox=0
   @layer0.oy=0
   @layer0.src_rect.set(ptX.round,ptY.round,
     @viewport.rect.width,@viewport.rect.height)
  else
   @layer0.ox=ptX.round
   @layer0.oy=ptY.round
   @layer0.src_rect.set(0,0,@layer0.bitmap.width,@layer0.bitmap.height)
  end
  return true
end
width=@layer0.bitmap.width
height=@layer0.bitmap.height
bitmap=@layer0.bitmap
ysize=@map_data.ysize
xsize=@map_data.xsize
zsize=@map_data.zsize
if autotiles
  return true if @fullyrefreshedautos && @prioautotiles.length==0
  return true if !shown?
  xStart=(@oxLayer0>>5)
  xStart=0 if xStart<0
  yStart=(@oyLayer0>>5)
  yStart=0 if yStart<0
  xEnd=xStart+(width>>5)+1
  yEnd=yStart+(height>>5)+1
  xEnd=xsize if xEnd>xsize
  yEnd=ysize if yEnd>ysize
  return true if xStart>=xEnd || yStart>=yEnd
  trans=Color.new(0,0,0,0)
  temprect=Rect.new(0,0,0,0)
  tilerect=Rect.new(0,0,32,32)
  range=0...zsize
  overallcount=0
  count=0
  if !@fullyrefreshedautos
   for y in yStart..yEnd
    for x in xStart..xEnd
     haveautotile=false
     for z in range
      id = @map_data[x, y, z]
      next if id<48 || id>=384 || @priorities[id]!=0 || !@priorities[id]
      next if @framecount[id/48-1]<2
      haveautotile=true
      break
     end
     next if !haveautotile
     overallcount+=1
     xpos=(x<<5)-@oxLayer0
     ypos=(y<<5)-@oyLayer0
     bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
     for z in range
      id = @map_data[x,y,z]
      next if id<48 || @priorities[id]!=0 || !@priorities[id]
      if overallcount>2000
       count=addTile(@autosprites,count,xpos,ypos,id)
       next
      elsif id>=384
       temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
       bitmap.blt(xpos,ypos,@tileset,temprect)
      else
       tilebitmap=@autotileInfo[id]
       if !tilebitmap
        anim=autotileFrame(id)
        next if anim<0
        tilebitmap=Bitmap.new(32,32)
        bltAutotile(tilebitmap,0,0,id,anim)
        @autotileInfo[id]=tilebitmap
       end
       bitmap.blt(xpos,ypos,tilebitmap,tilerect)
      end
     end
    end
   end
  else
   for tile in @prioautotiles
    x=tile[0]
    y=tile[1]
    next if x<xStart||x>xEnd
    next if y<yStart||y>yEnd
    overallcount+=1
    xpos=(x<<5)-@oxLayer0
    ypos=(y<<5)-@oyLayer0
    bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
    for z in range
     id = @map_data[x,y,z]
     next if id<48 || @priorities[id]!=0 || !@priorities[id]
     if overallcount>2000
      count=addTile(@autosprites,count,xpos,ypos,id)
      next
     elsif id>=384
      temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
      bitmap.blt(xpos,ypos,@tileset,temprect)
     else
      tilebitmap=@autotileInfo[id]
      if !tilebitmap
        anim=autotileFrame(id)
        next if anim<0
        tilebitmap=Bitmap.new(32,32)
        bltAutotile(tilebitmap,0,0,id,anim)
        @autotileInfo[id]=tilebitmap
      end
      bitmap.blt(xpos,ypos,tilebitmap,tilerect)
     end
    end
   end
  end
  Graphics.frame_reset if overallcount>2000
  @usedsprites=false
  return true
end
return false if @usedsprites
@firsttime=false
@oxLayer0=@ox-(width>>2)
@oyLayer0=@oy-(height>>2)
if @layer0clip
  @layer0.ox=0
  @layer0.oy=0
  @layer0.src_rect.set(width>>2,height>>2,
     @viewport.rect.width,@viewport.rect.height)
else
  @layer0.ox=(width>>2)
  @layer0.oy=(height>>2)
end
@layer0.bitmap.clear
@oxLayer0=@oxLayer0.floor
@oyLayer0=@oyLayer0.floor
xStart=(@oxLayer0>>5)
xStart=0 if xStart<0
yStart=(@oyLayer0>>5)
yStart=0 if yStart<0
xEnd=xStart+(width>>5)+1
yEnd=yStart+(height>>5)+1
xEnd=xsize if xEnd>=xsize
yEnd=ysize if yEnd>=ysize
if xStart<xEnd && yStart<yEnd
  tmprect=Rect.new(0,0,0,0)
  yrange=yStart...yEnd
  xrange=xStart...xEnd
  for z in 0...zsize
   for y in yrange
    ypos=(y<<5)-@oyLayer0
    for x in xrange
     xpos=(x<<5)-@oxLayer0
     id = @map_data[x, y, z]
     next if id==0 || @priorities[id]!=0 || !@priorities[id]
     if id>=384
       tmprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
       bitmap.blt(xpos,ypos,@tileset,tmprect)
     else
       frame=autotileFrame(id)
       bltAutotile(bitmap,xpos,ypos,id,frame)
     end
    end
   end
  end
  Graphics.frame_reset
end
return true
end
def getResizeFactor
  return $ResizeFactor ? $ResizeFactor : 1.0
end
def ox=(val)
   val=(val*getResizeFactor).to_i
   val=(val/getResizeFactor).to_i
   wasshown=self.shown?
   @ox=val.floor
   @nowshown=(!wasshown && self.shown?)
end
def oy=(val)
   val=(val*getResizeFactor).to_i
   val=(val/getResizeFactor).to_i
   wasshown=self.shown?
   @oy=val.floor
   @nowshown=(!wasshown && self.shown?)
end
def visible=(val)
   wasshown=@visible
   @visible=val
   @nowshown=(!wasshown && val)
end
def refresh(autotiles=false)
@oldOx=@ox
@oldOy=@oy
usesprites=false
if @layer0
  @layer0.visible=@visible
  usesprites=!refreshLayer0(autotiles)
  if autotiles && !usesprites
   return
  end
else
  usesprites=true
end
refreshFlashSprite
vpx=@viewport.rect.x
vpy=@viewport.rect.y
vpr=@viewport.rect.width+vpx
vpb=@viewport.rect.height+vpy
xsize=@map_data.xsize
ysize=@map_data.ysize
minX=(@ox/32)-1
maxX=((@ox+@viewport.rect.width)/32)+1
minY=(@oy/32)-1
maxY=((@oy+@viewport.rect.height)/32)+1
minX=0 if minX<0
minX=xsize-1 if minX>=xsize
maxX=0 if maxX<0
maxX=xsize-1 if maxX>=xsize
minY=0 if minY<0
minY=ysize-1 if minY>=ysize
maxY=0 if maxY<0
maxY=ysize-1 if maxY>=ysize
count=0
if minX<maxX && minY<maxY
  @usedsprites=usesprites || @usedsprites
  if @layer0
   @layer0.visible=false if usesprites
  end
  if @fullyrefreshed
   for prio in @priotiles
    next if prio[0]<minX||prio[0]>maxX
    next if prio[1]<minY||prio[1]>maxY
    id=prio[3]
    xpos=(prio[0]<<5)-@ox
    ypos=(prio[1]<<5)-@oy
    count=addTile(@tiles,count,xpos,ypos,id)
   end
  else
   for z in 0...@map_data.zsize
    for y in minY..maxY
     for x in minX..maxX
      id = @map_data[x, y, z]
      next if id==0 || !@priorities[id]
      next if @priorities[id]==0
      xpos=(x<<5)-@ox
      ypos=(y<<5)-@oy
      count=addTile(@tiles,count,xpos,ypos,id)
     end
    end
   end
  end
end
if count<@tiles.length
  bigchange=(count<=(@tiles.length*2/3)) && (@tiles.length*2/3)>25
  j=count;len=@tiles.length;while j<len
   sprite=@tiles[j]
   @tiles[j+1]=-1
   if bigchange
    sprite.dispose
    @tiles[j]=nil
    @tiles[j+1]=nil
   elsif !@tiles[j].disposed?
    sprite.visible=false if sprite.visible
   end
   j+=2
  end
  @tiles.compact! if bigchange
end
end
 
end 



Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

Cortez - posté le 19/03/2013 à 20:23:50. (523 messages postés)

Réponse :
De mémoire les cases d'animation fond 192 x 192 pixels.
Le décalage provient soit de la taille de l'image qui n'est pas bonne (5 cases de large) Soit un décalage du sprite des personnages dans la case.


Aide tutoriel + ressource :
Je vais m'occuper de cette animation (c'est ma spécialité).

Par contre j'ai 2 choses à ajouter :

- Ton image est en JPG flou inutilisable, du coup va faire un tour ici :
http://spriters-resource.com/gameboy_advance/narutonc2/

- Je n'ais pas le temps d'en faire d'autre, pour t'aider je vais t'expliquer ma technique.
D'abord il te faut un Template (un fichier avec les cases dessinées)
Et aussi un logiciel de dessin qui gère les calques et transparences (Gimp, Paint.net)

Spoiler (cliquez pour afficher)


Ensuite il te faut la planche de sprites (je ne les agrandis pas comme ça dans RmVX tu n'auras qu'a modifier le zoom.)

Spoiler (cliquez pour afficher)



Ensuite afin d'éviter le décalage, il faut choisir la place du premier sprite dans la 1ere case.
(Pour faire simple on le place au milieu.)
Une fois la place choisie, tu sélectionne la 1ere case et tu la copie/colle sur chaque autre case du Template.

Spoiler (cliquez pour afficher)



Maintenant on à la position du sprite sur chaque case. Fait un nouveau calque et prend les autres sprites et place les de façon à respecter la le modèle du fond (conseil, prend comme référence les pieds.)
On voit bien la superposition aux niveau des pieds :

Spoiler (cliquez pour afficher)


Pour la suite, il suffit de continuer.


Le résultat final :
image

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 15/03/2013 à 13:53:22. (523 messages postés)

@Tata monos : nop désolé c'est pas un clin d'yeux.

@Moonshadow : Les vaisseaux sont des modèles en 3D texturés que j'ai placé pour faire un rendu (une image) de chaque pose.
Du coup il sont antialiasé ce ne sont pas des sprites.
Cependant l'exemple que tu montre est très alléchant. J'aimerais vraiment avoir des vaisseaux en pixel-art. Malheureusement mon faible niveau, ne le permet pas...
Si le cœur t'en dis tu peux toujours m'aider sur ce point. ^^

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 15/03/2013 à 11:07:48. (523 messages postés)

Aucun changement à prévoir pour les noms des matériaux, c'est comme ça.
En effet ce n'est pas de l'ocre noir, ni de ore (minerai en anglais)
c'est simplement une autre matière nommée Ochre.

Pour la différence visuelle entre les vaisseaux et le reste, je pense qu'il faut que je modifie les colorations des texture, mais sache qu'a la base, j'ai déjà modifié leur couleur.
Par exemple le Solaris I du premier screen était à la base très sombre, une sorte de marron presque noir...

@Tata Monos : J'ai compris ta phrase, le nom de la planète est très proche (sans que j'ai pompé le nom, hein ?) du nom d'un jeu très populaire.
Il m'a fallu du temps pour comprendre mais c'est en lisant un post contenant le nom du jeu que j'ai compris.

Posté dans Forum - [VX Ace] Soucis de mapping des surfaces avec les tilesets

Cortez - posté le 15/03/2013 à 10:57:43. (523 messages postés)

Etrange, ça vient peut-être de la forme de la table, en effet sur les 2 screens la table n'a pas la même forme, ce qui suppose que le logiciel, considère une table de 1 case différemment d'une table en L qui fait 3 cases de haut (du coup il ajuste la première mais pas la seconde vu que le maker à la "place" de mettre les objet plus haut).

C'est aberrant mais "une fois l'impossible éliminé, il ne reste que la vérité." Donc j'en conclus que c'est la seule explication.

En fait pour être sur ajoute aussi un tapis comme le screen de gauche.

Posté dans Forum - Topic des bribes de projets

Cortez - posté le 13/03/2013 à 22:32:56. (523 messages postés)

Lost souls



C'est un jeu découpé en épisodes, dans l'idéal je pensais fixer une durée par épisode de 1 heure de jeu. C'est assez long pour ne pas décevoir, et assez court pour le permettre de me donner à fond sur une courte période (1 mois ou 2)

Catégorie : RPG Classique
Univers : Médiéval fantastique
Durée de jeu : 1 heure par épisode et une première saison de 10 épisodes.


Synopsis:


L'histoire débute dans un village reculé de toute influence extérieure. Notre héro (pas de prénom choisi) est promis à un triste sort. Il va être sacrifié à la créature qui vit dans la montagne gelée, ce monstre surnommé grand Frost exige un sacrifice tout les 50 ans. L'enfant choisi par la créature est désignée par la marque sur le dos de sa main. Il est élevé par ses parents tout en sachant l'horrible fin qui approche, à chaque fois les sacrifices sont entrainés au combat, dans l'espoir qu'il reviendrons avec la tête du monstre sous le bras. Mais à chaque fois ils ne reviennent jamais...


Background
:


Vu le découpage en épisode il est facile de faire des flashback et de revenir avant les évènements qui se sont produits. Ainsi, le passé, le présent et l'avenir du héro, du village seront racontés (je ne vais pas tout dire ici sinon, il n'y a plus d'intrigue). Seulement, le jeu tournera autour de l'histoire du héro, de ses amis et proches ainsi que sur une autre chose mystérieuse.


PERSONNAGES PRINCIPAUX
:



Le héro (j'ai pas choisi les noms)
Sexe : Masculin
Âge : 21
Description : Hormis la marque sur sa main, il s'agit d'un jeune homme comme les autres. Il est bien entendu formé au combat, il fait face à son destin, il n'en parle pas mais il espère être le premier à triompher du grand Frost.

Le grand Frost
Sexe : ???
Âge : ???
Description : On sais peux de chose sur lui, il n'a jamais été vu, il est mentionné dans les anciens écrits qu'il s'agit d'une créature gigantesque et que le fait de le voir glace littéralement le sang de sa proie, d'où son nom de Frost (froid).


Je voudrais comme tous mes prédécesseurs avoir votre avis sur l'idée du jeu, le concept d'épisodes.

Il faut savoir que je bosse actuellement sur un autre projet (Solaris) c'est ce qui à mon sens à déterminé mon choix sur un format court de jeu, afin de ne pas m'accaparer trop de temps.
Maintenant, j'aime bien avoir un projet futuriste et custom et à coté un projet plus classique afin que chacune de mes idées puisse être exploitée dans l'un ou l'autre projet.

Pour le game-play et les différents systèmes, je vais piocher dans les scripts pour varier un peu du combat basique de rmXP.

Voilà, merci d'avoir lu, j'attend avec impatience vos critiques.

Posté dans Forum - [VX Ace] Soucis de mapping des surfaces avec les tilesets

Cortez - posté le 13/03/2013 à 14:04:02. (523 messages postés)

Je viens de comprendre !
Regarde attentivement le screen de gauche, le bar fait 32px de haut (1 case).
Mais sur le screen de droite, la table est plus haute ! Si si regarde par rapport au carrelage sur le bord gauche, la table fait en réalité 32px plus les pieds en dessous (que le logiciel rajoute lui même). ce qui fait une hauteur d'environ 40px d'où le décalage !
En fait ce n'est pas ton bar le problème, mais la place dans l'image du tileset lui même.

image
D'après le tileset A2 par défaut il faut que ton autotile custom de bar se situe à droite (à la place de la table) sur le tileset A2.

Edit :
Il faudrait regrouper tout les détails que le logiciel règle automatiquement parce que sans un bon coup d'œil, ce problème restait insoluble.
Le logiciel traite différemment les autotiles selon leurs place sur le tileset. Ainsi les 4 autotiles de la dernière colonne sont considérés comme des tables, et occupent les cases effectives que l'on à mappé dans l'interface et le logiciel rajoute les pieds de table sur la case du dessous. Donc les éléments de décoration ne débordent pas.

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 13/03/2013 à 13:52:23. (523 messages postés)

@Wulfric : le fond étoilé rend l'image du système solaire illisible donc j'ai privilégié
la visibilité à la cohérence (de plus c'est une carte du système et pas une photo).

@Tata Monos : De quoi tu parle ? C'est le nom de la planète ...
Il n'y a pas de faute d'orthographe.

Posté dans Forum - [RM XP] Script XAS A-rpg et AMS Ultimate : conflit sur touche "espace"

Cortez - posté le 13/03/2013 à 13:46:19. (523 messages postés)

lllllllllllllll a dit:


Merci pour ta réponse Cortez ! J'avais déjà essayé de remplacer la touche C par une autre touche, mais le problème restait le même. Par contre, ton idée me fait penser à autre chose.

Dans la portion de code que tu me proposes d'ajouter, de la ligne 1 à 3 on lit :

Portion de code : Tout sélectionner

1
2
class Game_Player
If $game_switches(1) = true  #L'interrupteur 1 est activé (tu peux remplacer 1 par un autre nombre)



Or l'interrupteur 1 est déjà utilisé par le script de mon système de combat : il s'agit de l'activation du HUD (boîtes de dialogues contenant les barres de vie etc). Dans le script AMS U l'interrupteur 1 est peut-être aussi utilisé, et entre en conflit avec le HUD du XAS system. Si je change l'interrupteur alloué au système de déplacement (en plus de changer les touches déjà utilisées par le XAS), tu penses que ça pourrait résoudre le conflit ?

Merci en tout cas encore pour ta réponse et pour ton aide, je dois dire que je ne suis pas un crack en informatique et que je me débrouille uniquement en fouillant et en essayant de comprendre la logique interne des différents outils que j'utilise... mais on dirait que parfois, ça ne suffit pas :D Bref, merci encore.



Tu peux bien sur changer l'interrupteur que j'ai utilisé dans la modification :

Portion de code : Tout sélectionner

1
2
class Game_Player
If $game_switches(100) = true  #L'interrupteur 100 est activé 



Posté dans Forum - [RPG Maker VX] Fond de combat différent

Cortez - posté le 12/03/2013 à 14:31:37. (523 messages postés)

Bonjour alors même si ta demande n'est pas ultra
compréhensible je vais faire un effort et t'aider un peu.

Voici donc le code script qui va nous servir :

Portion de code : Tout sélectionner

1
2
3
4
5
6
# Place your battle backgrounds in the 'Pictures' folder (Graphics/Pictures) 
# Format = {map_id => Battleback Name} 
Battle_background = 
{ 
4=>"Plaines", 
} 



La ligne 4=>"Plaines" es décortiquée en 2 choses.
4 c'est l'id de la map dans ton jeu, donc la map004 de ton projet est paramétrée.
"Plaines" c'est le nom du background utilisé sur la map004.

Question 1 :
Pour rajouter des background sur d'autre map comment faire ?

Réponse :
Tu écris une ligne en plus commençant par le numéro de la map. et tu lui indique son background (nom de l'image).
Attention il faut que tu respecte l'ordre numérique, c'est à dire que tu ne peux pas ajouter la map 1 après la map 4 sinon
tu auras un message d'erreur.

Je te donne l'écriture pour les 10 premières map :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
Battle_background = 
{ 
1=>"Plaines", 
2=>"Plaines", 
3=>"Plaines", 
4=>"Plaines", 
5=>"Plaines", 
6=>"Plaines", 
7=>"Plaines", 
8=>"Plaines", 
9=>"Plaines", 
10=>"Plaines", 
} 


Tu vois c'est simple il suffit de suivre l'exemple sans oublier la virgule en fin de ligne.


Question 2 :
Comment ajouter plusieurs background pour une seule map ?

Réponse :
Cette fois c'est plus compliqué puisque l'écriture du script est conçue sous forme de liste (les listes sont entre { } .)
Du coup je pense pas pouvoir modifier la liste dans le jeu, donc on va tricher un peu.

Portion de code : Tout sélectionner

1
5=>"Plaines",


va devenir

Portion de code : Tout sélectionner

1
5=>"Plaines"+$game_variables(1).to_s,


J'ai changé la ligne pour intéger une variable du jeu
(la variable001)
Lorsqu'elle est égale à 0 le nom de l'image de background est
"Plaines0"
Lorsqu'elle est égale à 1, l'image correspondante est "Plaines1".

Du coup la triche est possible avec un évènement avant de lancer un combat, il faut rendre la variable 1 égale à la valeur que tu veux.
Ensuite place les images correspondantes avec le nom qu'il faut (n'oublie pas l'image 0 qui va être affiché par défaut.)
Ensuite tu peux reprendre cette ligne pour d'autres map.

Posté dans Forum - [VX Ace] Changer l'animation combat

Cortez - posté le 12/03/2013 à 14:04:22. (523 messages postés)

Cette ligne c'est celle qui applique la transition, regarde la ligne du dessus, elle commence par :
name = ...
donc elle définit le nom de la transition appelée :
Graphics.transition(60, name, 100) on y retrouve ce "name"

Mais c'est bien la ligne :
Graphics.transition(60, name, 100)
qui execute la transition avec les paramettres de durée (60) et d'opacité ? (100). En tout cas c'est ça.

(Un coup de main pour les autres paramètres ?)

Posté dans Forum - [RM XP] Script XAS A-rpg et AMS Ultimate : conflit sur touche "espace"

Cortez - posté le 12/03/2013 à 13:50:13. (523 messages postés)

ça y est j'ai trouvé :

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
# Vous pouvez choisir les touches pour sprinter et sauter aux lignes 35 et 36
# Les touches possibles sont Input::A, B, C, X, Y, Z, L, R
# Pour choisir à quelle touche ça correspond sur le clavier lancez le jeu puis appuyez sur F1
# Si les touches qui vous sont proposées ne vous conviennent pas vous pouvez toujours télécharger
# le script : "Input Ultimate" qui vous permettra de choisir n'importe quelle touche du clavier
# Si vous voulez désactiver le sprint écrivez : Dash_Input = 0
# Si vous voulez désactiver les sauts écrivez : Jump_Input = 0
# Vous pouvez initialiser le héros lignes 40 à 55
# @position => façon dont est positionnée l'image par rapport à ses coordonnées (voir tutorial)
# @move_speed => vitesse de déplacement, comprise entre 0 et 7
# @move_animation_speed => vitesse de l'animation du personnage, >= 0
# si = 0, la vitesse de l'animation sera automatiquement égale à la vitesse de déplacement
# @jump_power => puissance des sauts, doit être supérieure à la hauteur des murs que l'on veut pouvoir sauter
# @zoom => zoom en pourcentage : 1 => 100%, 0.5 => 50%, 2 => 200%
# @step_anime => animée à l'arrêt ? true => oui : false => non
# @spec_anime => animation spéciale qui se déclenche de manière aléatoire quand on est à l'arrêt
# @walk_anime => animée pendant mouvement ? true => oui : false => non
# @jump_anime => animée pendant saut ? true => oui : false => non
# @fall_anime => animée pendant chute ? true => oui : false => non
# @down_anime => animation spéciale qui se déclenche quand on tombe de trop haut
# @shadow => ombre activée ? true => oui : false => non
# @walk_steps => nombre de pas dans une animation
# @walk_terrain => force un terrain spécifique quel que soit l'endroit où l'on marche
# si = 0, le terrain est celui sur lequel on marche
# @walk_audio => bruits de pas activés ? true => oui : false => non
# @walk_graphics => traces de pas activées ? true => oui : false => non
class Game_Player
  Dash_Input = Input::C



Donc à la ligne:

Portion de code : Tout sélectionner

1
Dash_Input = Input::C



tu remplace Input::C par Input::L ou R ou Y ou Z
enfin bref par une touche que le XAS n'utilise pas.

Si ton problème n'est pas résolu par ce changement, il faut que tu ajoute un interrupteur pour
activer/désactiver la course:

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
class Game_Player
If $game_switches(1) = true  #L'interrupteur 1 est activé (tu peux remplacer 1 par un autre nombre)
  Dash_Input = Input::C         # on active la course
Else                                        #Sinon on la désactive avec Dash_Input = 0
  Dash_Input = 0                   #
End                                        #On oublie pas le end pour la reprise du script.
  Jump_Input = Input::A
  Jump_Audio = RPG::AudioFile.new("Data System/JumpAudio")
  def initialize
    super
    @position = 8
    @move_speed = 4
    @move_animation_speed = 0
    @jump_power = 1.5
    @zoom = 1
    @step_anime = false
    @spec_anime = true
    @walk_anime = true
    @jump_anime = true
    @fall_anime = true
    @down_anime = true
    @shadow = false#true
    @walk_steps = 2
    @walk_terrain = 0
    @walk_audio = false#true
    @walk_graphics = false#true
  end
end



Posté dans Forum - Questions idiotes sur RM [PAS Script]

Cortez - posté le 11/03/2013 à 21:13:26. (523 messages postés)

Je pense que c'est possible.
http://www.rpg-maker.fr/scripts-327-scroll-pictures.html
Avec le script de zeus81, tu peux afficher une image partiellement si elle est plus grande que le "cadre" que tu lui attribue.

Soit il t'aide avec une commande en script (il faut lui demander).

Soit tu essaye de faire des conditions en event parallèle afin que si le joueur bouge de 1 case, l'image se déplace de X pixels (correspondant à 1 case). Mais c'est théorique car je sais pas si ça marche.

Posté dans Forum - [???] Recherche logiciel de redimension

Cortez - posté le 09/03/2013 à 14:03:17. (523 messages postés)

Après quelques recherche, j'ai 2 sites à te proposer :
http://vectormagic.com/online/my_images
qui permet de convertir en ligne les images (les couleurs sont parfois altérées).
Edit : Après reflection, ce site en ligne est une arnaque (2 conversion gratuites) et le reste est payant, donc essaye de faire des "Imp écran" du résultat afin de ne pas payer.

Et un autre site donnant le code source d'un système proche du résultat "our" et non pas ours -> c'est une erreur de traduction.
http://potrace.sourceforge.net/

Voilà après j'ai testé que le premier site qui donne tout de même de bon résultat.
Pour info il semblerais que le flitre de redimentionnement "our" n'existe pas gratuitement (ou alors je l'ai pas vu).
Edit : Par contre les formats de sauvegarde des images sont des formats vectoriels.
Il te reste toujours la solution de chercher le filtre Hq4x qui de mémoire est disponible gratuitement sur le net et le résultat peut être enregistré en bmp, JPG, png.
Ou encore le filtre Hq2x disponible dans le logiciel Ressource wizard dispo sur oniro
http://www.rpg-maker.fr/programmes/resourcewizard.zip

Posté dans Forum - [XP] Faire apparaître la fenêtre d'aide en combat

Cortez - posté le 08/03/2013 à 22:30:40. (523 messages postés)

Une fenêtre d'aide comme une note fixe, que le joueur peut lire mais sans avoir d'intéractions ?
Si c'est le cas c'est super simple.

Tu vas dans l'onglet "groupe d'ennemis"
Tu vas voir une zone semblable à un évènement.
Et tu rentre 2 paramètres :

Condition : A partir du "tour 0" et tous les "0 tours".
Fréquence : toujours.
Ensuite tu fait un évènement normal :
Condition, la touche "X" est enfoncée (tu met la touche que tu veux, évite la touche C = Entrée.)
Afficher un message : "blabla que tu veux dire"
Fin de condition.

Pense à décocher la case de condition "Executer autre chose si la condition n'est pas validée"
car on s'en fout il se passe rien quand on appuie pas ^^.

Et ensuite tu refait la même chose pour tous les combats ou le message doit
apparaitre (oui je sais c'est un peu long)
Mais si c'est juste pour aider le joueur en début de jeu, fait le copier/ coller
que pour les premiers monstre du jeu, une fois niveau 10 le joueur n'aura
plus besoin d'aide.

Il est aussi possible d'afficher une image (à la place du message)
pour cela il faut juste faire ceci :

Condition, la touche "X" est enfoncée (tu met la touche que tu veux, évite la touche C = Entrée.)
Afficher une image (image que tu veux)
Sinon
Effacer l'image 1
Fin de condition.

Posté dans Forum - [RPG Maker XP] Donner un objet en fonction de son ID

Cortez - posté le 08/03/2013 à 22:10:53. (523 messages postés)

Sinon pour avoir les commentaires des scripts (en anglais) tu peux utiliser
ce fichier "script.rxdata" a placer dans le dossier data d'un projet vierge.
Je suppose que tu possede la version de rmXP avec des "[] [] []" à la place
des commentaires ?
Du coup, dans le fichier fournit tu trouveras tous les script de base avec
leurs commentaires en anglais (Google traduction si tu sais pas tout)
et les scripts sont classés et plus lisibles.

http://www.mediafire.com/?h775v6h2mg4hm44

ATTENTION : Remplacer le fichier "script.rxdata" d'un projet remplace tous
les scripts d'un seul coup. C'est pour cela qu'il faut que tu le fasse dans un
nouveau projet vide.

Posté dans Forum - [RmXP] Changer les termes de la BDD (base de donnée)

Cortez - posté le 08/03/2013 à 21:27:53. (523 messages postés)

C'est parfait ! Merci pour le bout de script.
(même en imaginant le script à l'arrache, j'était pas si loin de la réalité !)

Et hop dans les crédits du jeu.

Posté dans Forum - [RmXP] Changer les termes de la BDD (base de donnée)

Cortez - posté le 08/03/2013 à 14:42:14. (523 messages postés)

Domaine concerné: Script
Logiciel utilisé: RmXP
Bonjour à tous, je poste ici un nouveau sujet afin de demander une aide sur un script.

Vous savez tous que lorsque l'on configure la BDD dans rmXP, on peut choisir, dans
l'onglet "Système" les termes employés par le jeu dans le menu.
(la désignation des pv, pm, le nom des caractéristiques, ...)

Mais il est impossible de reconfigurer les termes employés in-game (c'est à dire une
fois dans le jeu, changer le terme DEF par un autre).

D'où ma demande, de pouvoir paramétrer dans un script tout les champs à remplir :
(selon mes petites compétence en script ça pourrait ressembler à ça)

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
 
#================================================
#  Attention ceci n'est pas un script ce n'est qu'une supposition 
#  fantaisiste de la part d'un non-scripteur sur une hypothétique
#  formulation en script de son idée, toute ressemblance avec un
#  vrai script existant ou ayant existé est purement fortuite.
#================================================
If $game_switches(3) = false
  [Terminologie_1,
   PV = "HP",
   PM = "MP",
   Défense = "DEF",
   Attaque = "ATK",
 ... ]
 
Else 
  [Terminologie_2,
   PV = "Point de vie",
   PM = "Point de mana",
   Défense = "Protection",
   Attaque = "Offencive",
 ... ]


et de pouvoir switcher avec un interrupteur (exemple le n°003) pour avoir une autre
terminologie. Ou alors une variable avec pour chaque valeur, une terminologie définie
en script.

En résumé ma demande c'est :
- Concevoir un script qui redéfinit la terminologie paramétrée dans l'onglet "Système"
de manière dynamique et modifiable par l'intermédiaire d'une variable ou d'un interrupteur.


Voilà c'est une demande atypique mais c'est vraiment important pour le projet Solaris.
Je te remercie par avance, toi scripteur de passage d'avoir lu la demande et peut-être
avoir pris le temps de bidouiller un truc.

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 07/03/2013 à 21:44:10. (523 messages postés)

@Wulfric :
Recentrer le fenêtre de choix n'est pas facile, je suis une quiche en script et c'est juste
pour une seule map du jeu, donc bon c'est pas la priorité numéro 1.
Bien que je l'avoue elle est pas aussi bien cadrée que celle du screen suivant.

Car oui j'ai fini le système de récupération de ressource du jeu.
Exit le screen ou on explore une sorte de grotte en 3D et ou l'on creuse les rochers
pour trouver les ressources.
Maintenant, il suffit de passer par un npc du vaisseau solaris qui vous propose, contre
rémunération, de réaliser des excavations dans les différents systèmes solaires explorés.

S'ouvre alors un menu ou le système solaire choisi est affiché et les zones possibles
d'excavations sont entourés d'un curseur bleu. On choisi alors à l'aide de la souris,
la planète de son choix.
On est invité à confirmer son choix, on patiente environ 30sec puis l'écran affiche le
résultat de la prospection.
L'inventaire se remplit de nos trouvailles que l'on peut alors utiliser dans le menu
création/crafting pour construire de nouveaux objets.
image

Ce système permet d'éviter les heures de farming sur les monstres afin d'obtenir les
ingrédients pour l'arme "trucsuperpuissant" surtout que dans un jeu amateur,
aucun joueur n'est prêt à passer 10h à crafter des items.

Donc utile et légèrement novateur, non ?
Vous en pensez quoi ?

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 06/03/2013 à 19:04:04. (523 messages postés)

@Wulfric :
La map s'arrête brusquement sur le fond de la map, c'est assez chiant mais bon, il faudrait un évent tout plat pour border le bord de la map et qu'il bouge en même temps que celle-ci pour éviter l'effet de disparition au bord du champ de vision.
Pour le moment le script ne gère pas cela, j'essayerais avec des évent pour voir...
Et les choses noires ne sont pas venue de ce film/livre, mais c'est une référence pour le design des habitations.

Et un petit screen du menu crafting :
image
On clique à la souris et la recette de l'objet apparait.

Posté dans Forum - Les aventures de Leoht

Cortez - posté le 27/02/2013 à 16:24:16. (523 messages postés)

Ce jeu m'emplit de nostalgie, ça me rappelle mes débuts dans les
logiciels RM, c'était la version 2003 à l'époque. Mais c'est mieux
mappé que ce que je fesais il y a 12 ans ^^.
Certains screen sont un poil trop vides. Mais certaines idées sont
intéressantes.

Notamment le fait de ne pas être obligé de farmer des heures pour avancer.
Mais aussi le système de troc d'objet droppé sur
les monstres contres des items utiles.

Pour ce qui est de l'histoire ça reste classique mais ce n'est pas
l'éternel cliché du "méchant = détruire le monde".

Tu as aussi donné un âge plus cohérant à tes personnages.
(eh oui, n'en déplaisent à tous les jeunes, on n'est pas dans
Po**mon, les enfants de 11 ans ne font pas le tour du monde
seuls).

Bref des tas de bonnes choses pour un projet qui ne l'est pas moins.
Je pense suivre de près l'avancée du jeu.

Posté dans Forum - Solaris (aventure galactique)

Cortez - posté le 27/02/2013 à 11:47:35. (523 messages postés)

Bonjour à tous, je suis de retour sur oniro.
Et je continue le développement de Solaris.
Du coup petite new's avec quelques screens.

La nouvelle version des montagnes.
image

Et un ajout de profondeur pour l'eau.
image

Hormis ces images, je bosse actuellement sur un système de crafting d'objet entièrement en événement.
Ainsi qu'un système pour récupérer des matériaux pour la fabrication.

Edit : J'aurais aussi besoin d'un coup de main pour créer des Template
de créatures. Pour le moment je teste avec des sprites de jeux mais ils
sont parfois en isométrique alors que je recherche un format RmXP (4*4 poses)

Je suis aussi en train de créer de nouveaux arbres (pour une autre planète).
Ils ont des feuilles custom (fait par moi).
image
J'aimerais avoir vos avis sur les arbres et les modifications apportés pour améliorer
encore les screens et éviter l'effet pixel moche.

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

Cortez - posté le 13/01/2013 à 21:52:42. (523 messages postés)

ok je teste ça tout de suite.

Merci pour la réponse rapide.

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

Cortez - posté le 13/01/2013 à 21:10:13. (523 messages postés)

Bonjour à tous je repasse sur oniro pour demander un coup de pouce des scripteurs sur un système simple de boussole.

Système concerné : RmXP

Type de demande : Traduction et explication

J'ai trouvé une formule sur le net permetant de calculer à l'aide de 2 points l'angle qui les sépare.
Ceci permet d'obtenir un angle compris entre 0 et 360 et ainsi afficher une image ayant la bonne rotation.

Imaginons un point A (le héros du jeu) positionné en x1 et y1, et un point B (l'objectif), en x2 et y2.

Je souhaite connaître un angle (en degré) afin qu’une aiguille d'une boussole pointe dans la direction du point B.

Portion de code : Tout sélectionner

1
float a = ((float)(Math.atan2 (y2-y1, x2-x1)*180.0d/Math.PI))+90.0f



Cependant c'est un code JAVA et j'aimerais qu'un scripteur charitable le traduise en langage ruby et m'explique comment l'utiliser (script audessus de main, insertion de script).

Note: je sais déjà remplacer y2, x2 ... par des

Portion de code : Tout sélectionner

1
$game_variables(id)

et je dispose d'un moyen pour afficher l'image en fonction d'un angle.

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

cortez - posté le 26/10/2012 à 16:38:40. (523 messages postés)

Slime55 a dit:


Support : RMXP

Question 1 :
Bonsoir, mon problème concerne le script pour le combat vue de coté.
Dans mon projet, j'ai essayé un skill qui permet la transformation, j'arrive à changer le sprite de mon perso en l'image que je veux le problème est qu'en fait l'image n'est représenté que partiellement pour être exact le côté haut gauche

J'ai essayé de bidouiller à mainte reprises le script et j'ai changé ces lignes là :
self.bitmap = RPG::Cache.character(@character_name, @character_hue)
cw = self.bitmap.width / 4
ch = self.bitmap.height / 4


Voilà un screen de comment l'image est représenté : http://imageshack.us/photo/my-images/17/sanstitre1xb.jpg/

La partie bleue est celle qui est par défaut dans le script du combat vue de coté c'est à dire quand les valeurs sont 4 et 4
Le maximum de partie visible que je suis arrivé à obtenir est celle en rouge ( la partie avec les jambes ) en mettant comme valeur 1 et 2
Donc en fait je voulais savoir comment faire pour avoir toute l'image dans le combat ?

Merci d'avance



C'est ultra simple, tu vas agrandir ton image pour la copier 4 fois en largeur et 4 fois en longueur (comme un character en fait). et tu remet les lignes de script avec 4 et 4.
L'erreur vient que le script affiche un character (donc découpe ton image en 16 morceaux)

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

cortez - posté le 25/10/2012 à 22:21:27. (523 messages postés)

@Crystal :
En effet la methode n'est pas définie. Mais j'ai laissé tombé.

Merci quand même ^^

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

cortez - posté le 24/10/2012 à 15:02:05. (523 messages postés)

Support : RMXP

Question 1 :
Bonjour, je vous écrit car je me suis mis au bidouillage des scripts et je voudrais savoir comment changer la valeur de zoom du sprite d'un évenement et aussi celui du héro.

J'ai essayé un truc dans le genre "inserer un script"

$game_event.zoom_x = 2
$game_event.zoom_y = 2

Mais il m'indique que la methode n'existe pas. J'ai vérifié dans le script Game_Event et le zoom n'est pas utilisé, alors comment faire ?

Posté dans Forum - [RMXP] Utiliser la commande "draw" pour afficher une variable du jeu [Ré

cortez - posté le 18/10/2012 à 14:59:41. (523 messages postés)

Par contre tu pourrais me dire ce que fait le dernier chiffe ?
le "2" en fin de ligne ?

Posté dans Forum - [RMXP] Utiliser la commande "draw" pour afficher une variable du jeu [Ré

cortez - posté le 18/10/2012 à 14:36:30. (523 messages postés)

J'ai peut être une piste :

Portion de code : Tout sélectionner

1
2
3
 
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, $game_variables[x].to_s,2)



La première ligne attribue une couleur d'écriture
La deuxième ligne avec X et Y pour les coordonées à l'écran et 24,32 la taille
de la zone d'écriture.

D'après ce que je sais ".to_s" permet d'afficher des caractères de type "string" enfin
un truc comme ça ^^. et le 2 je sais pas à quoi il sert, peut-être la profondeur, le type de transparence de la fenêtre, ou autre chose...

Posté dans Forum - [RmXP] Chenille derrière héro non traversable

cortez - posté le 18/10/2012 à 11:03:24. (523 messages postés)

Domaine concerné: Script
Logiciel utilisé: RmXP
Le problème est tout bête mais je ne sais pas le résoudre :
Lorsqu'un évenement (mode fantome on) essaye de
traverser les personnages dans la chenille qui suis le héro,
il restent bloqués.
Or je voudrais qu'elle soit totalement traversable.

Element joints :
Le script

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
#==============================================================================
# ■ Train_Actor::Config
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
# ●Switch setup for transparent status
# When true, switch control is used
TRANSPARENT_SWITCH = true
#TRANSPARENT_SWITCH = false
 
# ●Switch number for transparent status
# When TRANSPARENT_SWITCH is true, transparency will be activated when the switch of this number is on
TRANSPARENT_SWITCHES_INDEX = 21
 
# ●Maximum number of actors
# There will be support for a large number of people in a party in the future...
TRAIN_ACTOR_SIZE_MAX = 4
 
# Constants
DOWN_LEFT  = 1
DOWN_RIGHT = 3
UP_LEFT    = 7
UP_RIGHT   = 9
JUMP       = 5
 
end
 
# rgss
 
# Spriteset_Map_Module.rb
#==============================================================================
# ■ Spriteset_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
module Spriteset_Map_Module
 def setup_actor_character_sprites?
   return @setup_actor_character_sprites_flag != nil
 end
 def setup_actor_character_sprites(characters)
   if !setup_actor_character_sprites?
     for character in characters.reverse
       @character_sprites.unshift(
         Sprite_Character.new(@viewport1, character)
       )
     end
     @setup_actor_character_sprites_flag = true
   end
 end
end
 
end
 
class Spriteset_Map
 include Train_Actor::Spriteset_Map_Module
end
 
# Scene_Map_Module.rb
#==============================================================================
# ■ Scene_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
module Scene_Map_Module
 def setup_actor_character_sprites(characters)
   @spriteset.setup_actor_character_sprites(characters)
 end
end
 
end
 
class Scene_Map
 include Train_Actor::Scene_Map_Module
end
 
# Game_Party_Module.rb
#==============================================================================
# ■ Game_Party_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
module Game_Party_Module
 attr_reader :characters
 def actors_dead?
   for actor in actors
     if actor.dead?
       return true
     end
   end
   return false
 end
 def update_party_order
   if not actors_dead?
     return actors
   end
   alive_actors = []
   dead_actors = []
   for actor in actors
     if actor.dead?
       dead_actors.push actor
     else
       alive_actors.push actor
     end
   end
   return alive_actors + dead_actors
 end
 def setup_actor_character_sprites
   if @characters.nil?
     @characters = []
     for i in 1 ... TRAIN_ACTOR_SIZE_MAX
       @characters.push(Game_Party_Actor.new)
     end
   end
   setup_actors = update_party_order
   for i in 1 ... TRAIN_ACTOR_SIZE_MAX
     @characters[i - 1].setup(setup_actors[i])
   end
   if $scene.class.method_defined?('setup_actor_character_sprites')
     $scene.setup_actor_character_sprites(@characters)
   end
 end
 def update_party_actors
   update_party_order
   setup_actor_character_sprites
   transparent = $game_player.transparent
   if transparent == false
     if TRANSPARENT_SWITCH
       transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
     end
   end
   for character in @characters
     character.transparent = transparent
     character.move_speed = $game_player.move_speed
     character.step_anime = $game_player.step_anime
     character.update
   end
 end
 def moveto_party_actors( x, y )
   setup_actor_character_sprites
   for character in @characters
     character.moveto( x, y )
   end
   if @move_list == nil
     @move_list = []
   end
   move_list_setup
 end
 def move_party_actors
   if @move_list == nil
     @move_list = []
     move_list_setup
   end
   @move_list.each_index do |i|
     if @characters[i] != nil
       case @move_list[i].type
         when Input::DOWN
           @characters[i].move_down(@move_list[i].args[0])
         when Input::LEFT
           @characters[i].move_left(@move_list[i].args[0])
         when Input::RIGHT
           @characters[i].move_right(@move_list[i].args[0])
         when Input::UP
           @characters[i].move_up(@move_list[i].args[0])
         when DOWN_LEFT
           @characters[i].move_lower_left
         when DOWN_RIGHT
           @characters[i].move_lower_right
         when UP_LEFT
           @characters[i].move_upper_left
         when UP_RIGHT
           @characters[i].move_upper_right
         when JUMP
           @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
       end
     end
   end
 end
 class Move_List_Element
   def initialize(type,args)
     @type = type
     @args = args
   end
   def type() return @type end
   def args() return @args end
 end
 def move_list_setup
   for i in 0 .. TRAIN_ACTOR_SIZE_MAX
     @move_list[i] = nil
   end
 end
 def add_move_list(type,*args)
   @move_list.unshift(Move_List_Element.new(type,args)).pop
 end
 def move_down_party_actors(turn_enabled = true)
   move_party_actors
   add_move_list(Input::DOWN,turn_enabled)
 end
 def move_left_party_actors(turn_enabled = true)
   move_party_actors
   add_move_list(Input::LEFT,turn_enabled)
 end
 def move_right_party_actors(turn_enabled = true)
   move_party_actors
   add_move_list(Input::RIGHT,turn_enabled)
 end
 def move_up_party_actors(turn_enabled = true)
   move_party_actors
   add_move_list(Input::UP,turn_enabled)
 end
 def move_lower_left_party_actors
   move_party_actors
   add_move_list(DOWN_LEFT)
 end
 def move_lower_right_party_actors
   move_party_actors
   add_move_list(DOWN_RIGHT)
 end
 def move_upper_left_party_actors
   move_party_actors
   add_move_list(UP_LEFT)
 end
 def move_upper_right_party_actors
   move_party_actors
   add_move_list(UP_RIGHT)
 end
 def jump_party_actors(x_plus, y_plus)
   move_party_actors
   add_move_list(JUMP,x_plus, y_plus)
 end
end
 
end
 
class Game_Party
 include Train_Actor::Game_Party_Module
end
 
# Game_Player_Module.rb
#==============================================================================
# ■ Game_Player_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
module Game_Player_Module
 attr_reader :move_speed
 attr_reader :step_anime
 
 def update_party_actors
   $game_party.update_party_actors
   $game_party.actors.each do |actor|
     if actor.dead?
       next
     end
     @character_name = actor.character_name
     @character_hue = actor.character_hue
     break
   end
 end
 def update
   update_party_actors
   super
 end
 def moveto( x, y )
   $game_party.moveto_party_actors( x, y )
   super( x, y )
 end
 def move_down(turn_enabled = true)
   if passable?(@x, @y, Input::DOWN)
     $game_party.move_down_party_actors(turn_enabled)
   end
   super(turn_enabled)
 end
 def move_left(turn_enabled = true)
   if passable?(@x, @y, Input::LEFT)
     $game_party.move_left_party_actors(turn_enabled)
   end
   super(turn_enabled)
 end
 def move_right(turn_enabled = true)
   if passable?(@x, @y, Input::RIGHT)
     $game_party.move_right_party_actors(turn_enabled)
   end
   super(turn_enabled)
 end
 def move_up(turn_enabled = true)
   if passable?(@x, @y, Input::UP)
     $game_party.move_up_party_actors(turn_enabled)
   end
   super(turn_enabled)
 end
 def move_lower_left
   # When possible to move from down→left or from left→down
   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
      (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
     $game_party.move_lower_left_party_actors
   end
   super
 end
 def move_lower_right
   # When possible to move from down→right or from right→down
   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
      (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
     $game_party.move_lower_right_party_actors
   end
   super
 end
 def move_upper_left
   # When possible to move from up→left or from left→up
   if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
      (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
     $game_party.move_upper_left_party_actors
   end
   super
 end
 def move_upper_right
   # When possible to move from up→right or from right→up
   if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
      (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
     $game_party.move_upper_right_party_actors
   end
   super
 end
 def jump(x_plus, y_plus)
   # New coordinates are calculated
   new_x = @x + x_plus
   new_y = @y + y_plus
   # When addition values are (0,0), it is possible to jump to the destination
   if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
     $game_party.jump_party_actors(x_plus, y_plus)
   end
   super(x_plus, y_plus)
 end
end
 
end
 
class Game_Player
 include Train_Actor::Game_Player_Module
end
 
# Game_Event_Module.rb
#==============================================================================
# ■ Game_Event_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
module Game_Event_Module
 #--------------------------------------------------------------------------
 # ● Judgement determined
 #     x  : X coordinates
 #     y  : Y coordinates
 #     d  : Direction (0,2,4,6,8)  ※ 0 = Checks if all directions are not able to be passed (for a jump)
 # return : Passing is impossible (false), possible (true)
 #--------------------------------------------------------------------------
 def passable?(x, y, d)
   result = super(x, y, d)
   if result
     # New coordinates are searched for
     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
     # Loops for actor in train
     for actor in $game_party.characters
       # When displayed
       if not actor.character_name.empty?
         # When actor's coordinates correspond to the destination
         if actor.x == new_x and actor.y == new_y
           # When event
           if self != $game_player
             # Passing is impossible
             return false
           end
         end
       end
     end
   end
   return result
 end
end
 
end
 
class Game_Event
 include Train_Actor::Game_Event_Module
end
 
# Game_Party_Actor.rb
#==============================================================================
# ■ Game_Party_Actor
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
 
module Train_Actor
 
class Game_Party_Actor < Game_Character
 attr_writer :move_speed
 attr_writer :step_anime
 
 def initialize
   super()
   @through = true
 end
 def setup(actor)
   # The file name and hue of the character are set
   if actor != nil and (not actor.dead?) # When dead, it is erased for the time being...
     @character_name = actor.character_name
     @character_hue = actor.character_hue
   else
     @character_name = ""
     @character_hue = 0
   end
   # Opacity and blending method are initialized
   @opacity = 255
   @blend_type = 0
 end
 def screen_z(height = 0)
   if $game_player.x == @x and $game_player.y == @y
     return $game_player.screen_z(height) - 1
   end
   super(height)
 end
 #--------------------------------------------------------------------------
 # ● Move down
 #     turn_enabled : Flag that permits direction change on the spot
 #--------------------------------------------------------------------------
 def move_down(turn_enabled = true)
   # Face down
   if turn_enabled
     turn_down
   end
   # When possible to pass
   if passable?(@x, @y, Input::DOWN)
     # Face down
     turn_down
     # Update coordinates
     @y += 1
   end
 end
 #--------------------------------------------------------------------------
 # ● Move left
 #     turn_enabled : Flag that permits direction change on the spot
 #--------------------------------------------------------------------------
 def move_left(turn_enabled = true)
   # Face left
   if turn_enabled
     turn_left
   end
   # When possible to pass
   if passable?(@x, @y, Input::LEFT)
     # Face left
     turn_left
     # Update coordinates
     @x -= 1
   end
 end
 #--------------------------------------------------------------------------
 # ● Move right
 #     turn_enabled : Flag that permits direction change on the spot
 #--------------------------------------------------------------------------
 def move_right(turn_enabled = true)
   # Face right
   if turn_enabled
     turn_right
   end
   # When possible to pass
   if passable?(@x, @y, Input::RIGHT)
     # Face right
     turn_right
     # Update coordinates
     @x += 1
   end
 end
 #--------------------------------------------------------------------------
 # ● Move up
 #     turn_enabled : Flag that permits direction change on the spot
 #--------------------------------------------------------------------------
 def move_up(turn_enabled = true)
   # Face up
   if turn_enabled
     turn_up
   end
   # When possible to pass
   if passable?(@x, @y, Input::UP)
     # Face up
     turn_up
     # Update coordinates
     @y -= 1
   end
 end
 #--------------------------------------------------------------------------
 # ● Move lower left
 #--------------------------------------------------------------------------
 def move_lower_left
   # When no direction fixation
   unless @direction_fix
     # Turn left when facing right, turn down when facing up
     @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
   end
   # When possible to move from down→left or from left→down
   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
      (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
     # Update coordinates
     @x -= 1
     @y += 1
   end
 end
 #--------------------------------------------------------------------------
 # ● Move lower right
 #--------------------------------------------------------------------------
 def move_lower_right
   # When no direction fixation
   unless @direction_fix
     # Turn right when facing left, turn down when facing up
     @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
   end
   # When possible to move from down→right or from right→down
   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
      (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
     # Update coordinates
     @x += 1
     @y += 1
   end
 end
 #--------------------------------------------------------------------------
 # ● move upper left
 #--------------------------------------------------------------------------
 def move_upper_left
   # When no direction fixation
   unless @direction_fix
     # Turn left when facing right, turn up when facing down
     @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
   end
   # When possible to move from up→left or from left→up
   if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
      (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
     # Update coordinates
     @x -= 1
     @y -= 1
   end
 end
 #--------------------------------------------------------------------------
 # ● move upper right
 #--------------------------------------------------------------------------
 def move_upper_right
   # When no direction fixation
   unless @direction_fix
     # Turn right when facing left, turn up when facing down
     @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
   end
   # When possible to move from up→right or from right→up
   if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
      (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
     # Update coordinates
     @x += 1
     @y -= 1
   end
 end
end
 
end



Un extrait du game event (la passabilité est gérée avec @through = true)

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
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :trigger                  # trigger
  attr_reader   :list                     # list of event commands
  attr_reader   :starting                 # starting flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     map_id : map ID
  #     event  : event (RPG::Event)
  #--------------------------------------------------------------------------
  def initialize(map_id, event)
    super()
    @map_id = map_id
    @event = event
    @id = @event.id
    @erased = false
    @starting = false
    @through = true
    # Move to starting position
    moveto(@event.x, @event.y)
    refresh
  end



Il y a aussi un @through = true dans le script (ligne 419) de chenille mais il ne change rien.

Posté dans Forum - [Scripts] Petites questions connes sur les SCRIPTS!!

cortez - posté le 16/10/2012 à 18:49:27. (523 messages postés)

Bonjour à tous, je poste ici pour signaler aux modos que j'ai posté en commentaire d'un script la version corrigée du script
de fond de combat pour RmXP.

Voici le lien du post :
http://www.rpg-maker.fr/index.php?page=scripts&id=70&deb=fin#fin

Si il pouvait éditer le message du scripteur avec ma version corrigée ce serai sympa.

Merci

Posté dans Scripts - Afficher la map en fond de combat

cortez - posté le 16/10/2012 à 18:37:42. (523 messages postés)

J'ai corrigé le script !

Version 1 (les évenement de la map ne son pas visible en combat)

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
#==============================================================================
# [ Spriteset_Battle modifier par Cortez
#------------------------------------------------------------------------------
# ???????????????????????????? Scene_Battle ??
# ????????????
#==============================================================================
 
class Spriteset_Battle# #--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :viewport1 # ????????????
attr_reader :viewport2 # ????????????
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ?????????
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# ?????????
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# ???????????
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# ??????????
@fog = Plane.new(@viewport1)
@fog.z = 3000
# ??????????????
@character_sprites = []
#for i in $game_map.events.keys.sort
#sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
#@character_sprites.push(sprite)
#end
#@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# ?????
@weather = RPG::Weather.new(@viewport1)
# ???????
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
 
# ?????????
 
# ??????????????
#@battleback_sprite = Sprite.new(@viewport1)
# ????????????
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# ????????????
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
# ?????
@weather = RPG::Weather.new(@viewport1)
# ????????????
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# ????????????
@timer_sprite = Sprite_Timer.new
# ??????
update
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
# ??????????????????????
#if @battleback_sprite.bitmap != nil
#@battleback_sprite.bitmap.dispose
# end
# ??????????????
#@battleback_sprite.dispose
# ??????????????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# ?????
@weather.dispose
# ????????????
for sprite in @picture_sprites
sprite.dispose
end
# ????????????
@timer_sprite.dispose
# ?????????
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def effect?
# ??????????????? true ???
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ??????????????? (????????????)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# ???????????????????????
#if @battleback_name != $game_temp.battleback_name
#@battleback_name = $game_temp.battleback_name
#if @battleback_sprite.bitmap != nil
#@battleback_sprite.bitmap.dispose
#end
#@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
#@battleback_sprite.src_rect.set(0, 0, 640, 320)
#end
# ????????????
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# ???????????
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# ????????????
for sprite in @picture_sprites
sprite.update
end
# ????????????
@timer_sprite.update
# ???????????????
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# ????????????
@viewport4.color = $game_screen.flash_color
# ?????????
@viewport1.update
@viewport2.update
@viewport4.update
end
end



Version 2 (les évenement de la map sont visibles en combat.)

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
#==============================================================================
# [ Spriteset_Battle modifier par Cortez
#------------------------------------------------------------------------------
# ???????????????????????????? Scene_Battle ??
# ????????????
#==============================================================================
 
class Spriteset_Battle# #--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :viewport1 # ????????????
attr_reader :viewport2 # ????????????
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ?????????
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# ?????????
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# ???????????
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# ??????????
@fog = Plane.new(@viewport1)
@fog.z = 3000
# ??????????????
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# ?????
@weather = RPG::Weather.new(@viewport1)
# ???????
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
 
# ?????????
 
# ??????????????
#@battleback_sprite = Sprite.new(@viewport1)
# ????????????
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# ????????????
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
# ?????
@weather = RPG::Weather.new(@viewport1)
# ????????????
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# ????????????
@timer_sprite = Sprite_Timer.new
# ??????
update
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
# ??????????????????????
#if @battleback_sprite.bitmap != nil
#@battleback_sprite.bitmap.dispose
# end
# ??????????????
#@battleback_sprite.dispose
# ??????????????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# ?????
@weather.dispose
# ????????????
for sprite in @picture_sprites
sprite.dispose
end
# ????????????
@timer_sprite.dispose
# ?????????
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def effect?
# ??????????????? true ???
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ??????????????? (????????????)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# ???????????????????????
#if @battleback_name != $game_temp.battleback_name
#@battleback_name = $game_temp.battleback_name
#if @battleback_sprite.bitmap != nil
#@battleback_sprite.bitmap.dispose
#end
#@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
#@battleback_sprite.src_rect.set(0, 0, 640, 320)
#end
# ????????????
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# ???????????
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# ????????????
for sprite in @picture_sprites
sprite.update
end
# ????????????
@timer_sprite.update
# ???????????????
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# ????????????
@viewport4.color = $game_screen.flash_color
# ?????????
@viewport1.update
@viewport2.update
@viewport4.update
end
end



Aller à la page: 1 2 3 4 5 6 7 8 9 10 11 12

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