じ☆ve冰风 发表于 2024-4-19 18:27:12

菜鸟教程-随机偷盗技能

由于看到有些仁兄的游戏想加入偷盗技能,却做得一塌糊涂,现在发一个简单的菜鸟教程帮大家解除一下疑惑!
1.首先,你需要设置一个技能。技能名称自定。

2.新建一个公用事件,并且把技能的可用时间调为战斗,发动对象调为敌人单体,伤害为0,并且触发此公用事件。

3.公用事件内容:
变量的操作,自己独立建一个变量:随机数,1~[可以偷盗的物品的数量],例如“1~10”、“1~20”。
条件的分歧:变量值为1,获得XXX物品;
            不符合条件时的处理:条件的分歧,变量值为2,获得XXX物品;
            不符合条件时的处理:条件的分歧,变量值为3,获得XXX物品;
            不符合条件时的处理:条件的分歧,变量值为4,获得XXX物品;
            不符合条件时的处理:条件的分歧,变量值为5,获得XXX物品;
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
==========================================================================
以此类推。但是对于新手来说,可偷盗的物品不要太多,不然你会头晕眼花的哟!
发几个截图来证明一下!

使用了偷盗技能!

随机获得了物品!



目前就懒得截更多的图了,大家掌握了方法就自己去做吧。当然,这个获得物品提示是用了脚本的,本来分歧就很繁琐了,要是再去一个个写获得物品那就写死人了 = =
在这里我把脚本发给大家!# ————————————————————————————————————# 本脚本来自www.66rpg.com,转载请保留此信息# ————————————————————————————————————# 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。# 新增获得经验值提示,喝水后回复提示和增减等级提示.# 开关定义:$不显示金钱窗口 = 2$不显示物品窗口 = 2$不显示武器窗口 = 2$不显示防具窗口 = 2# 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示# ————————————————————————————————————class Interpreter #--------------------------------------------------------------------------# ● 增减金钱#--------------------------------------------------------------------------def command_125value = operate_value(@parameters, @parameters, @parameters)$game_party.gain_gold(value)if $game_switches[$不显示金钱窗口]==falsecarol3_66RPG = Window_Base.new((640-160)/2,128,180,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"失去金钱:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)end carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.disposeendreturn trueend#--------------------------------------------------------------------------# ● 增减物品#--------------------------------------------------------------------------def command_126value = operate_value(@parameters, @parameters, @parameters)$game_party.gain_item(@parameters, value)if $game_switches[$不显示物品窗口]==falsecarol3_66RPG_item = $data_items[@parameters]carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)endcarol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.disposeendreturn trueend#--------------------------------------------------------------------------# ● 增减武器#--------------------------------------------------------------------------def command_127value = operate_value(@parameters, @parameters, @parameters)$game_party.gain_weapon(@parameters, value)if $game_switches[$不显示武器窗口]==falsecarol3_66RPG_item = $data_weapons[@parameters]carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)endcarol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.disposeendreturn trueend#--------------------------------------------------------------------------# ● 增减防具#--------------------------------------------------------------------------def command_128value = operate_value(@parameters, @parameters, @parameters)$game_party.gain_armor(@parameters, value)if $game_switches[$不显示防具窗口]==falsecarol3_66RPG_item = $data_armors[@parameters]carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"获得防具:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"失去防具:") #——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)endcarol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.disposeendreturn trueenddef command_315# 获取操作值value = operate_value(@parameters, @parameters, @parameters)# 处理重复iterate_actor(@parameters) do |actor|# 更改角色 EXPactor.exp += valueendcarol3_66RPG = Window_Base.new((640-160)/2,128,180,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"获得经验:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"失去经验:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)end carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)carol3_66RPG.contents.draw_text(0,32,140,32, "exp",2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.disposereturn trueenddef command_314# 处理重复iterate_actor(@parameters) do |actor|# 角色全回复actor.recover_allendcarol3_66RPG = Window_Base.new((640-160)/2,128,120,60)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)carol3_66RPG.contents.draw_text(0,0,240,32,"完全恢复")#——声效,可以自己改Audio.se_play("Audio/SE/"+"105-Heal01",80,100)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.dispose# 继续return trueenddef command_316# 获取操作值value = operate_value(@parameters, @parameters, @parameters)# 处理重复iterate_actor(@parameters) do |actor|# 更改角色的等级actor.level += valueendcarol3_66RPG = Window_Base.new((640-160)/2,128,180,100)carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)if value >= 0carol3_66RPG.contents.draw_text(0,0,240,32,"等级提升:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"006-System06",80,100)elsecarol3_66RPG.contents.draw_text(0,0,240,32,"等级下降:")#——声效,可以自己改Audio.se_play("Audio/SE/"+"005-System05",80,100)end carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)carol3_66RPG.contents.draw_text(0,32,140,32, "级",2)carol3_66RPG.opacity = 160for i in 0..30Graphics.updateendfor i in 0..10carol3_66RPG.opacity -= 30carol3_66RPG.contents_opacity -= 30Graphics.updateendcarol3_66RPG.dispose# 继续return trueendend 复制代码呵呵,就这么简单啦~脚本一类的东东我想就不用了吧 - -|||
             本帖来自P1论坛作者冰舞蝶恋,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=143121若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页: [1]
查看完整版本: 菜鸟教程-随机偷盗技能