本帖最后由 ﹨﹨´覆雪… 于 2023-12-3 21:29 编辑
原贴地址
https://bbs.cgmsv.com/thread-1666-1-2.html
感谢青蛾大佬的分享,在其基础上做了一些小修改
1、替换原来使用道具,改用输入命令(/mg)
2、自测
GPS.zip
(990 Bytes, 下载次数: 91)
- --
- Delegate.RegDelTalkEvent("GPS_TalkEvent");
- NL.RegAfterWarpEvent(nil,"GPS_warp")
- --
- playermapid = {}; --地图类型
- GPSIO = {}; --GPS开关
- function GPS_TalkEvent(CharIndex, _msg, _color, _range, _size)
- if _msg == "/mg" then
- if GPSIO[CharIndex] == nil then
- playermapid[CharIndex] = Char.GetData(CharIndex,%对象_地图类型%)
- if playermapid[CharIndex] == 1 then
- GPSIO[CharIndex] = 1
- local _FloorId = Char.GetData(CharIndex,%对象_地图%)
- NLG.SystemMessage(CharIndex, " ".. Split(NLG.GetMapName(playermapid[CharIndex],_FloorId),"|")[1]);
- NLG.Say(CharIndex,-1,"═════════════════════",1,3)
- for i = 1,100 do
- for l = 1,100 do
- local j,_objtbl = Obj.GetObject(playermapid[CharIndex], _FloorId, i, l)
- if j > 0 then
- for k, v in pairs(_objtbl) do
- if v > 0 then
- local _Index= Obj.GetCharIndex(v);
- local _Name = Char.GetData(_Index,%对象_名字%);
- if _Index ~= CharIndex then
- if Obj.GetType(_Index) == 4 then
- _Name = "宝箱"
- elseif _Name ~= nil and _Name == " " then
- _Name = "楼梯传送"
- end
- NLG.SystemMessage(CharIndex, "[迷宫探测]坐标(".. i .. "," ..l .. ") ".._Name);
- end
- end
- end
- end
- end
- end
- NLG.Say(CharIndex,-1,"═════════════════════",1,3)
- else
- NLG.SystemMessage(CharIndex, "请在迷宫里使用Gps!")
- end
- else
- NLG.SystemMessage(CharIndex, "GPS无需重复开启!")
- end
- end
- end
- --
- function GPS_warp(CharIndex, Ori_MapId, Ori_FloorId, Ori_X, Ori_Y, Target_MapId, Target_FloorId, Target_X, Target_Y)
- if GPSIO[CharIndex] == 1 then
- if Target_MapId == playermapid[CharIndex] then
- local _FloorId = Char.GetData(CharIndex,%对象_地图%)
- NLG.SystemMessage(CharIndex, " ".. Split(NLG.GetMapName(Target_MapId,Target_FloorId),"|")[1]);
- NLG.Say(CharIndex,-1,"═════════════════════",1,3)
- for i = 1,100 do
- for l = 1,100 do
- local k , _objtbl = Obj.GetObject(Target_MapId,Target_FloorId, i, l)
- if k ~= 0 then
- for k, v in pairs(_objtbl) do
- if v > 0 then
- local _Index= Obj.GetCharIndex(v);
- local _Name = Char.GetData(_Index,%对象_名字%);
- if _Index ~= CharIndex then
- if Obj.GetType(_Index) == 4 then
- _Name = "宝箱"
- elseif _Name ~= nil and _Name == " " then
- _Name = "楼梯传送"
- end
- NLG.SystemMessage(CharIndex, "[迷宫探测]坐标(".. i .. "," ..l .. ") ".._Name);
- end
- end
- end
- end
- end
- end
- NLG.Say(CharIndex,-1,"═════════════════════",1,3)
- else
- NLG.SystemMessage(CharIndex, "已经脱离迷宫,GPS(残缺版)现已关闭");
- playermapid[CharIndex] = nil;
- GPSIO[CharIndex] = nil;
- end
- end
- end
复制代码
|