Project1
标题:
这个仿RMXP胜利结算的脚本怎么添加个角色习得技能的提示?
[打印本页]
作者:
shengfeng
时间:
2021-9-30 16:20
标题:
这个仿RMXP胜利结算的脚本怎么添加个角色习得技能的提示?
=begin #=======================================================================
◆◇XP风结算画面 RGSS3◇◆
◆DEICIDE ALMA
◆レーネ
◆http://blog.goo.ne.jp/exa_deicide_alma
★機能
一个战斗胜利后的结算画面
◆導入箇所
▼素材のところ、mainより上
=end #=========================================================================
module RENNE ; module XP_RESULT
# 从战斗结束时ME的开始到结果显示的时间
ME_TIME = 30
# 从显示窗口到接受玩家按键输入的时间(帧)
ABS_WAIT = 1
# EXP 文字
EXP = "经验值"
# SE("文件路径",音量,音调)
# 不播放则设定为: SE = nil
SE = ["Audio/SE/Shop", 80, 100]
# 获得物品的最大显示数量
# ※建议使用14或更少
MAX = 8
end ; end
$renne_rgss3 = {} if $renne_rgss3.nil?
$renne_rgss3[:xp_result] = true
class << BattleManager
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :battle_result_method
#--------------------------------------------------------------------------
# ● 勝利の処理 ※再定義
#--------------------------------------------------------------------------
def process_victory
play_battle_end_me
replay_bgm_and_bgs
#gain_gold
gain_drop_items
gain_exp
display_battle_result
SceneManager.return
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# ● お金の獲得と表示 ※再定義
#--------------------------------------------------------------------------
def gain_gold
$game_party.gain_gold($game_troop.gold_total)
end
#--------------------------------------------------------------------------
# ● ドロップアイテムの獲得と表示 ※再定義
#--------------------------------------------------------------------------
def gain_drop_items
@get_items = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
@get_items << item
end
end
#--------------------------------------------------------------------------
# ● 経験値の獲得とレベルアップの表示 ※再定義
#--------------------------------------------------------------------------
def gain_exp
$game_party.all_members.each do |actor|
actor.xp_result_mode = true
actor.gain_exp($game_troop.exp_total)
actor.xp_result_mode = false
end
end
#--------------------------------------------------------------------------
# ● バトルリザルトの表示
#--------------------------------------------------------------------------
def display_battle_result
RENNE::XP_RESULT::ME_TIME.times{|i| battle_result_method.call}
exp = $game_troop.exp_total
gold = $game_troop.gold_total
@result_window = Window_BattleResult.new(exp, gold, @get_items)
Audio.se_play(*RENNE::XP_RESULT::SE) if RENNE::XP_RESULT::SE
RENNE::XP_RESULT::ABS_WAIT.times{|i| battle_result_method.call}
battle_result_method.call until Input.trigger?(:C)
@result_window.dispose
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :xp_result_mode
#--------------------------------------------------------------------------
# ● 経験値の変更(エイリアス)
#--------------------------------------------------------------------------
alias xp_result_change_exp change_exp
def change_exp(exp, show)
show = false if @xp_result_mode
xp_result_change_exp(exp, show)
end
end
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(exp, gold, items)
@exp = exp
@gold = gold
@items = items
w = 280
x = (Graphics.width - w) / 2
super(x, 0, w, [@items.size, RENNE::XP_RESULT::MAX].min * 24 + 48)
self.y = [160 - height / 2, 8].max
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
x = 4
change_color(normal_color)
cx = contents.text_size(@exp.to_s).width + 4
draw_text(x+80, 0, cx, 32, @exp.to_s)
x += cx + 2
change_color(system_color)
cx = contents.text_size(RENNE::XP_RESULT::EXP).width + 4
draw_text(x+80, 0, cx, 32, RENNE::XP_RESULT::EXP)
x += cx + 12
change_color(normal_color)
cx = contents.text_size(@gold.to_s).width + 4
draw_text(x+90, 0, cx, 32, @gold.to_s)
x += cx + 2
change_color(system_color)
cx = contents.text_size(Vocab.currency_unit).width + 4
change_color(normal_color)
draw_text(x-144, 0, 80, 32, '获得了:')
draw_text(x-144, 20, 80, 32, '战利品:')
change_color(system_color)
draw_text(x+90, 0, cx, 32, Vocab.currency_unit)
@items.each_with_index{|item, idx| draw_item_name(item, 80, (1 + idx) * 24)}
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理(エイリアス)
#--------------------------------------------------------------------------
alias xp_result_start start
def start
xp_result_start
BattleManager.battle_result_method = method(:update_basic)
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1