在新窗口中打开脚本页

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
#==============================================================================
# ■ 自动识别行走图帧数
# By :VIPArcher [email: VIPArcher@sina.com]
# -- 本脚本来自 http://rm.66rpg.com 使用或转载请保留以上信息。
# 说明:
# 使用这个脚本可以自动识别行走图的帧数,并且设置角色使用该行走图时的默认动作,使用
# 方法是在行走图文件名里加上@帧数#默认动作的帧。事件的默认帧可以在事件里直接设置
# 例如XP的素材就命名为: "喵喵喵_@4#0.png" 或者 "$妙妙妙_@4#0.png"
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:characters_frame] = 20150122
#-------------------------------------------------------------------------------
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 矫正姿势
#--------------------------------------------------------------------------
def straighten
return super unless @fix
@pattern = @fix if @walk_anime || @step_anime
@anime_count = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias characters_frame_refresh refresh
def refresh
characters_frame_refresh
@original_pattern = @fix = $1.to_i if @character_name =~ /#(\d+)/
@frame = $1.to_i if @character_name =~ /@(\d+)/
end
#--------------------------------------------------------------------------
# ● 更新动画图案
#--------------------------------------------------------------------------
def update_anime_pattern
return super unless @frame
if !@step_anime && @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % @frame
end
end
end
#-------------------------------------------------------------------------------
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● 设置角色的位图
#--------------------------------------------------------------------------
alias characters_frame_set_character_bitmap set_character_bitmap
def set_character_bitmap
if @character_name =~ /@(\d+)/
@frame = $1.to_i
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign && sign.include?('$')
@cw = bitmap.width / @frame
@ch = bitmap.height / 4
else
@cw = bitmap.width / @frame * 4
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
else
characters_frame_set_character_bitmap
end
end
#--------------------------------------------------------------------------
# ● 更新源矩形
#--------------------------------------------------------------------------
alias characters_frame_update_src_rect update_src_rect
def update_src_rect
return characters_frame_update_src_rect unless @frame
if @tile_id == 0
index = @character.character_index
pattern = @character.pattern < @frame ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end

文章目录