Project1
标题:
打开物品栏直接使用物品
[打印本页]
作者:
黑米馒头
时间:
2014-9-2 09:01
标题:
打开物品栏直接使用物品
不知道哪里改了,打开物品栏直接就使用物品了。。。
来个大侠看下,能弄的话,哪里修改了说下,谢谢了
#==============================================================================
# ■ Scene_Baby
#------------------------------------------------------------------------------
# 对召唤兽的管理菜单
#==============================================================================
class Scene_Baby
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def initialize(actor_index = 0 , menu_index = 0)
@actor_index = actor_index
@menu_index = menu_index
# ** 重新打开宠物界面 均初始化 宠物索引
$baby_index = nil
# ** 记录 角色id
$kds_baby = actor_index
# ** 暂不明用途 可能和图像有关,这命名没一点规律也没注释。。。
$baby_face = 0
# ** 如果当前角色有宠物携带
if $game_party.actors[$kds_baby].kds_baby.size > 0
# 如果 不0
# $baby_index 是当前参战的宠物id??
if $game_party.actors[$kds_baby].kds_canzhan != 0
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_canzhan]
else
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_baby[0]]
end
$stop = nil
else
$stop = 0
end
end
def main
#========================================================== 背景图
@back_1 = Sprite.new
@back_1.bitmap = Bitmap.new("Graphics/Pictures/图片显示/窗口图片/召唤兽属性栏")
@back_1.y =3+1
@back_1.z =999
#==========================================================
@help_window = Window_Help_宠物.new
@help_window.y = 424 # 介绍物品效果的框
@help_window.x = 0-50 # 介绍物品效果的框
@help_window.opacity = 255 # 窗口透明度
@item_window = Window_Item_宠物.new
# 生成坐标窗口
@xy_window = Window_Xy.new
# 生成地图状态框
@sthero_window = Window_Sthero.new
@item_window.active = false
# 木子bb 让物品窗口看不见
@item_window.visible = false
# ==
# 隐藏帮助窗口
@help_window.visible = false if @help_window != nil
# ===========================================================================
@item_window.help_window = @help_window
@item_window.index = -1
if $game_party.actors[$kds_baby].kds_baby.size > 0
if $game_party.actors[$kds_baby].kds_canzhan != 0
@skill_window = Window_Skill_宠物.new($game_actors[$game_party.actors[$kds_baby].kds_canzhan])
@skill_window.help_window = @help_window
else
@skill_window = Window_Skill_宠物.new($game_actors[$game_party.actors[$kds_baby].kds_baby[0]])
@skill_window.help_window = @help_window
end
else
@skill_window = Window_Skill.new(0)
end
@skill_window.active = false
# 隐藏帮助窗口
@help_window.visible = false if @help_window != nil
# ===========================================================================
# 木子bb 让特技窗口看不见
@skill_window.visible = false
# ==
@skill_window.index = -1
@skill_window.update
# ** 命令窗口
s1 = ""#设置参战"
s2 = ""#使用物品"
s3 = ""#查看技能"
s4 = ""#能力分配"
s5 = ""#放生宠物"
# s6 = "退出菜单"
@command_window = Window_Command_2.new(119, [s1, s2, s3, s4, s5])
@command_window.y = 386+2-2 #介绍设置游戏-退出菜单的框
@command_window.x = 3 #介绍设置游戏-退出菜单的框-横向移动
@command_window.z = 999
@command_window.opacity = 0 #窗口透明度
if $game_party.actors[$kds_baby].kds_baby.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
end
@command_window.refresh
@command_window.update
#-----------------加点按键--------------------------
s1 = ""#增加体力"
s3 = ""#增加魔力"
s2 = ""#增加力量"
s4 = ""#增加罡气"
# s5 = "增加敏捷"
#设置宠物选单的窗口和 Window_EquipLeft_宠物 一起用
@command2_window = Window_Command.new(120, [s1, s2, s3, s4],1,24,25+30)
@command2_window.x = 216
@command2_window.y = 249-3
@command2_window.z = 999
@command2_window.index = -1
@command2_window.back_opacity = 0
@command2_window.opacity = 0
@command2_window.active = false
@command2_window.help_window = @help_window
# 隐藏帮助窗口
@help_window.visible = false
#========================================================
# 宠物状态和属性
if $game_party.actors[$kds_baby].kds_baby.size > 0
if $game_party.actors[$kds_baby].kds_canzhan != 0
@status_window = Window_EquipLeft_宠物.new($game_actors[$game_party.actors[$kds_baby].kds_canzhan])
else
@status_window = Window_EquipLeft_宠物.new($game_actors[$game_party.actors[$kds_baby].kds_baby[0]])
end
else
@status_window = Window_EquipLeft_宠物.new(0)
end
#========================================================
# 宠物图片
if $game_party.actors[$kds_baby].kds_baby.size > 0
if $game_party.actors[$kds_baby].kds_canzhan != 0
@head_window = Window_Head.new($game_actors[$game_party.actors[$kds_baby].kds_canzhan])
else
@head_window = Window_Head.new($game_actors[$game_party.actors[$kds_baby].kds_baby[0]])
end
else
@head_window = Window_Head.new(0)
end
#------------------------------------------------------------------------
if $game_party.actors[$kds_baby].kds_baby.size > 0
if $game_party.actors[$kds_baby].kds_canzhan != 0
@babys_window = Window_Baby.new($game_actors[$game_party.actors[$kds_baby].kds_canzhan])
else
@babys_window = Window_Baby.new($game_actors[$game_party.actors[$kds_baby].kds_baby[0]])
end
else
@babys_window = Window_Baby.new(0)
end
@babys_window.index = -1
@babys_window.update
@babys_window.active = false
@babys_window.help_window = @help_window
#====================================
# 生成提示窗口
@tip = KDS_Baby_Tip.new
#====================================
# 执行过渡
Graphics.transition
#==================================================================
# 生成提示窗口
if $game_party.actors[$kds_baby].kds_baby.size == 0 # 如果不存在宠物
tip1 = "友情提示:您现在还没有一只召唤兽!" # 提示的第一句话
tip2 = "(Exc:关闭此信息)" # 提示的第二句话
@tip.refresh(tip1, tip2)
@tip.opacity = 180 # 窗口完全透明
@tip.contents_opacity = 180 # 文字完全透明
@tip.visible = true # 显示
# 执行透明度渐变
for i in 1..32
next if @tip.opacity == 255
@tip.opacity += 3 # 播放速度
@tip.contents_opacity += 3 # 播放速度
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
if @tip.visible
for i in 1..32
next if @tip.opacity == 255
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
if @tip.visible
for i in 1..32
next if @tip.opacity == 255
@tip.opacity -= 30 # 播放速度
@tip.contents_opacity -= 30 # 播放速度
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
end
end
end
@tip.visible = false
@tip.opacity = 0
#==================================================================
# 主循环
loop do
# 刷新画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
$stop = nil
@command_window.dispose
@command2_window.dispose
@help_window.dispose
@item_window.dispose
@head_window.dispose
@status_window.dispose
@skill_window.dispose
@babys_window.dispose
# 释放地图状态框
@sthero_window.dispose
# 释放坐标窗口
@xy_window.dispose
@back_1.dispose
# 释放提示窗口
@tip.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新坐标窗口
@xy_window.refresh if @xy_window.judge
# 刷新地图状态框
@sthero_window.update
#==============================================
@help_window.update
$baby_face += 1
# 刷新宠物图像
if ($baby_face+12)%3 == 0 and $game_party.actors[$kds_baby].kds_baby.size > 0
@head_window.refresh
if $baby_face == 36
$baby_face = 0
end
end
#===============================================
#========刷新窗口===============================
# 刷新加点窗口
if @command2_window.active
@command2_window.update
up_command2
end
# 刷新宠物列表的窗口
if @babys_window.active
@babys_window.update
up_babys
end
# 刷新法术窗口
if @skill_window.active
@skill_window.update
up_skill
end
# 刷新主命令窗口
if @command_window.active
@command_window.update
up_command
end
# 刷新物品窗口
if @item_window.active
@item_window.update
up_item
end
end
#=====================================================
# ** 刷新主命令窗口
def up_command
# ** 返回菜单
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
#======================================
# 切换地图界面人物头像 【返回队长头像】
$temp_mapface_id = $game_party.actors[0].id
#======================================
# $scene = Scene_Menu.new(@actor_index, 4)
# 切换地图画面
$scene = Scene_Map.new
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
$scene = Scene_Baby.new(($kds_baby+1)%$game_party.actors.size)
#======================================
# 切换地图界面人物头像
$temp_mapface_id = $game_party.actors[@actor_index+1].id
#======================================
# 隐藏物品栏和法术栏
@item_window.visible = false
@skill_window.visible = false
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
$scene = Scene_Baby.new(($kds_baby-1+$game_party.actors.size)%$game_party.actors.size)
#======================================
# 切换地图界面人物头像
$temp_mapface_id = $game_party.actors[@actor_index-1].id
#======================================
# 隐藏物品栏和法术栏
@item_window.visible = false
@skill_window.visible = false
return
end
if Input.trigger?(Input::C)
$command_index = @command_window.index
if @command_window.index != 5 and @command_window.index != 2
# ** 其他
if $game_party.actors[$kds_baby].kds_baby.size == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@babys_window.index = 0
@babys_window.active = true
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_baby[0]]
@baby_index = 0
@babys_window.refresh
@head_window.refresh
@skill_window.refresh
@status_window.refresh2
# ** 退出
elsif @command_window.index == 5
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(4)
elsif @command_window.index == 2
if $game_party.actors[$kds_baby].kds_baby.size == 0
$game_system.se_play($data_system.buzzer_se)
return
end
# ** 物品
$game_system.se_play($data_system.decision_se)
@item_window.update
@item_window.index = -1
@command_window.active = false
@babys_window.index = 0
@babys_window.active = true
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_baby[0]]
@baby_index = 0
@babys_window.refresh
@head_window.refresh
@skill_window.refresh
@status_window.refresh2
end
return
end
end
# ** 刷新宠物列表
def up_babys
if @babys_window.index != @baby_index
@baby_index = @babys_window.index
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_baby[@babys_window.index]]
@babys_window.refresh
@head_window.refresh
@skill_window.refresh
@status_window.refresh2
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# 准备过渡
Graphics.freeze
@babys_window.index = -1
@babys_window.active = false
@command_window.active = true
# @help_window.set_text("") # 帮助窗口文字清空
# 隐藏帮助窗口
@help_window.visible = false
# 执行过渡
Graphics.transition
return
end
if Input.trigger?(Input::C)
# 准备过渡
# Graphics.freeze #放在后边了★★★★★★★★★
$game_system.se_play($data_system.decision_se)
[url=home.php?mod=space&uid=696822]@chong[/url] = $game_actors[$game_party.actors[$kds_baby].kds_baby[@babys_window.index]]
[url=home.php?mod=space&uid=43335]@zhu[/url] = $game_party.actors[$kds_baby]
case @command_window.index
when 0 #参战
if $game_party.actors[$kds_baby].kds_canzhan == $game_party.actors[$kds_baby].kds_baby[@babys_window.index]
$game_party.actors[$kds_baby].kds_canzhan = 0
else
$game_party.actors[$kds_baby].kds_canzhan = $game_party.actors[$kds_baby].kds_baby[@babys_window.index]
end
@babys_window.refresh
when 3 #法术
@babys_window.active = false
@skill_window.index = 0
@skill_window.active = true
# 木子bb 让特技窗口能看见
@skill_window.visible = true
# ==
when 2 #物品
@babys_window.active = false
@item_window.index = 0
@item_window.active = true
# 木子bb 让物品窗口能看见
@item_window.visible = true
# ==
when 1 #加点
@babys_window.active = false
@command2_window.index = 0
@command2_window.active = true
when 4 #放生
$game_variables[6] = $game_party.actors[$kds_baby].id
$game_party.remove_actor(@chong.id)
@baby_index = 0
if @babys_window.index > 0
@babys_window.index -= 1 # 放生宠物的时候自动切换到上一个宠物
end
#==================================================================
# 生成提示窗口
tip1 = "非常遗憾:您放生了召唤兽,#{$game_actors[@chong.id].name}!" # 提示的话
tip2 = "(Exc:关闭此信息)"
@tip.refresh(tip1, tip2)
@tip.opacity = 180 # 窗口完全透明
@tip.contents_opacity = 180 # 文字完全透明
@tip.visible = true # 显示
# 执行透明度渐变
for i in 1..32
next if @tip.opacity == 255
@tip.opacity += 3 # 播放速度
@tip.contents_opacity += 3 # 播放速度
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
if @tip.visible
for i in 1..32
next if @tip.opacity == 255
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
if @tip.visible
for i in 1..32
next if @tip.opacity == 255
@tip.opacity -= 30 # 播放速度
@tip.contents_opacity -= 30 # 播放速度
Graphics.update
Input.update
if Input.trigger?(Input::B) # 按下ESC立即退出(实际上隐藏了窗口)
@tip.visible = false
@tip.opacity = 255
end
end
end
end
@tip.visible = false
@tip.opacity = 0
#==================================================================
# 准备过渡
Graphics.freeze #放在这个位置
if @zhu.kds_baby.size == 0
$stop = 0
@babys_window.index = -1
@babys_window.active = false
@command_window.active = true
#@help_window.set_text("") # 帮助窗口清空
# 隐藏帮助窗口
@help_window.visible = false
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
$baby_index = nil # 放生时刷新
@command_window.refresh
@command_window.update
else
# ** 刷新当前宠物
$baby_index = $game_actors[$game_party.actors[$kds_baby].kds_baby[@babys_window.index]]
end
@babys_window.refresh
@head_window.refresh
@skill_window.refresh
@status_window.refresh2
end
# 执行过渡
Graphics.transition
return
end
end
def up_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
Graphics.freeze
@babys_window.active = true
# 木子bb 注释掉这行貌似诡异的问题暂时消失了。。。
#@skill_window.index = -1
# ==
@skill_window.active = false
# 木子bb 让特技窗口看不见
@skill_window.visible = false if @skill_window.visible
# ==
# 隐藏帮助窗口
@help_window.visible = false if @help_window != nil
# ===========================================================================
# 执行过渡
Graphics.transition
return
end
end
def up_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# 准备过渡
Graphics.freeze
@babys_window.active = true
# 木子bb 注释掉这行貌似诡异的问题暂时消失了。。。
#@item_window.index = -1
# ==
@item_window.active = false
# 木子bb 让物品窗口看不见
@item_window.visible = false if @item_window.visible
# ==
# 隐藏帮助窗口
@help_window.visible = false if @help_window != nil
# ===========================================================================
# 执行过渡
Graphics.transition
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
if @item == nil
$game_system.se_play($data_system.buzzer_se)
return
end
if @item.element_set.include?(11)
if @chong.skills.include?(@item.recover_hp) == false
@chong.learn_skill(@item.recover_hp)
else
$game_system.se_play($data_system.buzzer_se)
return
end
elsif @item.element_set.include?(12)
$game_system.se_play(@item.menu_se)
end
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
end
@item_window.refresh
@skill_window.refresh
@status_window.refresh2
return
end
end
def up_command2
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
Graphics.freeze
@babys_window.active = true
@command2_window.index = -1
@command2_window.active = false
Graphics.transition
return
end
if Input.trigger?(Input::C)
if @chong.qianli <= 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
case @command2_window.index
when 0 #根骨
@chong.maxhp += rand(12)+1 #最大气血随机增加【1-12】点
@chong.hp += @chong.maxhp #当前气血=最大气血
@chong.gg += 1 #根骨加1
when 1 #灵性
@chong.maxsp += rand(6)+1 #最大法术随机增加【1-6】点
@chong.sp += @chong.maxsp #当前法术=最大法术
@chong.int += 1 #增加1点魔力
@chong.lx += 1 #灵性1
when 2 #力量
@chong.str += 1 #增加1点力量
@chong.ll += 1 #力量加1
when 3 #速度
# @chong.dex += 1 #增加灵巧
@chong.agi += 1 #增加1点速度
@chong.mj += 1 #敏捷加1
# when 4
# @chong.agi += 1 #增加1点速度
end
@chong.qianli -= 1 #减少1点潜能
@status_window.refresh2
end
end
end
复制代码
作者:
chd114
时间:
2014-9-5 22:38
$game_party.lose_item(@item.id, 1)
复制代码
在脚本里找到这句然后去掉
作者:
chd114
时间:
2014-9-5 22:39
但是这样的话不管使用什么都不会消耗物品了,所以你最好是做条件分歧来判定是不是要消耗掉的东西
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1