非驱魔香,不使用tohelos.lua一系列代码
所有地图可用的,倒计时不遇敌
1、修改ng.lua,顶部空白处添加,其中88920是不遇敌道具,自己做,持有即可,使其可叠加较多即可
- local yddj = 88920; --不遇敌道具--/2--no encount item
复制代码
2、修改ng.lua,talkevent中添加,代码中可修改单个道具生效时间,改后记得在计时处,把20000改成对应秒。1000=1秒
- if(msg == "/2" or msg == "、2") then--不遇敌
- local bydname1 = Char.GetData(player,%对象_名字%)
- local byd4 = Char.GetData(player,%对象_不遇敌开关%);
- local byd888 = Char.HaveItem(player,yddj);
- local byd999 = byd888 * 20--每个道具生效20秒
- local byd000 = byd888 - 1
- if Char.GetData(player,%对象_香步数%) ~= 0 then
- NLG.SystemMessage(player,"你正在使用步步遇敌,无法使用驱魔香水!");
- elseif byd4 == 1 then
- Char.SetData(player,%对象_不遇敌开关%,0);
- NLG.SystemMessage(player,"不遇敌功能关闭!");
- else
- if (Char.HaveItem(player,yddj) == 0) then
- Char.SetData(player,%对象_不遇敌开关%,0);
- NLG.SystemMessage(player,"你没有驱魔香水,无法使用不遇敌!请到哔哩免税店购买触发道具。");
- else
- NLG.Say(-1,-1,"玩家"..bydname1.."使用了驱魔香水,不遇敌计时开始!",1,2)
- Char.SetData(player,%对象_不遇敌开关%,1);
- Char.DelItem(player,yddj,1);
- --NLG.SystemMessage(player,"不遇敌已经开启!");
- Char.SetLoopEvent(nil,"jbyd_LoopEvent",player,20000)--计时
- NLG.SystemMessage(player,"你有"..byd888.."瓶驱魔香水,剩余"..byd000.."瓶。预计可使用约"..byd999.."秒,不遇敌开始!");
- --Char.SetBonusEncountRate(player,10)
- end
- end
- end
复制代码
3、修改ng.lua,底部空白处添加
- function jbyd_LoopEvent(player)
- local CdKey = Char.GetData(player,%对象_CDK%)
- local Name = Char.GetData(player,%对象_名字%)
- local bydnmb = Char.HaveItem(player,yddj);
- local bydnmb3 = Char.GetData(player,%对象_不遇敌开关%);
- if bydnmb3 == 0 then
- Char.SetLoopEvent(nil,"jbyd_LoopEvent",player,0)
- Char.SetData(player,%对象_不遇敌开关%,0);
- --NLG.SystemMessage(player,"不遇敌时间已到,恢复正常遇敌。");
- elseif bydnmb > 0 then
- Char.SetData(player,%对象_不遇敌开关%,1);
- Char.DelItem(player,yddj,1);
- local bydnmb2 = bydnmb - 1
- if bydnmb2 == 0 then
- NLG.SystemMessage(player,"驱魔香水剩余"..bydnmb2.."瓶,不遇敌最后一次生效中...");
- else
- NLG.SystemMessage(player,"驱魔香水剩余"..bydnmb2.."瓶,不遇敌继续生效中...");
- end
- else
- Char.SetLoopEvent(nil,"jbyd_LoopEvent",player,0)
- Char.SetLoopEvent(nil,"jbyd_LoopEvent",player,0)
- Char.SetData(player,%对象_不遇敌开关%,0);
- --Char.DelItem(player,yddj,1);
- NLG.SystemMessage(player,"驱魔香水用尽,恢复正常遇敌。");
- Char.SetLoopEvent(nil,"jbyd_LoopEvent",player,0)
- end
- end
复制代码
|