Oniromancie: Scripts - Continuous Maps


Comment ça marche?

Aëdemphia
Par Sylvanor

Fighting Robots Quest
Par Boulon

Forstale
Par Ødd Clock

Geex
Par roys

Inexistence
Par Falco

La Légende d'Ibabou
Par Zaitan

Lije
Par Gaetz

LoveMaster
Par Cuddlefox

Sarcia
Par Kaëlar

Super Mario RPG - Lost Souls
Par Omegabowser

News: Concours des Alex d'Or 2017-18: (...) / News: MegaMaker : créez votre propre (...) / News: Test de Tinker Quarry / Sorties: Leave the Room / Jeux: Leave the Room /

Chat  (10 connectés)

Bienvenue
visiteur !






publicité RPG Maker!

Statistiques

Liste des
membres


Contact

58 connectés actuellement

9179638 visiteurs
depuis l'ouverture

715 visiteurs
aujourd'hui

Groupe Facebook

Barre de séparation

Partenaires




TOP
GAMEMAKING


Les 5 plus
visités

Lunae, le baz'arts d'Emz0

Le studio du chat vert

Pixelandgame

Tashiroworld

HeyMakeGames

Au hasard

Co-RPG

Ton-PC

Final Fantasy VII Origin

Les deux derniers

Lunae, le baz'arts d'Emz0

Le studio du chat vert

Nos autres partenaires

Devenir
partenaire


Barre de séparation

Un site du réseau
War Paradise

Annuaires référenceurs





Continuous Maps
Script pour RPG Maker VX
Ecrit par cari974

Ce script permet de relier toutes les maps.
Il évite l'utilisation de téléportations.
Tester le pour mieux comprendre.
Pour relier les maps entre elles : regardez à partir des lignes 85.

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
 
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Continuous Maps by Blizzard
# Version: 1.2
# Type: Custom Map System
# Date: 14.12.2009
# Date v1.2: 11.9.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">http://creativecommons.org/licenses/by-nc-sa/3.0/</a> )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
# 
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 
# Compatibility:
# 
#   - possible incompatibility in this script will lie in scripts that modify
#       map transfers.
#
# Features:
# 
#   - virtually creates one continuous map from any number of map fragments
#   - easy to configure
# 
# Instructions:
# 
# - Explanation:
# 
#   This Script will allow you to make the game simulate a continuous map using
#   smaller maps. The system displays the current map and the neighbor maps.
#   Walking over a map border will cause the new map to be loaded as main map
#   and the neighbor maps will be changed.
# 
# 
# Notes:
# 
#   - You may notice lag when walking over a map border.
#   - Do not use too big maps as it increases loading time and the short moment
#     of lag will become more and more visible.
#   - Remember to connect ALL neighbor maps or you might experience bugs.
#   - For Vx, the most noticable bug is the centering of the screen; if you
#   - Move from a map onto a map that is connected to a map that is taller or
#       wider, the screen will 'jerk' to the player to center around them. This
# 
# If you find any bugs, please report them at rpgmakervx.net's Continuous Map
# topic.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
 
module CTMAPS
  
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # define all neighbor maps here
  MAP_DATA = [
    # [MAP_ID1, MAP_ID2, X_OFFSET, Y_OFFSET]
    [1, 2, 17, 0], # connected map 1 and 2 where 2 has an X, Y offset of 25, 0
    [2, 3, 17, 0],
    [3, 4, 0, 13]
  ]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  MAP_DATA.compact!
  MAPS = {}
  MAP_DATA.each {|data|
      MAPS[data[0]] = [] if MAPS[data[0]] == nil
      MAPS[data[0]] |= [data[1, 3]]
      MAPS[data[1]] = [] if MAPS[data[1]] == nil
      MAPS[data[1]] |= [[data[0], -data[2], -data[3]]]}
  MAP_DATA = nil
  $ctmaps = 1.2
  
end
 
 
#==============================================================================
# Game_Temp
#==============================================================================
 
class Game_Temp
  
  attr_accessor :player_no_straighten
  attr_accessor :normal_transfer
  attr_accessor :display_scroll_limit
  
  alias cont_maps_init initialize unless $@
  def initialize
    cont_maps_init
    @player_no_straighten = true
    @normal_transfer = false
    @display_scroll_limit = false
  end
  
end
  
#==============================================================================
# Game_Character
#==============================================================================
 
class Game_Character
  
  attr_accessor :x
  attr_accessor :y
  attr_accessor :real_x
  attr_accessor :real_y
  
  alias straighten_ctmaps_later straighten
  def straighten
    if $game_temp.player_no_straighten
      $game_temp.player_no_straighten = nil
      return
    end
    straighten_ctmaps_later
  end
  
  alias moveto_ctmaps_later moveto
  def moveto(x, y)
    ox, oy = $game_map.upper_left;
    moveto_ctmaps_later(x - ox, y - oy)
  end
  
end
 
#==============================================================================
# Game_Player
#==============================================================================
 
class Game_Player < Game_Character
  
  alias center_ctmaps_later center
  def center(x, y)
    ox, oy = $game_map.upper_left
    center_ctmaps_later(x - ox, y - oy)
  end
end
 
#==============================================================================
# Game_Map
#==============================================================================
 
class Game_Map
  
  attr_reader :upper_left
  attr_reader :lower_right
  attr_reader :maps
    
  alias init_ctmaps_later initialize
  def initialize
    @maps = {}
    @events = {}
    init_ctmaps_later
  end
  
  alias setup_ctmaps_later setup
  def setup(map_id)
    last_maps = @maps
    last_map_id = @map_id
    @upper_left = [0, 0]
    @lower_right = [0, 0]
    events = @events
    setup_ctmaps_later(map_id)
    @maps = get_neighbor_maps
    if !@maps.has_key?(last_map_id)
      @events = {}
      last_maps = {}
      last_map_id = 0
    else
      @events = events
    end
    setup_continuous_map
    setup_continuous_events(last_maps, last_map_id)
  end
 
  def get_neighbor_maps
    maps = {}
    maps[@map_id] = [@map, 0, 0]
    @upper_left = [0, 0]
    @lower_right = [@map.width, @map.height]
    if CTMAPS::MAPS.has_key?(@map_id)
      CTMAPS::MAPS[@map_id].each {|data|
          id, x, y = data
          if @maps[id] != nil
            map = @maps[id][0]
          else
            map = load_data(sprintf('Data/Map%03d.rvdata', id))
          end
          maps[id] = [map, x, y]
          @upper_left[0] = x if @upper_left[0] > x
          @upper_left[1] = y if @upper_left[1] > y
          width, height = x + map.width, y + map.height
          @lower_right[0] = width if @lower_right[0] < width
          @lower_right[1] = height if @lower_right[1] < height}
      maps.each_value {|data|
          data[1] -= @upper_left[0]
          data[2] -= @upper_left[1]}
    end
    return maps
  end
  
  def setup_continuous_map
    width = @lower_right[0] - @upper_left[0]
    height = @lower_right[1] - @upper_left[1]
    data = Table.new(width, height, 3)
    @map = @map.clone
    @map.events = {}
    @maps.each_key {|id|
        map, ox, oy = @maps[id]
        if id == @map_id
          map.events.each_key {|i| @map.events[i] = map.events[i]}
        else
          map.events.each_key {|i| @map.events[id * 1000 + i] = map.events[i]}
        end
        (0...map.width).each {|x| (0...map.height).each {|y| (0...3).each {|z|
            data[x + ox, y + oy, z] = map.data[x, y, z]}}}}
    @map.width = width
    @map.height = height
    @map.data = data
  end
  
  def setup_continuous_events(last_maps, last_map_id)
    correct_event_positions(last_maps) if last_maps[@map_id] != nil
    delete_removed_events(last_maps, last_map_id)
    shift_events_from_last_map(last_maps, last_map_id) if last_map_id != 0
    shift_events_for_new_map
    add_new_events(last_maps)
  end
  
  def delete_removed_events(last_maps, last_map_id)
    keys = []
    @maps.each_key {|id|
        keys += @events.keys.find_all {|key|
            @events[key].real_x < 0 || @events[key].real_y < 0 ||
            @events[key].real_x >= (@lower_right[0] - @upper_left[0]) * 256 ||
            @events[key].real_y >= (@lower_right[1] - @upper_left[1]) * 256}}
    (keys | keys).each {|key| @events.delete(key)}
  end
  
  def shift_events_from_last_map(last_maps, last_map_id)
    @events.each_key {|key|
        if key < 1000
          @events[last_map_id * 1000 + key] = @events[key]
          @events.delete(key)
        end}
  end
  
  def shift_events_for_new_map
    @events.each_key {|key|
        if key >= @map_id * 1000 && key < (@map_id + 1) * 1000
          @events[key % 1000] = @events[key]
          @events.delete(key)
        end}
  end
  
  def correct_event_positions(last_maps)
    sx = @maps[@map_id][1] - last_maps[@map_id][1]
    sy = @maps[@map_id][2] - last_maps[@map_id][2]
    @events.each_value {|event|
    x, y = sx, sy
    event.x += x
    event.y += y
    event.real_x += sx * 256
    event.real_y += sy * 256}
  end
  
  def add_new_events(last_maps = {})
    if last_maps[@map_id] == nil
      @maps[@map_id][0].events.each_key {|i|
          if @events[i] == nil
            @events[i] = Game_Event.new(@map_id, @maps[@map_id][0].events[i])
          end}
    end
    (@maps.keys - last_maps.keys - [@map_id]).each {|id|
        map, sx, sy = @maps[id]
        sx -= @maps[@map_id][1]
        sy -= @maps[@map_id][2]
        map.events.each_key {|i|
            if @events[id * 1000 + i] == nil
              @events[id * 1000 + i] = event = Game_Event.new(id, map.events[i])
              x, y = sx, sy
              event.x += x
              event.y += y
              event.real_x += sx * 256
              event.real_y += sy * 256
            end}}
  end
  alias update_ctmaps_later update
  def update
    update_ctmaps_later
    return if $game_player.moving? || @maps.size <= 1
    map, x, y = @maps[@map_id]
    if $game_player.real_x < x * 256 || $game_player.real_y < y * 256 ||
        $game_player.real_x >= x * 256 + map.width * 256 ||
        $game_player.real_y >= y * 256 + map.height * 256
      (@maps.keys - [@map_id]).each {|id|
          map, x, y = @maps[id]
          if $game_player.real_x >= x * 256 && $game_player.real_y >= y * 256 &&
              $game_player.real_x < x * 256 + map.width * 256 &&
              $game_player.real_y < y * 256 + map.height * 256
              $game_temp.player_no_straighten = true
              nx = $game_player.real_x / 256 - x
              ny = $game_player.real_y / 256 - y
              p "map_id = #{map_id}, new_map_id = #{id}, ox,oy = #{$game_player.x},#{$game_player.y}, nx,ny = #{nx},#{ny}" if Input.press?(Input::F5)
            $game_player.reserve_transfer(id, nx, ny, 0)
            break
          end}
    end
  end 
  
end
 
class Scene_Map < Scene_Base
  
  alias cont_map_updt_transfer update_transfer_player unless $@
  def update_transfer_player
    if !$game_temp.normal_transfer
      do_new_transfer
      $game_temp.normal_transfer = false
    else
      cont_map_updt_transfer
    end
  end
  
  def do_new_transfer
    return unless $game_player.transfer?
    @spriteset.dispose              # Dispose of sprite set
    $game_player.perform_transfer   # Execute player transfer
    $game_map.autoplay              # Automatically switch BGM and BGS
    $game_map.update
    Graphics.wait(0)
    @spriteset = Spriteset_Map.new  # Recreate sprite set
    Input.update
  end
end
  
class Game_Interpreter
  
  def normal_transfer(boolean)
    $game_temp.normal_transfer = boolean
  end
  
end
 




Moses - posté le 17/01/2015 à 00:08:28. (2 messages postés)

:grah1je suis sur VX Ace, alors je dirais juste que tenter de bidouiller ce script pour RPG M VX Ace, prendra beaucoup de temps. Les problèmes sur lesquels j'ai butés sont :

- nombre d'arguments entre le script ci-présent, et celui appelé Scene Map (mais bon, suffit apparemment de les supprimer):sourit

- nom de fichiers maps (sur RPG M VX Ace, c'est au format rvdata[u]2
- Incapacité de faire démarrer le personnage sur une map autre que la première du projet (sous peine d'être téléporté dans l'eau ou un mur ( voire le vide)

je suis peut-être rapide à comprendre, mais là j'avoue que c'est lourd. je vais plutôt essayer de faire un script de A à Z

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

Haut de page

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

Plan du site:

Activité: Accueil | News | Forum | Flash-news | Chat | Commentaires | Galerie | Screen de la semaine | Sorties | Articles perso | Livre d'or | Recherche
Jeux: Index jeux séparés | Top Classiques | Top Originaux | Les autres | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Jeux complets | Proposer
Rubriques: Le Wiki | Collection Oniro | Tutoriaux | Scripts | Guides | Gaming-Live | Tests | Making-of | Interviews | Articles perso | OST | L'Annuaire | Divers | Palmarès
Hébergés: Aëdemphia | Fighting Robots Quest | Forstale | Geex | Inexistence | La Légende d'Ibabou | Lije | LoveMaster | Sarcia | Super Mario RPG - Lost Souls
Ressources: Jeux | Programmes | Packs de ressources | Midis | Eléments séparés | Sprites
RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis