魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[GA] KJDW.lua--忘了是什么了

[复制链接]
发表于 前天 02:13 | 显示全部楼层 |阅读模式
Delegate.RegInit("KJDW_Init");
NL.RegItemString(nil, "KJDW_ItemUse", "LUA_useKJDW");
local PlayerMapArr = {};

function new_PlayerMap(player)
        local PlayerMap =
        {
                MapType = Char.GetData(player,%对象_MAP%);  
                Map = Char.GetData(player,%对象_地图%);       
                XStr = Char.GetData(player,%对象_X%);
                YStr = Char.GetData(player,%对象_Y%);
        };
        return PlayerMap;
end

function KJDW_ItemUse(player,toPlayer,slot)
        local MapType = Char.GetData(player,%对象_MAP%);
        if MapType~=0 then
                NLG.SystemMessage(player,"当前地图不能使用!");
                return
        end
        if(Char.PartyNum(player) > 1)then
                NLG.SystemMessage(player,"请先离开队伍!");
                return;
        end

                local _itemindex = Char.GetItemIndex(player,slot);
                local duidie = Item.GetData(_itemindex,%道具_堆叠数%);
                if duidie == 1 then
                        Item.Kill(player, _itemindex, slot);
                        Item.UpItem(player, slot);
                else
                        Item.SetData(_itemindex,%道具_堆叠数%,duidie-1);
                        Item.UpItem(player, slot);
                end

        PlayerMapArr[Playerkey(player)] = new_PlayerMap(player);
        Char.Warp(player,0,23102,27,32);
        return;
end

function initKJDWNpc_Init(index)
        return 1;
end

function initKJDWNpc()
        if (KJDWNpc == nil) then
                KJDWNpc = NL.CreateNpc("lua/Module/KJDW.lua", "initKJDWNpc_Init");
                Char.SetData(KJDWNpc,%对象_形象%,103012);
                Char.SetData(KJDWNpc,%对象_原形%,103012);
                Char.SetData(KJDWNpc,%对象_X%,23);
                Char.SetData(KJDWNpc,%对象_Y%,25);
                Char.SetData(KJDWNpc,%对象_地图%,23102);
                Char.SetData(KJDWNpc,%对象_方向%,6);
                Char.SetData(KJDWNpc,%对象_原名%,"出口");
                NLG.UpChar(KJDWNpc);
                Char.SetTalkedEvent("lua/Module/KJDW.lua","KJDWMsg", KJDWNpc);
        end
end

function KJDWMsg(_me,_tome)
        if (NLG.CanTalk(_me,_tome) == true) then
                if (PlayerMapArr[Playerkey(_tome)] == nil) then
                        Char.Warp(_tome,0,278,27,22);
                        return;
                else
                        Char.DischargeParty(_tome);
                        Char.Warp(_tome,PlayerMapArr[Playerkey(_tome)].MapType,PlayerMapArr[Playerkey(_tome)].Map,PlayerMapArr[Playerkey(_tome)].XStr,PlayerMapArr[Playerkey(_tome)].YStr);
                        return;
                end
        end
end

function KJDW_Init()
        initKJDWNpc();
end

回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 19:30 , Processed in 0.135594 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表