#========================================================#
# 浮空图标Ver.1.2 #
#========================================================#
=begin
作者:tomoaky
(伪)汉化:delv25
你可以在得到物品后弹出浮空图标。
请运行以下命令事件“脚本”
pop_icon(event_id的,icon_id,持续时间)
号icon_id图标被显示在事件号event_id的开销。
运行事件本身是一个值为0 event_id的,
玩家们可如果你指定为-1。
持续时间越长,你可以省略,默认时间120帧,也可以在下面调整。
例子:pop_icon(-1, 17, 300)
在游戏里显示5秒(300帧)的的非战斗图标。
有没有效果,当您运行的的命令pop_icon在图标视图。
如果你想看到的图标紧接该命令delete_icon
请运行命令pop_icon,删除图标。
注解:我算过了,第一个空的图标不算,是从第二个实图标开始算起。
例子:delete_icon(-1)
删除被显示在游戏窗口中的图标
“铠甲”变动“武器”更改“项”命令作为奖金事件
在执行时,自动显示一个图标的能力。
您要查看游戏的图标(默认是变量6)的变量可以改变的,(脚本下面改)
虽然该值是相同至于pop_icon event_id的命令,指定以下内容:-2
然后,您可以关闭。(翻译无能=A=)
默认变量:006
2012.01.19 Ver1.2
- 添加delete_icon命令删除的图标弹出显示
自主移动命令脚本[自定义]
修正了一个错误,功能的弹出图标不工作
2011.12.21 Ver1.11
·修正了一个错误的图标时,不会出现指定为0,并行的event_id
2011.12.17 VER1.1
- 我已经添加了能够在命令中指定的显示时间
本脚本已由永月极圣(Salvareless)改为在角色头上弹出图标
=end
#==============================================================================
# □ 项目设定
#==============================================================================
module TMICPOP
GRAVITY = 24 # 重力根据图标
SPEED = -320 # 初始速度(Y坐标)的图标
VN_TARGET = 44 # 控制开关?(翻译无能嘛)
end
#==============================================================================
# □ 命令(嘛……下面的我就自动用谷歌翻译了……不要在意那些细节……)
#==============================================================================
module TMICPOP
module Commands
#--------------------------------------------------------------------------
# ○ 开始
#--------------------------------------------------------------------------
def pop_icon(event_id, icon_id, duration = 45)
target = get_character(-1)
return unless target
target.icpop_id = icon_id
target.icpop_duration = duration
end
#--------------------------------------------------------------------------
# ○ 删除
#--------------------------------------------------------------------------
def delete_icon(event_id)
target = get_character(-1)
return unless target
target.icpop_delete_flag = true
end
end
end # module TMICPOP
#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● 公共变量数?
#--------------------------------------------------------------------------
attr_accessor :icpop_id # 图标 ID
attr_accessor :icpop_duration # 图标显示時間
attr_accessor :icpop_delete_flag # 消除图标
#--------------------------------------------------------------------------
# ● 公共变量数的初始化
#--------------------------------------------------------------------------
alias tmicpop_game_characterbase_init_public_members init_public_members
def init_public_members
tmicpop_game_characterbase_init_public_members
@icpop_id = 0
@icpop_duration = 0
@icpop_delete_flag = false
end
end
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# character : Game_Character
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_initialize initialize
def initialize(viewport, character = nil)
@icpop_duration = 0
tmicpop_sprite_character_initialize(viewport, character)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_dispose dispose
def dispose
dispose_icpop
tmicpop_sprite_character_dispose
end
#--------------------------------------------------------------------------
# ● 帧更新
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_update update
def update
update_icpop
tmicpop_sprite_character_update
end
#--------------------------------------------------------------------------
# ● 新的效果设定
#--------------------------------------------------------------------------
alias tmicpop_sprite_character_setup_new_effect setup_new_effect
def setup_new_effect
tmicpop_sprite_character_setup_new_effect
if !@icpop_sprite && @character.icpop_id > 0
@icpop_id = @character.icpop_id
@character.icpop_id = 0
start_icpop
end
end
#--------------------------------------------------------------------------
# ○ 图标表示的开端
#--------------------------------------------------------------------------
def start_icpop
dispose_icpop
@icpop_duration = @icpop_duration_max = @character.icpop_duration
@icpop_sprite = ::Sprite.new(viewport)
@icpop_sprite.bitmap = Cache.system("IconSet")
@icpop_sprite.src_rect.set(@icpop_id % 16 * 24, @icpop_id / 16 * 24, 24, 24)
@icpop_sprite.ox = 12
@icpop_sprite.oy = 24
@icpop_y_plus = 0
@icpop_y_speed = TMICPOP::SPEED
update_icpop
end
#--------------------------------------------------------------------------
# ○ 图标施放
#--------------------------------------------------------------------------
def dispose_icpop
@character.icpop_delete_flag = false
if @icpop_sprite
@icpop_sprite.dispose
@icpop_sprite = nil
end
end
#--------------------------------------------------------------------------
# ○ 图标更新
#--------------------------------------------------------------------------
def update_icpop
if @icpop_duration > 0
@icpop_duration -= 1
if @character.icpop_delete_flag
@icpop_duration = 0
dispose_icpop
elsif @icpop_duration > 0
@icpop_sprite.x = x
@icpop_y_plus += @icpop_y_speed
@icpop_y_speed += TMICPOP::GRAVITY
if @icpop_y_plus > 0
@icpop_y_plus = 0 - @icpop_y_plus
@icpop_y_speed = 0 - @icpop_y_speed / 2
end
@icpop_sprite.y = y - height + (@icpop_y_plus / 256)
@icpop_sprite.z = z + 200
@icpop_sprite.opacity = (@icpop_duration < 16 ? @icpop_duration * 16 :
(@icpop_duration_max - @icpop_duration) * 32)
else
dispose_icpop
@character.icpop_id = 0
end
end
end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event
include TMICPOP::Commands
#--------------------------------------------------------------------------
# ○ キャラクターの取得
# #PARAM:此事件ID,否则游戏中显示浮空图标?如果0 -1
#--------------------------------------------------------------------------
def get_character(param)
if param < 0
$game_player
else
$game_map.events[param > 0 ? param : @id]
end
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
include TMICPOP::Commands
#--------------------------------------------------------------------------
# ● 物品の増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_126 command_126
def command_126
tmicpop_game_interpreter_command_126
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_items[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
#--------------------------------------------------------------------------
# ● 武器の増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_127 command_127
def command_127
tmicpop_game_interpreter_command_127
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_weapons[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
#--------------------------------------------------------------------------
# ● 防具の増減
#--------------------------------------------------------------------------
alias tmicpop_game_interpreter_command_128 command_128
def command_128
tmicpop_game_interpreter_command_128
value = operate_value(@params[1], @params[2], @params[3])
if value > 0
if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
item = $data_armors[@params[0]]
pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
end
end
end
end