Project1
标题:
两个问题请教
[打印本页]
作者:
The丶Duelist丿
时间:
2014-10-22 13:42
标题:
两个问题请教
1.本人正在使用RTAB系统+RTAB连击+菜鸟横版脚本,在动画库中设置闪烁次数就是连击次数的那种,如何在技能使用后,根据所有连击伤害而显示出一个总伤害在敌人的头上?
2.找到一个动态EXP增长脚本,战斗结束时会动态显示角色经验值增长情况,但是这脚本插入到RTAB脚本下面提示123行错误,插入到RTAB脚本上面,经验条动态消失。注:本人脚本不太懂
#==============================================================================
# 战斗结束动态增加EXP条 v0.1 作者:灯笼菜刀王
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
@expup = []
@expnow = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
now = actor.now_exp
max = actor.next_exp
now = now > max ? max : now
@expnow[i] = max != 0 ? 98 * now / max.to_f : 0
now2 = actor.now_exp - @exp
now2 = now2 > max ? max : now2
@expup[i] = max != 0 ? 98 * now2 / max.to_f : 0
end
super(140, 0, 400, 8 * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 6
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(208,0,128,32,"战利品")
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
draw_actor_graphic(actor, 20, i*60+92)
draw_actor_name(actor, 34, i*60+42)
self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))
self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))
now = actor.now_exp - @exp
max = actor.next_exp
now = now > max ? max : now
a = max != 0 ? 78 * now / max.to_f : 0
self.contents.fill_rect(27, i*60+77, @expup[i], 6, Color.new(150, 255, 150, 255))
end
y = 32
for item in @treasures
draw_item_name(item, 180, y)
y += 32
end
end
def update
for i in 0...$game_party.actors.size
if @expup[i] < @expnow[i]
@expup[i] += 1
end
end
refresh
end
end
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Scene_Battle
def update
# 执行战斗事件中的情况下
if $game_system.battle_interpreter.running?
# 刷新解释器
$game_system.battle_interpreter.update
# 强制行动的战斗者不存在的情况下
if $game_temp.forcing_battler == nil
# 执行战斗事件结束的情况下
unless $game_system.battle_interpreter.running?
# 继续战斗的情况下、再执行战斗事件的设置
unless judge
setup_battle_event
end
end
# 如果不是结束战斗回合的情况下
if @phase != 5
# 刷新状态窗口
@status_window.refresh
end
end
end
# 系统 (计时器)、刷新画面
$game_system.update
$game_screen.update
# 计时器为 0 的情况下
if $game_system.timer_working and $game_system.timer == 0
# 中断战斗
$game_temp.battle_abort = true
end
# 刷新窗口
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
#####菜刀王到此一游################
if @result_window != nil
@result_window.update
end
###################################
# 刷新活动块
@spriteset.update
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除处理过渡中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下
if $game_temp.message_window_showing
return
end
# 显示效果中的情况下
if @spriteset.effect?
return
end
# 游戏结束的情况下
if $game_temp.gameover
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 返回标题画面的情况下
if $game_temp.to_title
# 切换到标题画面
$scene = Scene_Title.new
return
end
# 中断战斗的情况下
if $game_temp.battle_abort
# 还原为战斗前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
return
end
# 等待中的情况下
if @wait_count > 0
# 减少等待计数
@wait_count -= 1
return
end
# 强制行动的角色存在、
# 并且战斗事件正在执行的情况下
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# 回合分支
case @phase
when 1 # 自由战斗回合
update_phase1
when 2 # 同伴命令回合
update_phase2
when 3 # 角色命令回合
update_phase3
when 4 # 主回合
update_phase4
when 5 # 战斗结束回合
update_phase5
end
end
def start_phase5
# 转移到回合 5
@phase = 5
# 演奏战斗结束 ME
$game_system.me_play($game_system.battle_end_me)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 初始化 EXP、金钱、宝物
exp = 0
gold = 0
treasures = []
# 循环
for enemy in $game_troop.enemies
# 敌人不是隐藏状态的情况下
unless enemy.hidden
# 获得 EXP、增加金钱
exp += enemy.exp
gold += enemy.gold
# 出现宝物判定
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# 限制宝物数为 6 个
treasures = treasures[0..5]
# 获得 EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# 获得金钱
$game_party.gain_gold(gold)
# 获得宝物
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 生成战斗结果窗口
@result_window = Window_BattleResult.new(exp, gold, treasures)
######菜刀王到此一游###############
@result_window.visible = true
###################################
# 设置等待计数
@phase5_wait_count = 100
end
end
复制代码
作者:
恐惧剑刃
时间:
2014-10-22 20:24
本帖最后由 恐惧剑刃 于 2014-10-22 20:25 编辑
1.没用过那种脚本,应该是重新定义了RPG::Sprite吧?
在F1中覆盖回来(误)
2.
#==============================================================================
# 战斗结束动态增加EXP条 v0.1 作者:灯笼菜刀王
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
@expup = []
@expnow = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
now = actor.now_exp
max = actor.next_exp
now = now > max ? max : now
@expnow[i] = max != 0 ? 98 * now / max.to_f : 0
now2 = actor.now_exp - @exp
now2 = now2 > max ? max : now2
@expup[i] = max != 0 ? 98 * now2 / max.to_f : 0
end
super(140, 0, 400, 8 * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
#self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 6
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(208,0,128,32,"战利品")
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
draw_actor_graphic(actor, 20, i*60+92)
draw_actor_name(actor, 34, i*60+42)
self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))
self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))
now = actor.now_exp - @exp
max = actor.next_exp
now = now > max ? max : now
a = max != 0 ? 78 * now / max.to_f : 0
self.contents.fill_rect(27, i*60+77, @expup[i], 6, Color.new(150, 255, 150, 255))
end
y = 32
for item in @treasures
draw_item_name(item, 180, y)
y += 32
end
end
def update
for i in 0...$game_party.actors.size
if @expup[i] < @expnow[i]
@expup[i] += 1
end
end
refresh
end
end
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Scene_Battle
alias dongtaiexp update
def update
#####菜刀王到此一游################
if @result_window != nil
@result_window.update
end
###################################
dongtaiexp
end
end
复制代码
作者:
The丶Duelist丿
时间:
2014-10-24 16:18
恐惧剑刃 发表于 2014-10-22 20:24
1.没用过那种脚本,应该是重新定义了RPG::Sprite吧?
在F1中覆盖回来(误)
1.好像找到个叫彩虹神剑的脚本,但是会出错
2.成功解决,谢谢
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1