cgmsv引擎论坛

 找回密码
 注册/Sign up
搜索
查看: 740|回复: 6

[LUA]老框架GPS,兼容新框架 修改版

[复制链接]

Rank: 2

发表于 2023-12-3 21:20:39 | 显示全部楼层 |阅读模式
本帖最后由 ﹨﹨´覆雪… 于 2023-12-3 21:29 编辑

原贴地址
https://bbs.cgmsv.com/thread-1666-1-2.html

QQ截图20231203205222.png


感谢青蛾大佬的分享,在其基础上做了一些小修改

1、替换原来使用道具,改用输入命令(/mg)
2、自测

2.gif

GPS.zip (990 Bytes, 下载次数: 78)



  1. --
  2. Delegate.RegDelTalkEvent("GPS_TalkEvent");
  3. NL.RegAfterWarpEvent(nil,"GPS_warp")
  4. --
  5. playermapid = {};        --地图类型
  6. GPSIO = {};                --GPS开关
  7. function GPS_TalkEvent(CharIndex, _msg, _color, _range, _size)
  8.         if _msg == "/mg" then
  9.                 if GPSIO[CharIndex] == nil then
  10.                         playermapid[CharIndex] = Char.GetData(CharIndex,%对象_地图类型%)
  11.                         if playermapid[CharIndex] == 1 then
  12.                                 GPSIO[CharIndex] = 1
  13.                                 local _FloorId = Char.GetData(CharIndex,%对象_地图%)
  14.                                 NLG.SystemMessage(CharIndex, "     ".. Split(NLG.GetMapName(playermapid[CharIndex],_FloorId),"|")[1]);
  15.                                 NLG.Say(CharIndex,-1,"═════════════════════",1,3)
  16.                                 for i = 1,100 do
  17.                                         for l = 1,100 do
  18.                                                 local j,_objtbl = Obj.GetObject(playermapid[CharIndex], _FloorId, i, l)
  19.                                                 if j > 0 then
  20.                                                         for k, v in pairs(_objtbl) do
  21.                                                                 if v > 0 then
  22.                                                                         local _Index= Obj.GetCharIndex(v);
  23.                                                                         local _Name = Char.GetData(_Index,%对象_名字%);
  24.                                                                         if _Index ~= CharIndex then
  25.                                                                                 if Obj.GetType(_Index) == 4 then
  26.                                                                                         _Name = "宝箱"
  27.                                                                                 elseif _Name ~= nil and _Name == " " then
  28.                                                                                         _Name = "楼梯传送"
  29.                                                                                 end
  30.                                                                                 NLG.SystemMessage(CharIndex, "[迷宫探测]坐标(".. i .. "," ..l .. ") ".._Name);
  31.                                                                         end
  32.                                                                 end
  33.                                                         end
  34.                                                 end
  35.                                         end
  36.                                 end
  37.                                 NLG.Say(CharIndex,-1,"═════════════════════",1,3)
  38.                         else
  39.                         NLG.SystemMessage(CharIndex, "请在迷宫里使用Gps!")
  40.                         end
  41.                 else
  42.                         NLG.SystemMessage(CharIndex, "GPS无需重复开启!")
  43.                 end
  44.         end
  45. end
  46. --
  47. function GPS_warp(CharIndex, Ori_MapId, Ori_FloorId, Ori_X, Ori_Y, Target_MapId, Target_FloorId, Target_X, Target_Y)
  48.         if GPSIO[CharIndex] == 1 then
  49.                 if Target_MapId == playermapid[CharIndex] then
  50.                         local _FloorId = Char.GetData(CharIndex,%对象_地图%)
  51.                         NLG.SystemMessage(CharIndex, "     "..  Split(NLG.GetMapName(Target_MapId,Target_FloorId),"|")[1]);
  52.                         NLG.Say(CharIndex,-1,"═════════════════════",1,3)
  53.                         for i = 1,100 do
  54.                                 for l = 1,100 do
  55.                                         local k , _objtbl = Obj.GetObject(Target_MapId,Target_FloorId, i, l)
  56.                                         if k ~= 0 then
  57.                                                 for k, v in pairs(_objtbl) do
  58.                                                         if v > 0 then
  59.                                                                 local _Index= Obj.GetCharIndex(v);
  60.                                                                 local _Name = Char.GetData(_Index,%对象_名字%);
  61.                                                                 if _Index ~= CharIndex then
  62.                                                                         if Obj.GetType(_Index) == 4 then
  63.                                                                                 _Name = "宝箱"
  64.                                                                         elseif _Name ~= nil and _Name == " " then
  65.                                                                                 _Name = "楼梯传送"
  66.                                                                         end
  67.                                                                         NLG.SystemMessage(CharIndex, "[迷宫探测]坐标(".. i .. "," ..l .. ") ".._Name);
  68.                                                                 end
  69.                                                         end
  70.                                                 end
  71.                                         end
  72.                                 end
  73.                         end
  74.                         NLG.Say(CharIndex,-1,"═════════════════════",1,3)
  75.                 else
  76.                         NLG.SystemMessage(CharIndex, "已经脱离迷宫,GPS(残缺版)现已关闭");
  77.                         playermapid[CharIndex] = nil;
  78.                         GPSIO[CharIndex] = nil;
  79.                 end
  80.         end
  81. end
复制代码


Rank: 1

发表于 2023-12-4 02:05:23 | 显示全部楼层
建議在這個位置加上return 0;
說出/mg 的時候 可以攔截不輸出到對話攔
螢幕擷取畫面 2023-12-04 020225.png

Rank: 1

发表于 2023-12-4 11:42:47 | 显示全部楼层
下载啦 谢谢大佬

Rank: 2

 楼主| 发表于 2023-12-4 22:38:23 | 显示全部楼层
catter 发表于 2023-12-4 02:05
建議在這個位置加上return 0;
說出/mg 的時候 可以攔截不輸出到對話攔

收到



Rank: 1

发表于 2023-12-5 09:57:44 来自手机 | 显示全部楼层
楼主,为什么我安装上没反应,已经是新框架了呀,需要在moduleconing里添加什么呢?

Rank: 2

 楼主| 发表于 2023-12-5 10:55:53 | 显示全部楼层
wang9067852 发表于 2023-12-5 09:57
楼主,为什么我安装上没反应,已经是新框架了呀,需要在moduleconing里添加什么呢? ...

--
放Module目录
--
ModuleConfig.lua里添加

useModule('GPS')
您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2024-5-19 07:49 , Processed in 0.140399 second(s), 10 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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