Bienvenue visiteur !
|
Statistiques
Liste des membres
Contact
Mentions légales
295 connectés actuellement
30732102 visiteurs depuis l'ouverture
2080 visiteurs aujourd'hui
Partenaires
Tous nos partenaires
Devenir partenaire
|
madmanu -
posté le 10/04/2013 à 17:16:04 (85 messages postés)
| | Domaine concerné: event making / théorie Logiciel utilisé: VX Ace j'aimerai faire un jeu ou la map est généré aléatoirement . j'ai besoin d'aide pour la théorie. mon idée était de faire plein de petite map (17/13) et quand le héros changés de map et qu'il allait vers une map "inconnue" une variable aléatoire choisissait une map au hasard et stockait son ID dans une variable (il y a une variable / map).J'espere que ce n'est pas trop incompréhensible ^^'
le problème c'est que du coup une même map peut être a plusieurs endroit a la fois et c'est quelque chose que j'aimerai éviter dans mon jeu ... donc si vous avez d'autres idée n'hésitez pas
|
Cortez -
posté le 10/04/2013 à 21:17:57 (524 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
- 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.
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 |
|
mtarzaim -
posté le 11/04/2013 à 01:23:08 (2926 messages postés)
| Anaxagoras -500 BC | Pourquoi s'embeter avec un script ?
C'est juste une histoire de téléporteurs qui relient les map entre elles.
Sur la première map, on génère une suite de MapID parmi les mapID existantes.
Pour 10 maps, on aura besoin de 11 variables :
- NumeroOrdreActuel, qui indique où dans l'ordre des maps le joueur se trouve actuellement (commence à 1)
- MapID1
- MapID2
- MapID3
- MapID4
- etc.
Sur chaque carte, le téléporteur aura dans sa page d'évènement :
Si numeroOrdreActuel = 1 allez à la map MapID1
Si numeroOrdreActuel = 2 allez à la map MapID2
Si numeroOrdreActuel = 3 allez à la map MapID3
etc.
NumeroOrdreActuel + 1
Sur la première map de départ, on génère la liste des mapID, on fait commencer le numeroOrdreActuel à 1, et c'est parti avec le premier téléporteur.
POur cette génération, on génère MapID1 avec une variable aléatoire. Puis on génère MapID2, en vérifiant si le résultat est différent de MapID1.
Même chose avec MapID3, mais en vérifiant sa différence avec MapID1 et 2.
etc.
Ca fera des pages et des pages, mais c'est principalement du copié-collé.
|
Projets terminés : DIX Life Precious - TheFrogStudio.Net |
Cortez -
posté le 11/04/2013 à 09:39:12 (524 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 :
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[/^[^,]*(,.*)/, 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[/^[^,]*(,.*)/, 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 :
|
mtarzaim -
posté le 11/04/2013 à 14:09:33 (2926 messages postés)
| Anaxagoras -500 BC | Cortez a dit:
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...)
|
Sauf que ces maps générées seront des maps génériques, sans ame ou sans particularité. Juste une suite d'arènes. Je trouve plus intéressant de proposer plusieurs mini-map reliées aléatoirement entre elles, parmi une trentaine de mini-map chacune avec son propre "twist", ses propres events et son propre style.
Ensuite, tout dépend quel genre de jeu il veut produire. Mais je tends à penser que des maps conçues à la main seront plus intéressante pour le joueur. D'ailleurs, j'ai l'impression que son but premier est d'offrir une expérience unique pour chaque joueur, pas à chaque nouvelle partie.
|
Projets terminés : DIX Life Precious - TheFrogStudio.Net |
madmanu -
posté le 11/04/2013 à 20:19:59 (85 messages postés)
| | en effet , il est important que je fasse les maps a la main car il faut placer certains event etc... de plus vos scripts ont l'air bien mais je travaille sur VX ace et il me semble qu'ils sont sur XP aprés je préfère faire quelque chose en event que je comprend et que je suis en mesure de manipuler :/
EDIT: Marzaim ta technique est bien je voulais faire le meme systeme mais j'arrivais pas a organiser ma pensé . Si je comprend bien , si le joueur veut revenir en arriere il suffit de mettre -1 a la variable ordre map pour revenir a la map précédente sans qu'elle soit changé (j'ai bon , j'ai bon hein dit )
|
mtarzaim -
posté le 11/04/2013 à 22:29:05 (2926 messages postés)
| Anaxagoras -500 BC | madmanu a dit:
EDIT: Marzaim ta technique est bien je voulais faire le meme systeme mais j'arrivais pas a organiser ma pensé . Si je comprend bien , si le joueur veut revenir en arriere il suffit de mettre -1 a la variable ordre map pour revenir a la map précédente sans qu'elle soit changé (j'ai bon , j'ai bon hein dit )
|
Oui, voilà.
Le souci, c'est si tu veux avoir plus de deux sorties par map.
Il va falloir pas mal jongler, et je pense qu'une génération via un script (pour construire l'arborescence de cartes) sera préférable dans ce cas.
Dans l'idéal, ce serait plus simple s'il n'y avait qu'un seul téléporteur par carte.
Le joueur serait ainsi obligé d'avancer, laissant derrière lui ennemis mortels et items précieux.
D'un point de vue scénario, ce serait cool aussi. On pourrait y ajouter une dimension sentimentale : le joueur devra à plusieurs reprises abandonner un allié derrière lui (ou choisir entre deux alliés) pour continuer à avancer, et ainsi terminer sa quête.
Un genre d'Histoire sans Fin, où le Néant dévore le labyrinthe carte par carte, et où le héros doit ramener la reine en son palais au péril de sa vie (et de celle de ses alliés).
|
Projets terminés : DIX Life Precious - TheFrogStudio.Net |
madmanu -
posté le 11/04/2013 à 22:47:07 (85 messages postés)
| | bon , normalement dans mon jeu , les cartes sont ouvertes mais bon , je vaius m'entrainer sur un dungeon rpg et je verrai aprés
EDIT : j'ai refait le systeme mais il est assez instable et ne marche pas a tout les coups :/ je n'arrive pas a classer les variables de façon a ce qu'elles ne soient jamais égales a une autre :/
|
mtarzaim -
posté le 13/04/2013 à 10:29:56 (2926 messages postés)
| Anaxagoras -500 BC | D'abord, dans un évènement en Autorun, je fais une liste de variables avec chacune le mapID des cartes à relier au pif entre elles.
Carte1 = "donjon1" (ou MapID de la map intitulé "donjon1")
Carte2 = "foret3"
Carte3 = "village 5"
Carte4 = "mine 1"
Carte5 = "montagne 8"
Carte6 = "grotte 4"
Ensuite, je choisis au pif la première carte de mon donjon aléatoire.
Variable MonAleatoire = nombre aléatoire entre 1 et 6 (car j'ai six cartes disponibles actuellement)
Si MonAleatoire = 1 alors MaCarteAleatoire1 = Carte1
Si MonAleatoire = 2 alors MaCarteAleatoire1 = Carte2
Si MonAleatoire = 3 alors MaCarteAleatoire1 = Carte3
Si MonAleatoire = 4 alors MaCarteAleatoire1 = Carte4
Si MonAleatoire = 5 alors MaCarteAleatoire1 = Carte5
Si MonAleatoire = 6 alors MaCarteAleatoire1 = Carte6
Puis, je fais de même avec la deuxième carte de mon donjon aléatoire. Mais avec une boucle !
Boucle
Variable MonAleatoire = nombre aléatoire entre 1 et 6
Si MonAleatoire = 1 alors MaCarteAleatoire2 = Carte1
Si MonAleatoire = 2 alors MaCarteAleatoire2 = Carte2
Si MonAleatoire = 3 alors MaCarteAleatoire2 = Carte3
Si MonAleatoire = 4 alors MaCarteAleatoire2 = Carte4
Si MonAleatoire = 5 alors MaCarteAleatoire2 = Carte5
Si MonAleatoire = 6 alors MaCarteAleatoire2 = Carte6
Si Carte2 /= Carte1 alors Sortir de la boucle
fin boucle
J'applique le même principe avec la CarteAleatoire3
Boucle
Variable MonAleatoire = nombre aléatoire entre 1 et 6
Si MonAleatoire = 1 alors MaCarteAleatoire3 = Carte1
Si MonAleatoire = 2 alors MaCarteAleatoire3 = Carte2
Si MonAleatoire = 3 alors MaCarteAleatoire3 = Carte3
Si MonAleatoire = 4 alors MaCarteAleatoire3 = Carte4
Si MonAleatoire = 5 alors MaCarteAleatoire3 = Carte5
Si MonAleatoire = 6 alors MaCarteAleatoire3 = Carte6
Si Carte3 /= Carte1 alors
Si Carte3 /= Carte2 alors Sortir de la boucle
fin boucle
Au final, j'ai les variables MaCarteAleatoire de 1 à 3 qui ont pour valeur un ordre aléatoire des cartes de mon jeu parmi les six disponibles.
Plus il y a de cartes, plus le nombre de "Si" va augmenter. Ce qui va devenir assez peu lisible dans une page d'event. Il faudra le fragmenter sur plusieurs pages, et utiliser la variable locale pour passer d'une page à l'autre.
Je peux aussi choisir de découper mon donjon en sous-sections de 3 cartes parmi 6 possibles. Cet algorithme sera donc réutilisé plusieurs fois de suite.
Il faudra remplacer MaCarteAleatoireX par SectionX-MaCarteAleatoireX.
|
Projets terminés : DIX Life Precious - TheFrogStudio.Net |
madmanu -
posté le 13/04/2013 à 13:59:38 (85 messages postés)
| | suis je bete j'avais completement zappé le fait d'intriquer des conditions ^^
| Index du forum > Entraide > [VX Ace] besoin d'aide théorique sur la génération aléat
|
|
|