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
| #==============================================================================
# MOG VX - Character Select V1.0
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Scene de seleção de personagens.
#==============================================================================
# 1 - Crie uma pasta com o nome MENUS. (GRAPHICS/MENUS)
# 2 - Deverão conter as seguintes imagens nesta pasta.
#
# Background
# Char_Layout01
# Char_Layout02
# Char_Status_Layout
#
# 3 - Será necessário ter o arquivo Number_Char.png na pasta (GRAPHICS/SYSTEM)
# 4 - Além destes arquivos você deverá ter as imagens dos personagens.
# Você deverá nomear as imagens da seguinte forma.
#
# Nome_do_personagem + _picture
#
# Exemplo:
#
# Ralph_picture.png
#
# Grave a imagem na pasta (GRAPHICS/MENUS)
#
# 5 - Para chamar o script use o seguinte comando.
#
# $scene = Scene_Character_Select.new
#
#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)
#--------------------------------------------------------------------------
# X - Posição na horizontal
# Y - Posição na vertical
# VALUE - Valor Numérico
# FILE_NAME - Nome do arquivo
# ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita
# SPACE - Espaço entre os números.
# FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
# FRAME_INDEX - Definição do quadro a ser utilizado.
#--------------------------------------------------------------------------
def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)
number_image = Cache.system(file_name)
frame_max = 1 if frame_max < 1
frame_index = frame_max -1 if frame_index > frame_max -1
align = 2 if align > 2
cw = number_image.width / 10
ch = number_image.height / frame_max
h = ch * frame_index
number = value.abs.to_s.split(//)
case align
when 0
plus_x = (-cw + space) * number.size
when 1
plus_x = (-cw + space) * number.size
plus_x /= 2
when 2
plus_x = 0
end
for r in 0..number.size - 1
number_abs = number[r].to_i
number_rect = Rect.new(cw * number_abs, h, cw, ch)
self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)
end
end
#--------------------------------------------------------------------------
# draw_char_window_status
#--------------------------------------------------------------------------
def draw_char_window_status(x,y)
image = Cache.menu("Char_Status_Layout")
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
end
end
#==============================================================================
# ** Window_Character_Status
#==============================================================================
class Window_Character_Status < Window_Base
attr_accessor :index
#--------------------------------------------------------------------------
# * initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 400, 130)
self.opacity = 0
actor_id = []
@index = actor
for i in 1...$data_actors.size
actor_id.push($game_actors[i])
end
@actor = actor_id[actor -1]
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.bold = true
self.contents.font.italic = true
draw_char_window_status(0, 6)
draw_actor_face(@actor, 0, 0)
draw_actor_name(@actor, 140, -5)
draw_actor_class(@actor, 60, 70)
draw_picture_number(155,20,@actor.maxhp, "Number_char",1)
draw_picture_number(145,48,@actor.maxmp, "Number_char",1)
draw_picture_number(228,28,@actor.atk, "Number_char",1)
draw_picture_number(297,28,@actor.def, "Number_char",1)
draw_picture_number(207,68,@actor.spi, "Number_char",1)
draw_picture_number(277,68,@actor.agi, "Number_char",1)
end
end
#==============================================================================
# ** Cache
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# Menu
#--------------------------------------------------------------------------
def self.menu(filename)
load_bitmap("Graphics/Menus/", filename)
end
end
#==============================================================================
# ** Scene Character Select
#==============================================================================
class Scene_Character_Select < Scene_Base
#--------------------------------------------------------------------------
# * initialize
#--------------------------------------------------------------------------
def initialize
@char_index = 1
@char_max = $data_actors.size - 1
@pw_x = 300
@aw_x = 200
@nw_x = 100
end
#--------------------------------------------------------------------------
# * Start
#--------------------------------------------------------------------------
def start
super
create_layout
create_window_status
create_char_image
reset_position(0)
end
#--------------------------------------------------------------------------
# * create_background
#--------------------------------------------------------------------------
def create_layout
@background = Plane.new
@background.bitmap = Cache.menu("Background")
@background.z = 0
@layout_01 = Sprite.new
@layout_01.bitmap = Cache.menu("Char_Layout01")
@layout_01.z = 10
@layout_02 = Sprite.new
@layout_02.bitmap = Cache.menu("Char_Layout02")
@layout_02.blend_type = 1
@layout_02.z = 1
end
#--------------------------------------------------------------------------
# * create_window_status
#--------------------------------------------------------------------------
def create_window_status
@window_status = []
for i in 1...$data_actors.size
@window_status[i] = Window_Character_Status.new(i)
@window_status[i].z = 7
end
check_active_window
end
#--------------------------------------------------------------------------
# * create_window_status
#--------------------------------------------------------------------------
def create_char_image
@actor_picture = []
actor_id = []
for i in 1...$data_actors.size
actor_id.push($game_actors[i])
actor = actor_id[i - 1]
@actor_picture[i] = Sprite.new
@actor_picture[i].bitmap = Cache.menu(actor.name + "_Picture")
end
check_active_picture
end
#--------------------------------------------------------------------------
# * check_active_window
#--------------------------------------------------------------------------
def check_active_window
for i in 1...$data_actors.size
@pw = @char_index - 1
@pw = 1 if @pw > @char_max
@pw_y = 32
@pw = @char_max if @pw < 1
@aw = @char_index
@aw_y = 160
@nw = @char_index + 1
@nw = 1 if @nw > @char_max
@nw = @char_max if @nw < 1
@nw_y = 288
case @window_status[i].index
when @pw,@aw,@nw
@window_status[i].visible = true
else
@window_status[i].visible = false
end
end
end
#--------------------------------------------------------------------------
# * check_active_picture
#--------------------------------------------------------------------------
def check_active_picture
for i in 1...$data_actors.size
case @window_status[i].index
when @pw,@aw,@nw
@actor_picture[i].visible = true
@actor_picture[@pw].z = 4
@actor_picture[@aw].z = 6
@actor_picture[@nw].z = 4
@actor_picture[@pw].opacity = 120
@actor_picture[@aw].opacity = 255
@actor_picture[@nw].opacity = 120
else
@actor_picture[i].visible = false
end
end
end
#--------------------------------------------------------------------------
# * pre_terminate
#--------------------------------------------------------------------------
def pre_terminate
super
RPG::BGM.fade(2500)
Graphics.fadeout(60)
Graphics.wait(40)
RPG::BGM.stop
end
#--------------------------------------------------------------------------
# * terminate
#--------------------------------------------------------------------------
def terminate
super
for i in 1...$data_actors.size
@window_status[i].dispose
@actor_picture[i].bitmap.dispose
@actor_picture[i].dispose
end
@background.bitmap.dispose
@background.dispose
@layout_01.bitmap.dispose
@layout_01.dispose
@layout_02.bitmap.dispose
@layout_02.dispose
end
#--------------------------------------------------------------------------
# * update
#--------------------------------------------------------------------------
def update
super
@background.ox += 1
update_select
update_slide_window
update_slide_image
end
#--------------------------------------------------------------------------
# * update_slide_window
#--------------------------------------------------------------------------
def update_slide_window
@window_status[@aw].x += 1 if @window_status[@aw].x < 0
@window_status[@nw].x -= 2 if @window_status[@nw].x > -30
@window_status[@pw].x -= 2 if @window_status[@pw].x > -30
slide_window_y(@pw,@pw_y)
slide_window_y(@aw,@aw_y)
slide_window_y(@nw,@nw_y)
end
#--------------------------------------------------------------------------
# * update_slide_image
#--------------------------------------------------------------------------
def update_slide_image
slide_picture_x(@pw,@pw_x,15)
slide_picture_x(@aw,@aw_x,5)
slide_picture_x(@nw,@nw_x,15)
end
#--------------------------------------------------------------------------
# * slide_picture_x
#--------------------------------------------------------------------------
def slide_picture_x(i,x_pos,speed)
if @actor_picture[i].x < x_pos
@actor_picture[i].x += speed
@actor_picture[i].x = x_pos if @actor_picture[i].x > x_pos
end
if @actor_picture[i].x > x_pos
@actor_picture[i].x -= speed
@actor_picture[i].x = x_pos if @actor_picture[i].x < x_pos
end
end
#--------------------------------------------------------------------------
# * slide_window_y
#--------------------------------------------------------------------------
def slide_window_y(i,y_pos)
if @window_status[i].y < y_pos
@window_status[i].y += 15
@window_status[i].y = y_pos if @window_status[i].y > y_pos
end
if @window_status[i].y > y_pos
@window_status[i].y -= 15
@window_status[i].y = y_pos if @window_status[i].y < y_pos
end
end
#--------------------------------------------------------------------------
# * reset_position
#--------------------------------------------------------------------------
def reset_position(diretion)
check_active_window
check_active_picture
case diretion
when 0
@window_status[@pw].y = -64
@actor_picture[@pw].x = 100
when 1
@window_status[@nw].y = 440
@actor_picture[@nw].x = 400
end
end
#--------------------------------------------------------------------------
# * update_select
#--------------------------------------------------------------------------
def update_select
if Input.trigger?(Input::DOWN) or Input.trigger?(Input::LEFT)
Sound.play_cursor
@char_index += 1
@char_index = 1 if @char_index > @char_max
if @char_max < 3
reset_position(0)
else
reset_position(1)
end
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::RIGHT)
Sound.play_cursor
@char_index -= 1
@char_index = @char_max if @char_index < 1
reset_position(0)
elsif Input.trigger?(Input::C)
Sound.play_decision
$game_party.add_actor(@char_index)
$scene = Scene_Map.new
end
end
end
$mog_rgssvx_character_select = true |