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
| =begin =========================================================================
Dekita's v1.2
★ FOG™ ★
================================================================================
Script Information:
====================
This script allows for upto 3 different fogs to be displayed on the map and in
battle.
I have limited it to 3 for game performance sake, also 3 is more than
enough imo...
Features :~
Upto 3 seperate fogs,(per map)
multiple options for each fog,
e.g color / scroll speed / opacity / z value (importance)
Note : if z value is lower than 0 it will be shown under the map like a parallax
================================================================================
★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
================================================================================
1. You must give credit to "Dekita"
2. You are NOT allowed to repost this script.(or modified versions)
3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
4. You are NOT allowed to use this script for Commercial games.
5. ENJOY!
"FINE PRINT"
By using this script you hereby agree to the above terms and conditions,
if any violation of the above terms occurs "legal action" may be taken.
Not understanding the above terms and conditions does NOT mean that
they do not apply to you.
If you wish to discuss the terms and conditions in further detail you can
contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
================================================================================
History:
=========
D /M /Y
14/o1/2o13 - improved efficiency,
13/o1/2o13 - fixed bug with $BTEST,
12/o1/2o13 - finished,
??/o1/2o13 - started,
================================================================================
Known Bugs:
============
N/A
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If a new bug is found please contact me at
http://dekitarpg.wordpress.com/
================================================================================
INSTRUCTIONS:
==============
Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
================================================================================
Credit and Thanks to :
=======================
Hyde - for asking me to write this ^_^
================================================================================
NOTETAGS: (map noteboxes)
==========
<fog id: NAME>
NAME = the name of the fog file (must be in parallax folder)
<id move: x, y>
x / y = how mych the fog moves per frame update
<id opac: opacity>
opacity = the transparency of the graphic
<id col: red,green,blue,alpha>
reg / green / blue / aplha = the color / visibility values
<id z: z_value>
z_value = the importance of the fog. below 0 will show the image behind the map.
id can be : a / b / c
e.g
<fog a: FOG_NAME>
<a move: 1, 1>
<a opac: 150>
<a z: 50>
=end #=========================================================================#
module FOG_By_Dekita
Default_Fog_A_z = 51
Default_Fog_B_z = 52
Default_Fog_C_z = 53
Show_In_Battle = true
#####################
# CUSTOMISATION END #
end #####################
#☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
# #
# http://dekitarpg.wordpress.com/ #
# #
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
#===============================================================================#
# ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
# YES?\.\. #
# OMG, REALLY? \| #
# WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
# I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
#===============================================================================#
$imported = {} if $imported.nil?
$imported[:Dekita_FOG] = true
#===============================================================================#
class RPG::Map
#===============================================================================#
attr_reader(:can_fog)
attr_reader(:fog_a_name)
attr_reader(:fog_a_move)
attr_reader(:fog_a_opac)
attr_reader(:fog_a_z)
attr_reader(:fog_a_color)
attr_reader(:fog_b_name)
attr_reader(:fog_b_move)
attr_reader(:fog_b_opac)
attr_reader(:fog_b_z)
attr_reader(:fog_b_color)
attr_reader(:fog_c_name)
attr_reader(:fog_c_move)
attr_reader(:fog_c_opac)
attr_reader(:fog_c_z)
attr_reader(:fog_c_color)
def get_fog_info
@can_fog = false
@fog_a_name = ""
@fog_a_move = [0, 0]
@fog_a_opac = 255
@fog_a_z = FOG_By_Dekita::Default_Fog_A_z
@fog_a_color = nil
@fog_b_name = ""
@fog_b_move = [0, 0]
@fog_b_opac = 255
@fog_b_z = FOG_By_Dekita::Default_Fog_B_z
@fog_b_color = nil
@fog_c_name = ""
@fog_c_move = [0, 0]
@fog_c_opac = 255
@fog_c_z = FOG_By_Dekita::Default_Fog_C_z
@fog_c_color = nil
self.note.split(/[\r\n]+/).each { |line| case line
when /<fog a: (.*)/i ; @can_fog = true ; @fog_a_name = $1.to_s
when /<a move: (.*), (.*)>/i ; @fog_a_move = [$1.to_i, $2.to_i]
when /<a opac: (.*)/i ; @fog_a_opac = $1.to_i
when /<a z: (.*)/i ; @fog_a_z = $1.to_i
when /<a col: (.*),(.*),(.*),(.*)>/im
@fog_a_color = Color.new($1.to_i,$2.to_i,$3.to_i,$4.to_i)
when /<fog b: (.*)/i ; @can_fog = true ; @fog_b_name = $1.to_s
when /<b move: (.*), (.*)>/i ; @fog_b_move = [$1.to_i, $2.to_i]
when /<b opac: (.*)/i ; @fog_b_opac = $1.to_i
when /<b z: (.*)/i ; @fog_b_z = $1.to_i
when /<b col: (.*),(.*),(.*),(.*)>/im
@fog_b_color = Color.new($1.to_i,$2.to_i,$3.to_i,$4.to_i)
when /<fog c: (.*)/i ; @can_fog = true ; @fog_c_name = $1.to_s
when /<c move: (.*), (.*)>/i ; @fog_c_move = [$1.to_i, $2.to_i]
when /<c opac: (.*)/i ; @fog_c_opac = $1.to_i
when /<c z: (.*)/i ; @fog_c_z = $1.to_i
when /<c col: (.*),(.*),(.*),(.*)>/im
@fog_c_color = Color.new($1.to_i,$2.to_i,$3.to_i,$4.to_i)
end ; } # self.note.split
end
end
#===============================================================================#
class Game_Map
#===============================================================================#
alias :fogsys :setup
alias :sdp_for_fog :set_display_pos
alias :s_d_for_fog :scroll_down
alias :s_l_for_fog :scroll_left
alias :s_r_for_fog :scroll_right
alias :s_u_for_fog :scroll_up
alias :update_for_fog :update_parallax
attr_reader(:has_fog)
attr_reader(:fog_a_name)
attr_reader(:fog_a_move)
attr_reader(:fog_a_opacity)
attr_reader(:fog_a_z)
attr_reader(:fog_a_color)
attr_reader(:fog_b_name)
attr_reader(:fog_b_move)
attr_reader(:fog_b_opacity)
attr_reader(:fog_b_z)
attr_reader(:fog_b_color)
attr_reader(:fog_c_name)
attr_reader(:fog_c_move)
attr_reader(:fog_c_opacity)
attr_reader(:fog_c_z)
attr_reader(:fog_c_color)
def setup(map_id)
fogsys(map_id)
@map.get_fog_info
@has_fog = @map.can_fog
setup_fog_a
setup_fog_b
setup_fog_c
end
def setup_fog_a
@fog_a_name = @map.fog_a_name
@fog_a_move = @map.fog_a_move
@fog_a_opacity = @map.fog_a_opac
@fog_a_z = @map.fog_a_z
@fog_a_color = @map.fog_a_color
@fog_a_loop_x = @fog_a_move[0] != 0 ? true : false
@fog_a_loop_y = @fog_a_move[1] != 0 ? true : false
@fog_a_sx = @fog_a_move[0]
@fog_a_sy = @fog_a_move[1]
@fog_a_x = 0
@fog_a_y = 0
end
def setup_fog_b
@fog_b_name = @map.fog_b_name
@fog_b_move = @map.fog_b_move
@fog_b_opacity = @map.fog_b_opac
@fog_b_z = @map.fog_b_z
@fog_b_color = @map.fog_b_color
@fog_b_loop_x = @fog_b_move[0] != 0 ? true : false
@fog_b_loop_y = @fog_b_move[1] != 0 ? true : false
@fog_b_sx = @fog_b_move[0]
@fog_b_sy = @fog_b_move[1]
@fog_b_x = 0
@fog_b_y = 0
end
def setup_fog_c
@fog_c_name = @map.fog_c_name
@fog_c_move = @map.fog_c_move
@fog_c_opacity = @map.fog_c_opac
@fog_c_z = @map.fog_c_z
@fog_c_color = @map.fog_c_color
@fog_c_loop_x = @fog_c_move[0] != 0 ? true : false
@fog_c_loop_y = @fog_c_move[1] != 0 ? true : false
@fog_c_sx = @fog_c_move[0]
@fog_c_sy = @fog_c_move[1]
@fog_c_x = 0
@fog_c_y = 0
end
def set_display_pos(x, y)
sdp_for_fog(x, y)
@fog_a_x = x
@fog_a_y = y
@fog_b_x = x
@fog_b_y = y
@fog_c_x = x
@fog_c_y = y
end
def scroll_down(distance)
last_y = @display_y
s_d_for_fog(distance)
fog_scroll_down(distance, last_y)
end
def fog_scroll_down(distance, last_y)
value = loop_vertical? ? distance : @display_y - last_y
@fog_a_y += value ; @fog_b_y += value ; @fog_c_y += value
end
def scroll_left(distance)
last_x = @display_x
s_l_for_fog(distance)
fog_scroll_left(distance, last_x)
end
def fog_scroll_left(distance, last_x)
value = loop_horizontal? ? -distance : @display_x - last_x
@fog_a_x += value ; @fog_b_x += value ; @fog_c_x += value
end
def scroll_right(distance)
last_x = @display_x
s_r_for_fog(distance)
fog_scroll_right(distance, last_x)
end
def fog_scroll_right(distance, last_x)
value = loop_horizontal? ? distance : @display_x - last_x
@fog_a_x += value ; @fog_b_x += value ; @fog_c_x += value
end
def scroll_up(distance)
last_y = @display_y
s_u_for_fog(distance)
fog_scroll_down(distance, last_y)
end
def fog_scroll_down(distance, last_y)
value = loop_vertical? ? -distance : @display_y - last_y
@fog_a_y += value ; @fog_b_y += value ; @fog_c_y += value
end
def update_parallax
update_for_fog
update_fog
end
def update_fog
@fog_a_x += @fog_a_sx / 128.0 if @fog_a_loop_x
@fog_a_y += @fog_a_sy / 128.0 if @fog_a_loop_y
@fog_b_x += @fog_b_sx / 128.0 if @fog_b_loop_x
@fog_b_y += @fog_b_sy / 128.0 if @fog_b_loop_y
@fog_c_x += @fog_c_sx / 128.0 if @fog_c_loop_x
@fog_c_y += @fog_c_sy / 128.0 if @fog_c_loop_y
end
def fog_a_x
@fog_a_x
end
def fog_a_y
@fog_a_y
end
def fog_b_x
@fog_b_x
end
def fog_b_y
@fog_b_y
end
def fog_c_x
@fog_c_x
end
def fog_c_y
@fog_c_y
end
end
#==============================================================================
class Plane_FOG < Plane
#==============================================================================
def initialize(fog_id = "", fog_type)
return unless fog_id != ""
return if $BTEST
super(nil)
self.bitmap = Cache.parallax(fog_id)
@fog_type = fog_type
initialize_values
update
end
def initialize_values
case @fog_type
when :type_a
self.z = $game_map.fog_a_z
self.opacity = $game_map.fog_a_opacity
self.color = $game_map.fog_a_color if $game_map.fog_a_color != nil
when :type_b
self.z = $game_map.fog_b_z
self.opacity = $game_map.fog_b_opacity
self.color = $game_map.fog_b_color if $game_map.fog_b_color != nil
when :type_c
self.z = $game_map.fog_c_z
self.opacity = $game_map.fog_c_opacity
self.color = $game_map.fog_c_color if $game_map.fog_c_color != nil
end
end
def get_position_update
case @fog_type
when :type_a
self.ox = $game_map.fog_a_x * 32 + $game_map.fog_a_move[0]
self.oy = $game_map.fog_a_y * 32 + $game_map.fog_a_move[1]
when :type_b
self.ox = $game_map.fog_b_x * 32 + $game_map.fog_b_move[0]
self.oy = $game_map.fog_b_y * 32 + $game_map.fog_b_move[1]
when :type_c
self.ox = $game_map.fog_c_x * 32 + $game_map.fog_c_move[0]
self.oy = $game_map.fog_c_y * 32 + $game_map.fog_c_move[1]
end
end
def update
return if self.disposed?
get_position_update
case @fog_type
when :type_a
self.opacity = $game_map.fog_a_opacity if self.opacity != $game_map.fog_a_opacity
when :type_b
self.opacity = $game_map.fog_b_opacity if self.opacity != $game_map.fog_b_opacity
when :type_c
self.opacity = $game_map.fog_c_opacity if self.opacity != $game_map.fog_c_opacity
end
end
# def dispose
# super
# end
end
#==============================================================================
module Planeset_FOG
#==============================================================================
def create_fog
gm = $game_map
create_fog_a(gm)
create_fog_b(gm)
create_fog_c(gm)
end
def create_fog_a(gm)
@fogg_a = Plane_FOG.new(gm.fog_a_name,:type_a)
@fogg_a_name = gm.fog_a_name
end
def create_fog_b(gm)
@fogg_b = Plane_FOG.new(gm.fog_b_name,:type_b)
@fogg_b_name = gm.fog_b_name
end
def create_fog_c(gm)
@fogg_c = Plane_FOG.new(gm.fog_c_name,:type_c)
@fogg_c_name = gm.fog_c_name
end
def dispose_fog
@fogg_a.dispose if @fogg_a != nil
@fogg_b.dispose if @fogg_b != nil
@fogg_c.dispose if @fogg_c != nil
end
def update_fog
if @fogg_a_name != $game_map.fog_a_name
@fogg_a.dispose if @fogg_a != nil
create_fog_a($game_map)
end
if @fogg_b_name != $game_map.fog_b_name
@fogg_b.dispose if @fogg_b != nil
create_fog_b($game_map)
end
if @fogg_c_name != $game_map.fog_c_name
@fogg_c.dispose if @fogg_c != nil
create_fog_c($game_map)
end
@fogg_a.update if @fogg_a != nil
@fogg_b.update if @fogg_b != nil
@fogg_c.update if @fogg_c != nil
end
end
#==============================================================================
class Spriteset_Map
#==============================================================================
include Planeset_FOG
alias :initializefogg :initialize
alias :disposefogg :dispose
alias :updatefogg :update
def initialize
create_fog
initializefogg
end
def dispose
disposefogg
dispose_fog
end
def update
updatefogg
update_fog
end
end
#==============================================================================
class Spriteset_Battle
#==============================================================================
include Planeset_FOG
alias :initializefogg :initialize
alias :disposefogg :dispose
alias :updatefogg :update
def initialize
create_fog
initializefogg if FOG_By_Dekita::Show_In_Battle
end
def dispose
disposefogg
dispose_fog
end
def update
updatefogg
update_battle_fog
end
def update_battle_fog
return unless FOG_By_Dekita::Show_In_Battle
$game_map.update_fog
update_fog
end
end
#===============================================================================#
# - SCRIPT END - #
#===============================================================================#
# http://dekitarpg.wordpress.com/ #
#===============================================================================# |