local fs_NPCxq = {100905,"放生NPC",6,7777,26,26} --NPC详情
----------
Global_Reg.RegInit("petfangsheng_zhuce");--全局注册
function petfangsheng_zhuce() --NPC注册
petfangsheng_NPC()
return 0
end
function petfangsheng_NPC(npc) --NPC设置
if npc == nil then
npc = NL.CreateNpc(nil,"petfangsheng_NPCzhizuo")
end
Char.SetData(npc,1,fs_NPCxq[1])
Char.SetData(npc,2,fs_NPCxq[1])
Char.SetData(npc,2000,fs_NPCxq[2])
Char.SetData(npc,7,fs_NPCxq[3])
Char.SetData(npc,4,fs_NPCxq[4])
Char.SetData(npc,5,fs_NPCxq[5])
Char.SetData(npc,6,fs_NPCxq[6])
LuaNpcIndex["npc"]=npc;
InstallNpc("npc",npc);
NLG.UpChar(npc)
Char.SetTalkedEvent(nil,"petfangsheng_chuangkou",npc)
Char.SetWindowTalkedEvent(nil,"petfangsheng_gongneng",npc)
return true
end
function petfangsheng_NPCzhizuo(index)
return true;
end
function petfangsheng_chuangkou(npc,player) --窗口
if NLG.CanTalk(npc,player) then
NLG.ShowWindowTalked(player,2,2,222,"2\n\n测试\n测试1\n测试2",npc)
end
end
function petfangsheng_gongneng(npc,player,_SqeNo,_select,_data) --功能
NLG.SystemMessage(player,"\n _SqeNo是:"..(_SqeNo or "空").."它的类型是"..type(_SqeNo).."\n _select是:".. (_select or "空").."它的类型是"..type(_select).."\n _data是:"..(_data or "空").."它的类型是"..type(_data))
if _SqeNo == 222 then
if _select == 0 then
if _data == "1" then
local itemindex = Char.GiveItem(player,79701,1)
-- Item.SetData(itemindex[1],2000,"放生卡")
Item.SetData(itemindex[1],2001,"123231XX放生卡")
-- Item.SetData(itemindex[1],%道具_ID%,79701-1)
Item.UpItem(player,-1)
a = Item.GetData(itemindex[1],2000)
b = Item.GetData(itemindex[1],2001)
c = Item.GetData(itemindex[1],0)
NLG.SystemMessage(player,"a= "..a..",b= "..b..",c= "..c.."")
elseif _data == "2" then
NLG.SystemMessage(player,"测试data2")
end
end
end
end
|
|