|
- function checkEmptItemNum(charaindex)--检测剩余物品格子
- EmptyItemNum = 0
- for i = 8, 27 do
- if char.getItemIndex(charaindex, i) == -1 then
- EmptyItemNum = EmptyItemNum + 1
- end
- end
- return EmptyItemNum
- end
- --NPC窗口事件(NPC索引)
- function MWTalk ( meindex, talkerindex, seqno, select, data)
- char.TalkToCli(talkerindex, -1, "Seqno:"..seqno.." | select:"..select.." | data:"..data, "红色")
- if select == 2 then
- char.TalkToCli(talkerindex, -1, "谢谢您使用随身修理", "黄色")
- npc.DelNpc(npcindex)--删除NPC
- return
- end
- local field = other.getString(data, " ", 1)
- if field == "" then
- char.TalkToCli(talkerindex, -1, "谢谢您使用随身修理", "黄色")
- npc.DelNpc(npcindex)--删除NPC
- char.setInt(talkerindex,"寄售时间",0)--当前时间
- return
- end
- if field == " " then
- char.TalkToCli(talkerindex, -1, "谢谢您使用随身修理", "黄色")
- npc.DelNpc(npcindex)--删除NPC
- char.setInt(talkerindex,"寄售时间",0)--当前时间
- return
- end
- npc.repairWindowTalked(meindex, talkerindex, seqno, select, data)
- end
- --NPC对话事件(NPC索引)
- function Talked(meindex, talkerindex, szMes, color )
- if char.getChar(meindex, "账号") ~= char.getChar(talkerindex, "账号") then
- --if npc.isFaceToFace(meindex, talkerindex) == 1 then
- char.TalkToCli(talkerindex, -1, "我是私有NPC!不对外使用!", "黄色")
- --end
- return
- end
- npc.repairTalked(meindex, talkerindex, szMes, color)
- --if npc.isFaceToFace(meindex, talkerindex) == 1 then
- -- ShowHead(meindex, talkerindex)
- --end
- end
- function mymaincreate(parameter)
- charaindex = char.getPointtoindex(parameter)--得到宠物结构体指针
- findt = char.GetFrontChar(charaindex,4) --检测对面有没NPC 4 玩家1 怪物2 宠物3
- --print("对面检测NPC")
- --print(findt)
- if findt == 1 then
- char.TalkToCli(charaindex, -1, "请您换个位置当前位置有NPC存在", "黄色")
- return
- end
- --print(charaindex)
- --char.TalkToCli(charaindex, -1, "您进入其他脚本调用函数", "黄色")
- --npc已经生成但是没有载入到OBJ 已经存在的列表 怎么查找原因为什么 没有出现
- name = char.getChar(charaindex, "名字")
- img = char.getInt(charaindex, "原图像号")
- map = char.getInt(charaindex, "地图号")
- X = char.getInt(charaindex, "坐标X") + 1
- Y = char.getInt(charaindex, "坐标Y")
- npcindex = npc.CreateNpc(name, img, map, X, Y, 6)
- --设置事件触发(NPC索引,事件,执行函数,执行函数文件路径)
- char.setFunctionPointer(npcindex, "对话事件", "Talked", "data/ablua/commondrepairnpc.lua")--ok
- char.setFunctionPointer(npcindex, "窗口事件", "MWTalk", "data/ablua/commondrepairnpc.lua")--ok
- local ntime = other.time()
- char.setInt(charaindex,"寄售时间",ntime)--当前时间
- char.setInt(npcindex,"签到时间",char.getFd(charaindex))--NPC里面放置上玩家fd 好通知和查找玩家
- char.setWorkInt(charaindex, "NPC临时1" , char.getindextoPoint(npcindex)) --记录NPC指针地址 下线删除用
- char.setWorkInt(npcindex, "NPC临时1" , char.getindextoPoint(charaindex)) --让npc记录自己主人玩家的指针地址
-
- cdkey = char.getChar(charaindex, "账号")
- char.setChar(npcindex, "账号",cdkey)
- end
- function data()
- worldpay = 5
- worldfmpay = 10
-
- end
- function main()
- npcindex = 0
- data()
- end
复制代码
|
|