赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 5 |
经验 | 0 |
最后登录 | 2025-9-19 |
在线时间 | 78 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 539
- 在线时间
- 78 小时
- 注册时间
- 2023-7-5
- 帖子
- 25
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 君野飞火 于 2025-9-19 23:47 编辑
这个是模仿的代码现在出现的问题是:
多人获得经验时,窗口总会重复弹出,而且exp_uper似乎无法获取加经验的角色名
麻烦大家帮忙看看怎么改
def command_315 # 获取操作值 value = operate_value(@parameters[1], @parameters[2], @parameters[3]) # 如果 不显示升级窗口开关 关闭,则初始化纪录升级角色和纪录角色学会特级的变量 if $game_switches[$不提示经验窗口] == false level_uper = [] learned_skill = "" exp_uper = [] end #===============增加============================= first_actor = true #=============================== # 处理重复 iterate_actor(@parameters[0]) do |actor| # 如果 不显示经验窗口开关 关闭 last_exp = actor.exp last_level = actor.level # 更改角色 EXP actor.exp += value if $game_switches[$不提示经验窗口]==false # 如果是让角色加经验 if first_actor == true #限制多次循环 #============增加处==================== Audio.se_play("Audio/SE/"+"056-Right02",80,100) # 等待 10 祯 for i in 0..10 Graphics.update end #================================== if exp_uper.size == $game_party.actors.size and $game_party.actors.size > 1 then #=========如果全体成员升经验,且全体不止一个人============= # 生成提示窗口 exp_uper_window = Window_Base.new(215, 169, 234, 97) exp_uper_window.contents = Bitmap.new(200, 64) exp_uper_window.opacity = 160 # 描绘升级信息 exp_uper_window.contents.draw_text(0, 16, 200, 32, " 全体同伴 EXP + ") exp_uper_window.contents.draw_text(0, 16, 200, 32, value , 2) # 此外(如果只有部分角色升级或全队只有一人时) else # 生成提示窗口 height = exp_uper.size * 32 + 33 exp_uper_window = Window_Base.new(201, (435 - height) / 2, 262, height) exp_uper_window.contents = Bitmap.new(230, height - 32) exp_uper_window.opacity = 160 # 描绘升级信息 y = 0 for exp_up_actor in exp_uper exp_uper_window.contents.draw_text(10, y, 210, 32, exp_up_actor) exp_uper_window.contents.draw_text(10, y, 210, 32, "EXP +" , 2) exp_uper_window.contents.draw_text(10, y, 210, 32, value , 3) y += 32 end end ########################################### # 显示 30 祯 for i in 0..30 Graphics.update end # 用 10 祯过渡消失升级提示窗口 for i in 0..10 exp_uper_window.opacity -= 30 exp_uper_window.contents_opacity -= 30 Graphics.update end # 释放升级提示窗口 exp_uper_window.dispose #======================额外增加的操作(避免重复弹窗)======================= first_actor = false end #===================额外增加的操作============================ end ################################### if $game_switches[$不提示经验窗口]==false # 如果经验增加后角色升级 if actor.level > last_level #恢复为满状态 actor.hp = actor.maxhp actor.sp = actor.maxsp # 在纪录升级角色的变量里纪录升级角色 level_uper.push(actor.name.split(/·/)[0]) # 如果因升级学会特技 for level in last_level+1..actor.level for j in $data_classes[actor.class_id].learnings if j.level == level # 把角色的升级学会技能信息记录入变量 learned_skill += actor.name.split(/·/)[0] + "学会了新特技“" + $data_skills[j.skill_id].name + "”。\n" end end end else end # 此外(如果 不显示升级窗口开关 判断是否经验提示) else actor.exp += value end end #处理重复结束 # 如果 不显示升经验窗口开关 关闭,且有角色升级 if $game_switches[$不提示经验窗口] == false and level_uper.size > 0 # 播放升级提示 SE,可以自己改 Audio.se_play("Audio/SE/"+"056-Right02",80,100) # 等待 10 祯 for i in 0..10 Graphics.update end # 如果所有同伴都升级了 if level_uper.size == $game_party.actors.size and $game_party.actors.size > 1 then #=========如果全体成员升级,且队内不止一个人============= # 生成升级提示窗口 level_uper_window = Window_Base.new(215, 169, 234, 97) level_uper_window.contents = Bitmap.new(200, 64) level_uper_window.opacity = 160 # 描绘升级信息 level_uper_window.contents.draw_text(0, 16, 200, 32, " 全体同伴 LEVEL UP! ") # 此外(如果只有部分角色升级或队内只有一人时) else # 生成升级提示窗口 height = level_uper.size * 32 + 33 level_uper_window = Window_Base.new(201, (435 - height) / 2, 262, height) level_uper_window.contents = Bitmap.new(230, height - 32) level_uper_window.opacity = 160 # 描绘升级信息 y = 0 for level_up_actor in level_uper level_uper_window.contents.draw_text(10, y, 210, 32, level_up_actor) level_uper_window.contents.draw_text(10, y, 210, 32, " LEVEL UP!", 2) y += 32 end end # 显示 30 祯 for i in 0..30 Graphics.update end # 用 10 祯过渡消失升级提示窗口 for i in 0..10 level_uper_window.opacity -= 30 level_uper_window.contents_opacity -= 30 Graphics.update end # 释放升级提示窗口 level_uper_window.dispose # 如果有角色因为升级而学会技能 if learned_skill != "" # 播放学会技能 ME,可以自己改 Audio.me_play("Audio/ME/"+"010-Item01",100,100) # 更改对话框各个选项 $game_system.message_position = 2 $game_system.message_frame = 0 $mes_id = nil $mes_name = "" # 显示学会技能信息 @message_waiting = true $game_temp.message_proc = Proc.new { @message_waiting = false } # message_text 设置为 1 行 $game_temp.message_text = "\\c[4]" + learned_skill + "\n" end end # 继续 return true end #def结束
def command_315
# 获取操作值
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
# 如果 不显示升级窗口开关 关闭,则初始化纪录升级角色和纪录角色学会特级的变量
if $game_switches[$不提示经验窗口] == false
level_uper = []
learned_skill = ""
exp_uper = []
end
#===============增加=============================
first_actor = true
#===============================
# 处理重复
iterate_actor(@parameters[0]) do |actor|
# 如果 不显示经验窗口开关 关闭
last_exp = actor.exp
last_level = actor.level
# 更改角色 EXP
actor.exp += value
if $game_switches[$不提示经验窗口]==false
# 如果是让角色加经验
if first_actor == true #限制多次循环
#============增加处====================
Audio.se_play("Audio/SE/"+"056-Right02",80,100)
# 等待 10 祯
for i in 0..10
Graphics.update
end
#==================================
if exp_uper.size == $game_party.actors.size and $game_party.actors.size > 1
then
#=========如果全体成员升经验,且全体不止一个人=============
# 生成提示窗口
exp_uper_window = Window_Base.new(215, 169, 234, 97)
exp_uper_window.contents = Bitmap.new(200, 64)
exp_uper_window.opacity = 160
# 描绘升级信息
exp_uper_window.contents.draw_text(0, 16, 200, 32, " 全体同伴 EXP + ")
exp_uper_window.contents.draw_text(0, 16, 200, 32, value , 2)
# 此外(如果只有部分角色升级或全队只有一人时)
else
# 生成提示窗口
height = exp_uper.size * 32 + 33
exp_uper_window = Window_Base.new(201, (435 - height) / 2, 262, height)
exp_uper_window.contents = Bitmap.new(230, height - 32)
exp_uper_window.opacity = 160
# 描绘升级信息
y = 0
for exp_up_actor in exp_uper
exp_uper_window.contents.draw_text(10, y, 210, 32, exp_up_actor)
exp_uper_window.contents.draw_text(10, y, 210, 32, "EXP +" , 2)
exp_uper_window.contents.draw_text(10, y, 210, 32, value , 3)
y += 32
end
end
###########################################
# 显示 30 祯
for i in 0..30
Graphics.update
end
# 用 10 祯过渡消失升级提示窗口
for i in 0..10
exp_uper_window.opacity -= 30
exp_uper_window.contents_opacity -= 30
Graphics.update
end
# 释放升级提示窗口
exp_uper_window.dispose
#======================额外增加的操作(避免重复弹窗)=======================
first_actor = false
end
#===================额外增加的操作============================
end
###################################
if $game_switches[$不提示经验窗口]==false
# 如果经验增加后角色升级
if actor.level > last_level
#恢复为满状态
actor.hp = actor.maxhp
actor.sp = actor.maxsp
# 在纪录升级角色的变量里纪录升级角色
level_uper.push(actor.name.split(/·/)[0])
# 如果因升级学会特技
for level in last_level+1..actor.level
for j in $data_classes[actor.class_id].learnings
if j.level == level
# 把角色的升级学会技能信息记录入变量
learned_skill += actor.name.split(/·/)[0] + "学会了新特技“" + $data_skills[j.skill_id].name + "”。\n"
end
end
end
else
end
# 此外(如果 不显示升级窗口开关 判断是否经验提示)
else
actor.exp += value
end
end #处理重复结束
# 如果 不显示升经验窗口开关 关闭,且有角色升级
if $game_switches[$不提示经验窗口] == false and level_uper.size > 0
# 播放升级提示 SE,可以自己改
Audio.se_play("Audio/SE/"+"056-Right02",80,100)
# 等待 10 祯
for i in 0..10
Graphics.update
end
# 如果所有同伴都升级了
if level_uper.size == $game_party.actors.size and $game_party.actors.size > 1
then
#=========如果全体成员升级,且队内不止一个人=============
# 生成升级提示窗口
level_uper_window = Window_Base.new(215, 169, 234, 97)
level_uper_window.contents = Bitmap.new(200, 64)
level_uper_window.opacity = 160
# 描绘升级信息
level_uper_window.contents.draw_text(0, 16, 200, 32, " 全体同伴 LEVEL UP! ")
# 此外(如果只有部分角色升级或队内只有一人时)
else
# 生成升级提示窗口
height = level_uper.size * 32 + 33
level_uper_window = Window_Base.new(201, (435 - height) / 2, 262, height)
level_uper_window.contents = Bitmap.new(230, height - 32)
level_uper_window.opacity = 160
# 描绘升级信息
y = 0
for level_up_actor in level_uper
level_uper_window.contents.draw_text(10, y, 210, 32, level_up_actor)
level_uper_window.contents.draw_text(10, y, 210, 32, " LEVEL UP!", 2)
y += 32
end
end
# 显示 30 祯
for i in 0..30
Graphics.update
end
# 用 10 祯过渡消失升级提示窗口
for i in 0..10
level_uper_window.opacity -= 30
level_uper_window.contents_opacity -= 30
Graphics.update
end
# 释放升级提示窗口
level_uper_window.dispose
# 如果有角色因为升级而学会技能
if learned_skill != ""
# 播放学会技能 ME,可以自己改
Audio.me_play("Audio/ME/"+"010-Item01",100,100)
# 更改对话框各个选项
$game_system.message_position = 2
$game_system.message_frame = 0
$mes_id = nil
$mes_name = ""
# 显示学会技能信息
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# message_text 设置为 1 行
$game_temp.message_text = "\\c[4]" + learned_skill + "\n"
end
end
# 继续
return true
end #def结束
|
|