Night.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

419 connectés actuellement

29380472 visiteurs
depuis l'ouverture

9839 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Le Comptoir Du clickeur

RPG Maker Détente

Hellsoft

Tous nos partenaires

Devenir
partenaire



KGC_SpecialTransition

Change la transition par défaut avant un combat.

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

❤ 0

Auteur : Kameo
Logiciel : RPG Maker VX
Nombre de scripts : 1

Description
Change la transition avant un combat.

Installation
A insérer au-dessus de Main.

Utilisation
Vous pouvez configurer les paramètres de votre transition en début de script.
STOP_WHILE_TRANSITION = true : Si true, arrête tous les événements en cours sur la carte.

SPLASH_SIZE = 32 : La taille en pixels des blocs de transition.
SPLASH_VAGUE = 7.2 : Le déplacement des blocs au cours de la transition.
SPLASH_ROTATE = true : Si true, les blocs effectuent une rotation.

RAND_STRIPE_SIZE = 2 : Largeur des bandes qui apparaissent aléatoirement.

DEFAULT_BATTLE_TRANSITION_TYPE = 1 : Moditifie la transition. Si 0, il s'agit de celle par défaut (BattleStart) ; si 1, il s'agit des blocs ; si 2, des bandes.
DEFAULT_BATTLE_TRANSITION_DURATION = 60 : La durée que doit durer la transition, en frames (60 frames = 1 seconde)
DEFAULT_BATTLE_TRANSITION_DIRECTION = 0 : La direction dans laquelle se dirige l'animation. Pour les blocs (Splash), 0 : centre ; 2 : bas ; 4 : gauche ; 6 : droite ; 8 : haut. Pour les bandes (Stripe), 0 : affichage horizontal ; 1 : affichage verticale.

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/   ◆              Special Transitions - KGC_SpecialTransition         ◆ VX ◆
#_/   ◇                       Last Update: 2008/09/06                         ◇
#_/   ◆                    Translation by Mr. Anonymous                       ◆
#_/   ◆ KGC Site:                                                             ◆
#_/   ◆ http://f44.aaa.livedoor.jp/~ytomy/                                    ◆
#_/   ◆ Translator's Blog:                                                    ◆
#_/   ◆ http://mraprojects.wordpress.com                                      ◆
#_/----------------------------------------------------------------------------
#_/  This script creates special transitional types.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
#==============================================================================
#                              ★ Customization ★
#==============================================================================
 
module KGC
  module SpecialTransition
  #               ◆ Stop Gameplay Process While Transitioning ◆
  #  This toggle allows you to stop the gameplay process while the transition is
  # Taking place. Please note that setting this to false also requires more CPU
  # power, so keep that in mind.
  #   true  : Game play is stopped while the transition is run.
  #   false : Events and game play on the map continue to run in the transition.
  STOP_WHILE_TRANSITION = true
 
  #                        ◆ Splash Block Size ◆
  # This determines how large the blocks are, in pixels. 
  SPLASH_SIZE   = 32
  
  #                      ◆ Splash Block Scattering ◆
  #  This determines how far spread the blocks are moved during the transition.
  SPLASH_VAGUE  = 7.2
  
  #                       ◆ Splash Block Rotation ◆
  # This toggle allows you to enable or disable block rotation.
  #  true  : Each block is rotated.
  #  false : No rotation.
  SPLASH_ROTATE = true
  
  #                      ◆ Random Stripe Pixel Width ◆
  #  This allows you to specify the width of the bars/stripes as used by the
  #  Random Stripe transition. (See Below)
  RAND_STRIPE_SIZE = 2
 
  #                     ◆ Default Battle Transition Type ◆
  # This allows you to set the type of transition that is used by default.
  #   0..Default ("Graphics/BattleStart.png" is used)
  #   1..Splash
  #   2..Random Stripe
  DEFAULT_BATTLE_TRANSITION_TYPE = 1
  
  #                   ◆ Default Battle Transition Duration ◆
  # This allows you to change the time (in frames) in which the transition lasts.
  DEFAULT_BATTLE_TRANSITION_DURATION = 60
  
  #             ◆ Default Battle Transition Movement Direction ◆
  # This allows you to specify to movement pattern of the transition.
  #  <Splash>
  #   0..Move To Center  2..Down  4..Left  6..Right  8..Up
  #  <Random Stripes>
  #   0..Horizontal  1..Vertical
  DEFAULT_BATTLE_TRANSITION_DIRECTION = 0
  end
end
#=============================================================================#
#                          ★ End Customization ★                              #
#=============================================================================#
 
#=================================================#
#                    IMPORT                       #
#=================================================#
 
$imported = {} if $imported == nil
$imported["SpecialTransition"] = true
 
#=================================================#
 
#==============================================================================
# □ KGC::SpecialTransition
#==============================================================================
 
module KGC::SpecialTransition
  # 特殊トランジションタイプ
  module Type
    NONE        = 0  # なし (通常)
    SPLASH      = 1  # スプラッシュ
    RAND_STRIPE = 2  # ランダムストライプ
 
    VALUE_RANGE = SPLASH..RAND_STRIPE
  end
  # 特殊トランジション方向
  module Direction
    HORIZONTAL = 0
    VERTICAL   = 1
  end
end
 
#--------------------------------------------------------------------------
# ○ 1 or -1 を返す
#--------------------------------------------------------------------------
def pmrand
  return (rand(2) == 0 ? 1 : -1)
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
# □ KGC::Commands
#==============================================================================
 
module KGC
module Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ 戦闘トランジションを変更
  #     type      : 形式
  #     duration  : 時間
  #     direction : 方向
  #--------------------------------------------------------------------------
  def set_battle_transition(type = nil, duration = nil, direction = nil)
    $game_system.battle_transition_type      = type
    $game_system.battle_transition_duration  = duration
    $game_system.battle_transition_direction = direction
  end
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション設定
  #     type      : 形式
  #     duration  : 時間
  #     direction : 方向
  #--------------------------------------------------------------------------
  def set_special_transition(type, duration = 60, direction = 0)
    Graphics.set_special_transition(type, duration, direction)
  end
end
end
 
class Game_Interpreter
  include KGC::Commands
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
# ■ Module_Graphics
#==============================================================================
 
module Graphics
  # 特殊トランジションタイプ
  @@_sp_transition_type = KGC::SpecialTransition::Type::NONE
  # 特殊トランジション方向
  @@_sp_transition_dir = 0
  # 特殊トランジション用バッファ
  @@_sp_transition_buffer = nil
  # 特殊トランジション用スプライト
  @@_sp_transition_sprites = []
  # 特殊トランジション期間
  @@_sp_transition_duration_max = -1
  @@_sp_transition_duration = -1
 
  module_function
  unless $@
  #--------------------------------------------------------------------------
  # ● トランジション実行
  #--------------------------------------------------------------------------
  class << Graphics
    alias transition_KGC_SpecialTransition transition
  end
  def transition(duration = 10, filename = "", vague = 40)
    if @@_sp_transition_type != KGC::SpecialTransition::Type::NONE
      duration = 0
    end
 
    transition_KGC_SpecialTransition(duration, filename, vague)
 
    if KGC::SpecialTransition::STOP_WHILE_TRANSITION
      while @@_sp_transition_duration >= 0
        update
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  class << Graphics
    alias update_KGC_SpecialTransition update
  end
  def update
    update_KGC_SpecialTransition
 
    if @@_sp_transition_duration >= 0
      update_special_transition
    end
  end
  end  # unless @
 
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション設定
  #     type     : トランジションタイプ
  #     duration : トランジション期間
  #     dir      : 方向
  #--------------------------------------------------------------------------
  def set_special_transition(type, duration = 90, dir = 0)
    finish_special_transition
 
    return unless KGC::SpecialTransition::Type::VALUE_RANGE.include?(type)
 
    @@_sp_transition_type = type
    @@_sp_transition_dir  = dir
    @@_sp_transition_duration_max = duration
    prepare_special_transition
  end
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション準備
  #--------------------------------------------------------------------------
  def prepare_special_transition
    @@_sp_transition_buffer = Graphics.snap_to_bitmap
 
    # トランジション用変数初期化
    case @@_sp_transition_type
    when KGC::SpecialTransition::Type::SPLASH
      init_splash
    when KGC::SpecialTransition::Type::RAND_STRIPE
      init_rand_stripe
    end
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ○ スプラッシュ初期化
  #--------------------------------------------------------------------------
  def init_splash
    @@_sp_transition_duration = @@_sp_transition_duration_max
    @@_splash_dir = []
    @@_splash_angle = []
    size = KGC::SpecialTransition::SPLASH_SIZE
    hsize = size / 2
    cells = (Graphics.width * Graphics.height) / (size ** 2)
    cols = Graphics.width / size
    rect = Rect.new(0, 0, size, size)
 
    # 各セルの作成・移動方向算出
    cells.times { |i|
      rect.x = i % cols * size
      rect.y = i / cols * size
      sprite = create_special_transition_sprite(rect)
      sprite.bitmap.blt(0, 0, @@_sp_transition_buffer, rect)
      sprite.x += hsize
      sprite.y += hsize
      sprite.ox = sprite.oy = hsize
      @@_sp_transition_sprites << sprite
 
      x = rect.x / size
      y = rect.y / size
      @@_splash_dir[i] = calc_splash_move_direction(x, y, cells, cols)
 
      if KGC::SpecialTransition::SPLASH_ROTATE
        @@_splash_angle[i] = rand(24) - 12
      else
        @@_splash_angle[i] = 0
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション用スプライト生成
  #     rect : スプライトの位置・サイズ
  #--------------------------------------------------------------------------
  def create_special_transition_sprite(rect)
    sprite = Sprite.new
    sprite.bitmap = Bitmap.new(rect.width, rect.height)
    sprite.x = rect.x
    sprite.y = rect.y
    sprite.z = 20000
    return sprite
  end
  #--------------------------------------------------------------------------
  # ○ スプラッシュ移動方向計算
  #     x, y  : 基準位置
  #     cells : セル数
  #     cols  : 列数
  #--------------------------------------------------------------------------
  def calc_splash_move_direction(x, y, cells, cols)
    vague = KGC::SpecialTransition::SPLASH_VAGUE
    vx = vy = 0
    case @@_sp_transition_dir
    when 0  # 中央から広がる
      x -= cols >> 1
      y -= (cells / cols) >> 1
      r = Math.sqrt(x ** 2 + y ** 2) / vague
      if r != 0
        vx = x / r
        vy = y / r
      else
        vx = ( x != 0 ? (x * 1.5) : (pmrand * vague) )
        vy = ( y != 0 ? (y * 1.5) : (pmrand * vague) )
      end
      vx += (rand - 0.5) * vague
      vy += (rand - 0.5) * vague
    when 2  # 下
      rows = cells / cols
      vx = (rand(50) - 25) / 10.0
      vy = 1 + vague * (rows - y) / rows * (1.0 + rand / 5.0)
    when 4  # 左
      vx = -1 - vague * (x + 1) / cols * (1.0 + rand / 5.0)
      vy = (rand(50) - 25) / 10.0
    when 6  # 右
      vx = 1 + vague * (cols - x) / cols * (1.0 + rand / 5.0)
      vy = (rand(50) - 25) / 10.0
    when 8  # 上
      rows = cells / cols
      vx = (rand(50) - 25) / 10.0
      vy = -1 - vague * (y + 1) / rows * (1.0 + rand / 5.0)
    end
 
    mag = 60.0 / @@_sp_transition_duration_max
    return [vx * mag, vy * mag]
  end
  #--------------------------------------------------------------------------
  # ○ ランダムストライプ初期化
  #--------------------------------------------------------------------------
  def init_rand_stripe
    case @@_sp_transition_dir
    when KGC::SpecialTransition::Direction::VERTICAL
      @@_rand_stripe_direction = 0
    else
      @@_rand_stripe_direction = 1
    end
    size = KGC::SpecialTransition::RAND_STRIPE_SIZE
    bands = (@@_rand_stripe_direction == 0 ?
      Graphics.width : Graphics.height) / size
 
    @@_sp_transition_duration = @@_sp_transition_duration_max
    @@_rand_stripe_deleted = []
    @@_rand_stripe_deleted_count = 0
    # ランダム消去用配列を生成
    ary = (0...bands).to_a
    @@_rand_stripe_index_array = ary.sort_by { rand }
 
    sprite = create_special_transition_sprite(@@_sp_transition_buffer.rect)
    sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    sprite.bitmap.blt(0, 0, @@_sp_transition_buffer,
      @@_sp_transition_buffer.rect)
    @@_sp_transition_sprites << sprite
  end
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション更新
  #--------------------------------------------------------------------------
  def update_special_transition
    if @@_sp_transition_duration == 0
      finish_special_transition
      return
    end
 
    case @@_sp_transition_type
    when KGC::SpecialTransition::Type::SPLASH
      update_splash
    when KGC::SpecialTransition::Type::RAND_STRIPE
      update_rand_stripe
    end
    @@_sp_transition_duration -= 1
  end
  #--------------------------------------------------------------------------
  # ○ スプラッシュ更新
  #--------------------------------------------------------------------------
  def update_splash
    opacity = 384 * @@_sp_transition_duration / @@_sp_transition_duration_max
 
    # セルを移動
    @@_sp_transition_sprites.each_with_index { |sprite, i|
      sprite.x += @@_splash_dir[i][0]
      sprite.y += @@_splash_dir[i][1]
      sprite.angle += @@_splash_angle[i]
      sprite.opacity = opacity
    }
  end
  #--------------------------------------------------------------------------
  # ○ ランダムストライプ更新
  #--------------------------------------------------------------------------
  def update_rand_stripe
    dir = @@_rand_stripe_direction
    size = KGC::SpecialTransition::RAND_STRIPE_SIZE
    bands = (dir == 0 ? Graphics.width : Graphics.height) / size
    rect = Rect.new(0, 0,
      (dir == 0 ? size : Graphics.width), (dir == 0 ? Graphics.height : size))
    buffer = @@_sp_transition_buffer
    sprite = @@_sp_transition_sprites[0]
    phase = @@_sp_transition_duration_max - @@_sp_transition_duration
 
    # 消去箇所を設定
    count = (bands - bands * @@_sp_transition_duration /
      @@_sp_transition_duration_max) - @@_rand_stripe_deleted_count
    while count > 0
      @@_rand_stripe_deleted[@@_rand_stripe_index_array.pop] = true
      @@_rand_stripe_deleted_count += 1
      count -= 1
    end
 
    # 未消去部分のみ描画
    sprite.bitmap.clear
    bands.times { |i|
      unless @@_rand_stripe_deleted[i]
        if dir == 0
          # 縦
          rect.x = i * size
          sprite.bitmap.blt(rect.x, 0, buffer, rect)
        else
          # 横
          rect.y = i * size
          sprite.bitmap.blt(0, rect.y, buffer, rect)
        end
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 特殊トランジション終了
  #--------------------------------------------------------------------------
  def finish_special_transition
    if @@_sp_transition_buffer != nil
      @@_sp_transition_buffer.dispose
      @@_sp_transition_buffer = nil
    end
 
    case @@_sp_transition_type
    when KGC::SpecialTransition::Type::SPLASH
      @@_splash_dir = nil
      @@_splash_angle = nil
    when KGC::SpecialTransition::Type::RAND_STRIPE
      @@_rand_stripe_direction = nil
      @@_rand_stripe_deleted = nil
      @@_rand_stripe_deleted_count = nil
      @@_rand_stripe_index_array = nil
    end
    @@_sp_transition_type = KGC::SpecialTransition::Type::NONE
 
    @@_sp_transition_sprites.each { |sprite|
      sprite.bitmap.dispose
      sprite.dispose
    }
    @@_sp_transition_sprites = []
    @@_sp_transition_duration_max = -1
    @@_sp_transition_duration = -1
  end
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
# ■ Game_System
#==============================================================================
 
class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_writer   :battle_transition_type       # 戦闘トランジション : 形式
  attr_writer   :battle_transition_duration   # 戦闘トランジション : 時間
  attr_writer   :battle_transition_direction  # 戦闘トランジション : 方向
  #--------------------------------------------------------------------------
  # ○ 戦闘トランジション : 形式
  #--------------------------------------------------------------------------
  def battle_transition_type
    if @battle_transition_type == nil
      return KGC::SpecialTransition::DEFAULT_BATTLE_TRANSITION_TYPE
    else
      return @battle_transition_type
    end
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘トランジション : 時間
  #--------------------------------------------------------------------------
  def battle_transition_duration
    if @battle_transition_duration == nil
      return KGC::SpecialTransition::DEFAULT_BATTLE_TRANSITION_DURATION
    else
      return @battle_transition_duration
    end
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘トランジション : 方向
  #--------------------------------------------------------------------------
  def battle_transition_direction
    if @battle_transition_direction == nil
      return KGC::SpecialTransition::DEFAULT_BATTLE_TRANSITION_DIRECTION
    else
      return @battle_transition_direction
    end
  end
end
 
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
 
#==============================================================================
# ■ Scene_Map
#==============================================================================
 
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● バトル画面への切り替え
  #--------------------------------------------------------------------------
  alias call_battle_KGC_SpecialTransition call_battle
  def call_battle
    call_battle_KGC_SpecialTransition
 
    KGC::Commands.set_special_transition(
      $game_system.battle_transition_type,
      $game_system.battle_transition_duration,
      $game_system.battle_transition_direction)
  end
end




Mis à jour le 8 décembre 2020.





Aucun commentaire n'a été posté pour le moment.

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

Haut de page

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

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers