请教高手,该怎么办呢?
脚本:
#=======================================================================
#★升级提示★
#-----------------------------------------------------------------------
#★作者: Zhong_zw
#★联系方式:66RPG.com论坛短信 或 [email protected]
#=======================================================================
class Game_Actor < Game_Battler
attr_accessor :last_level
def initialize(actor_id)
super()
setup(actor_id)
@last_level = 0
@last_skill_id = 0
end
def last_atk
n=0
for item in equips.compact do n += item.atk end
return actor.parameters[2,@last_level] + n
end
def last_def
n=0
for item in equips.compact do n += item.def end
return actor.parameters[3,@last_level] + n
end
def last_spi
n=0
for item in equips.compact do n += item.spi end
return actor.parameters[4,@last_level] + n
end
def last_agi
n=0
for item in equips.compact do n += item.agi end
return actor.parameters[5,@last_level] + n
end
def now_atk
n=0
for item in equips.compact do n += item.atk end
return actor.parameters[2,@level] + n
end
def now_def
n=0
for item in equips.compact do n += item.def end
return actor.parameters[3,@level] + n
end
def now_spi
n=0
for item in equips.compact do n += item.spi end
return actor.parameters[4,@level] + n
end
def now_agi
n=0
for item in equips.compact do n += item.agi end
return actor.parameters[5,@level] + n
end
def change_exp(exp, show)
@last_level = @level
last_skills = skills
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show and @level > last_level
zhonglevelup_push(skills - last_skills)
end
end
#==========================================================================
#★角色升级显示
#==========================================================================
def zhonglevelup_push(new_skills)
text = [@actor_id,new_skills]
$game_temp.levelup_texts.push(text)
end
end
class Scene_Battle < Scene_Base
def display_level_up
exp = $game_troop.exp_total
$game_party.remove_states_battle
@message_window.contents_opacity = 0
@message_window.opacity = 0
@levelup_window = Window_zhonglevelup.new
for actor in $game_party.existing_members
last_level = actor.level
last_skills = actor.skills
actor.gain_exp(exp, true)
end
update_zhonglevelup
end
#==========================================================================
#★等待升级窗口刷新
#==========================================================================
def update_zhonglevelup
@levelup_window.update
while @levelup_window.visible
@levelup_window.update
Graphics.update
Input.update
end
end
end
class Game_Temp
attr_accessor :levelup_texts
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias oldinitialize initialize
def initialize
@levelup_texts = []
oldinitialize
end
end
else
@main_window.visible = false
@skill_window.visible =false
self.visible = false
end
end
#==========================================================================
#★窗口按键刷新
#==========================================================================
def zhonginputupdate
if Input.trigger?(Input::DOWN)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::UP)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::RIGHT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::LEFT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::B)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::C)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
end
#==========================================================================
def dispose
super
@skill_window.dispose
@main_window.dispose
end
end
class Scene_Map < Scene_Base
def start
super
$game_map.refresh
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@levelup_window = Window_zhonglevelup.new
@lus_window = Window_Base.new(122,23,260,36)
@m_window = Window_Base.new(122,59,260,290)
@m_window.opacity = 0
@lus_window.opacity = 0
@m_window.z = 9998
@lus_window.z = 9998
@levelup_window.z = 9999
end
def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
unless $game_message.visible
update_levelup_window
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
def update_levelup_window
@levelup_window.update
while @levelup_window.visible
@lus_window.opacity = $game_temp.levelup_texts[@levelup_window.index][1].size != 0 ? 150 : 0
@m_window.opacity = 150
@levelup_window.update
Graphics.update
Input.update
end
@m_window.opacity = 0
@lus_window.opacity = 0
end
def terminate
super
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
@spriteset.dispose_characters # 背景作成のためにキャラを隠す
end
snapshot_for_background
@spriteset.dispose
@message_window.dispose
@levelup_window.dispose
@m_window.dispose
@lus_window.dispose
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
perform_battle_transition # 戦闘前トランジション実行
end
end
end
作者: chung0919 时间: 2011-1-20 01:07
= = 怎么会这样zzz
可能是座标问题。
你试试这个吧
attr_accessor :last_level
def initialize(actor_id)
super()
setup(actor_id)
@last_level = 0
@last_skill_id = 0
end
def last_atk
return actor.parameters[2,@last_level]
end
def last_def
return actor.parameters[3,@last_level]
end
def last_spi
return actor.parameters[4,@last_level]
end
def last_agi
return actor.parameters[5,@last_level]
end
def now_atk
return actor.parameters[2,@level]
end
def now_def
return actor.parameters[3,@level]
end
def now_spi
return actor.parameters[4,@level]
end
def now_agi
return actor.parameters[5,@level]
end
def change_exp(exp, show)
@last_level = @level
last_skills = skills
@exp = [[exp, 99999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show and @level > last_level
zhonglevelup_push(skills - last_skills)
end
end
#==========================================================================
#★角色升级显示
#==========================================================================
def zhonglevelup_push(new_skills)
Audio.se_play("Audio/SE/Levelup.wav")
text = [@actor_id,new_skills]
$game_temp.levelup_texts.push(text)
end
end
class Scene_Battle < Scene_Base
def display_level_up
exp = $game_troop.exp_total
$game_party.remove_states_battle
@message_window.contents_opacity = 0
@message_window.opacity = 0
@levelup_window = Window_zhonglevelup.new
for actor in $game_party.existing_members
last_level = actor.level
last_skills = actor.skills
actor.gain_exp(exp, true)
end
update_zhonglevelup
end
#==========================================================================
#★等待升级窗口刷新
#==========================================================================
def update_zhonglevelup
@levelup_window.update
while @levelup_window.visible
@levelup_window.update
Graphics.update
Input.update
end
end
end
class Game_Temp
attr_accessor :levelup_texts
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias oldinitialize initialize
def initialize
@levelup_texts = []
oldinitialize
end
end
#==========================================================================
#★窗口按键刷新
#==========================================================================
def zhonginputupdate
if Input.trigger?(Input::DOWN)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::UP)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::RIGHT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::LEFT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::B)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::C)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
unless $game_message.visible
update_levelup_window
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
def update_levelup_window
@levelup_window.update
while @levelup_window.visible
end
def terminate
super
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
@spriteset.dispose_characters # 背景作成のためにキャラを隠す
end
snapshot_for_background
@spriteset.dispose
@message_window.dispose
@levelup_window.dispose
@m_window.dispose
@lus_window.dispose
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
perform_battle_transition # 戦闘前トランジション実行
end
end
end 作者: 74174n74 时间: 2011-1-20 10:52 本帖最后由 74174n74 于 2011-1-21 11:39 编辑