在新窗口中打开脚本页

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
#==============================================================================
# ■ 面向事件显示心情
# by :VIPArcher [email: VIPArcher@sina.com]
# -- 本脚本来自 http://rm.66rpg.com 使用或转载请保留以上信息。
#------------------------------------------------------------------------------
# ■ 使用说明:
# 面向注释有 <balloon id> 的事件时,玩家头顶显示第id号心情。心情素材直接使用的是
# 默认的心情素材。(其实默认的心情素材是可以直接扩展的,)
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:remind_balloon] = 20150125
#-------------------------------------------------------------------------------
module VIPArcher end
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module VIPArcher::Remind
SPEED = 4 # 心情显示的速度
WAIT_TIME = 90 # 最终帧的等待时间
FILENAME = "Balloon" # 心情素材的文件名
end
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class Sprite_Remind < Sprite_Character
include VIPArcher::Remind
#--------------------------------------------------------------------------
# ● 获取面前事件
#--------------------------------------------------------------------------
def event
fx = $game_map.round_x_with_direction(character.x, character.direction)
fy = $game_map.round_y_with_direction(character.y, character.direction)
return $game_map.events_xy(fx, fy)[0]
end
#--------------------------------------------------------------------------
# ● 获取事件的注释心情编号(如果有)
#--------------------------------------------------------------------------
def get_balloon_id(event)
return 0 if event.nil? || event.list.nil?
event.list.each do |command|
if command.code == 108 || command.code == 408
command.parameters.each do |line|
return $1.to_i if line =~ /<balloon\s*(\d+)>/i
end
end
end ; 0
end
#--------------------------------------------------------------------------
# ● 开始显示心情图标
#--------------------------------------------------------------------------
def start_balloon
dispose_balloon
@balloon_duration = 8 * balloon_speed + balloon_wait
@balloon_sprite = ::Sprite.new(viewport)
@balloon_sprite.bitmap = Cache.system(FILENAME)
@balloon_sprite.ox = 16
@balloon_sprite.oy = 32
update_balloon
end
#--------------------------------------------------------------------------
# ● 心情图标的显示速度
#--------------------------------------------------------------------------
def balloon_speed ; SPEED end
#--------------------------------------------------------------------------
# ● 心情最终帧的等待时间
#--------------------------------------------------------------------------
def balloon_wait ; WAIT_TIME end
#--------------------------------------------------------------------------
# ● 结束心情图标的显示
#--------------------------------------------------------------------------
def end_balloon
dispose_balloon
@balloon_id = 0
end
#--------------------------------------------------------------------------
# ● 更新位置
#--------------------------------------------------------------------------
def update_position
super
self.y = @character.screen_y - 32
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if @balloon_id != get_balloon_id(event)
@balloon_id = get_balloon_id(event)
start_balloon if @balloon_id > 0
end
end
#--------------------------------------------------------------------------
# ● 清空父类方法内容
#--------------------------------------------------------------------------
def update_bitmap ; end ; def setup_new_effect ; end
def end_animation ; end ; def update_src_rect ; end
def update_other ; end ; def update_other ; end
end
#-------------------------------------------------------------------------------
class Spriteset_Map
#--------------------------------------------------------------------------
# ● 生成提示心情精灵
#--------------------------------------------------------------------------
alias balloon_remind_create_characters create_characters
def create_characters
balloon_remind_create_characters
@remind_sprite = Sprite_Remind.new(@viewport2,$game_player)
end
#--------------------------------------------------------------------------
# ● 刷新提示心情精灵
#--------------------------------------------------------------------------
alias balloon_remind_update update
def update
balloon_remind_update ; @remind_sprite.update
end
#--------------------------------------------------------------------------
# ● 释放提示心情精灵
#--------------------------------------------------------------------------
alias balloon_remind_dispose dispose
def dispose
balloon_remind_dispose ; @remind_sprite.dispose
end
end

文章目录