找回密码
 注册/Sign up
搜索
楼主: ahsin

改进版佣兵

[复制链接]

发表于 2021-12-22 23:58:11 | 显示全部楼层
ahsin 发表于 2021-12-22 23:20
全套测试后,建议筛选几个需要的lua然后使用。仍然要坚持全套的注意lua和道具和地图都是有关联的,道具、 ...

是甲鱼大佬么~~~ 名字形象 AI 我都改了的,之前的那款YB可以使用,你昨天新增的 登出组队 的那款不能使用,登出就挂端

补充内容 (2021-12-23 00:05):
重新测试了一下,又可以了,怪事

补充内容 (2021-12-23 00:06):
可能是哪个LUA冲突 ,我测试下

补充内容 (2021-12-23 01:01):
是有BUG,会卡死账号。 登出加入队伍之后,关闭服务器 再开启服务器 人物就进不去了!报错 NL_WarpCallBack lua 和 myLogin报错

补充内容 (2021-12-23 01:03):
领取原地登录之后 报错就消失了。应该是佣兵没有领取原地登录的原因。

补充内容 (2021-12-23 01:08):
不知道BUG怎么出的,刚刚测试又没有出BUG。

补充内容 (2021-12-23 01:09):
测试出来了,是关闭服务器之后,再次重启服务器,携带佣兵,领取原地登录,登出服务器之后就会报错!

 楼主| 发表于 2021-12-23 01:03:04 | 显示全部楼层
zaza32167 发表于 2021-12-22 23:58
是甲鱼大佬么~~~ 名字形象 AI 我都改了的,之前的那款YB可以使用,你昨天新增的 登出组队 的那款不能使用 ...

我也发现了,重启cgmsv后,就第1个登陆的人会卡,之后的人就都不会卡了

发表于 2021-12-23 01:10:59 | 显示全部楼层
查看附件图,报错提示

BUG报错

BUG报错

 楼主| 发表于 2021-12-23 03:46:17 | 显示全部楼层
本帖最后由 ahsin 于 2021-12-23 03:47 编辑
zaza32167 发表于 2021-12-23 01:10
查看附件图,报错提示

修复
神奇的问题,初始化table,默认值不得为0,改成-1就好了

覆盖yb.lua即可

  1. ---模块类
  2. local ybModule = ModuleBase:createModule('yb')
  3. local allyb = 0
  4. -- 普通玩家命令
  5. --local commandsNormal = {}
  6. wanjia = {}--玩家表
  7. for bbb = 0,800 do
  8.         wanjia[bbb] = {}
  9.         wanjia[bbb][0] = 0--ai统计
  10.         wanjia[bbb][1] = -1
  11.         wanjia[bbb][2] = -1
  12.         wanjia[bbb][3] = -1
  13.         wanjia[bbb][4] = -1
  14.         wanjia[bbb][5] = -1
  15.         wanjia[bbb][6] = -1
  16. end
  17. Delegate.RegDelTalkEvent("yb_TalkEvent");--说话触发
  18. Delegate.RegDelAllOutEvent("yboffline");--玩家下线触发
  19. Delegate.RegDelAfterWarpEvent("ybwarp");--玩家传送触发
  20. function ybwarp(player,map,floor,x,y,aftermap,afterfloor,afterx,aftery)--传送后若ai掉队则加回队伍来
  21.         print("player NO: "..player.."")
  22.         if Char.PartyNum(wanjia[player][1]) == -1 then
  23.                 Char.Warp(wanjia[player][1],aftermap,afterfloor,afterx,aftery)
  24.                 Char.JoinParty(wanjia[player][1],player);
  25.         end
  26.         if Char.PartyNum(wanjia[player][2]) == -1 then
  27.                 Char.Warp(wanjia[player][2],aftermap,afterfloor,afterx,aftery)
  28.                 Char.JoinParty(wanjia[player][2],player);
  29.         end
  30.         if Char.PartyNum(wanjia[player][3]) == -1 then
  31.                 Char.Warp(wanjia[player][3],aftermap,afterfloor,afterx,aftery)
  32.                 Char.JoinParty(wanjia[player][3],player);
  33.         end
  34.         if Char.PartyNum(wanjia[player][4]) == -1 then
  35.                 Char.Warp(wanjia[player][4],aftermap,afterfloor,afterx,aftery)
  36.                 Char.JoinParty(wanjia[player][4],player);
  37.         end
  38.         if Char.PartyNum(wanjia[player][5]) == -1 then
  39.                 Char.Warp(wanjia[player][5],aftermap,afterfloor,afterx,aftery)
  40.                 Char.JoinParty(wanjia[player][5],player);
  41.         end
  42.         if Char.PartyNum(wanjia[player][6]) == -1 then
  43.                 Char.Warp(wanjia[player][6],aftermap,afterfloor,afterx,aftery)
  44.                 Char.JoinParty(wanjia[player][6],player);
  45.         end
  46. end
  47. function yboffline(player)--玩家下线清空自己召唤的ai
  48. if wanjia[player][1] > 0 then
  49.         Char.DelDummy(wanjia[player][1])
  50.         wanjia[player][0] = 0
  51. end
  52. if wanjia[player][2] > 0 then
  53.         Char.DelDummy(wanjia[player][2])
  54.         wanjia[player][0] = 0
  55. end
  56. if wanjia[player][3] > 0 then
  57.         Char.DelDummy(wanjia[player][3])
  58.         wanjia[player][0] = 0
  59. end
  60. if wanjia[player][4] > 0 then
  61.         Char.DelDummy(wanjia[player][4])
  62.         wanjia[player][0] = 0
  63. end
  64. if wanjia[player][5] > 0 then
  65.         Char.DelDummy(wanjia[player][5])
  66.         wanjia[player][0] = 0
  67. end
  68. if wanjia[player][6] > 0 then
  69.         Char.DelDummy(wanjia[player][6])
  70.         wanjia[player][0] = 0
  71. end
  72. wanjia[player][0] = 0
  73. end
  74. --function commandsNormal.yb01(player, args)
  75. function yb_TalkEvent(player,msg,color,range,size)
  76. suiji = math.random(80,100)--生成80~100的随机数--然后ai参考人物生成浮动bp
  77. rlv = Char.GetData(player,%对象_等级%)
  78. rlv = rlv /100 * suiji
  79. rx = Char.GetData(player,%对象_体力%)
  80. rx = rx / 100 * suiji
  81. rm = Char.GetData(player,%对象_魔法%)
  82. rm = rm / 100 * suiji
  83. rg = Char.GetData(player,%对象_力量%)
  84. rg = rg / 100 * suiji
  85. --print(rg)
  86. rf = Char.GetData(player,%对象_强度%)
  87. rf = rf / 100 * suiji
  88. rs = Char.GetData(player,%对象_速度%)
  89. rs = rs / 100 * suiji
  90. --print(rm)
  91. if msg == "/aiback" or msg == "、aiback" then
  92.         wjmap = Char.GetData(player,%对象_MAP%)
  93.         wjfloor = Char.GetData(player,%对象_地图%)
  94.         wjx = Char.GetData(player,%对象_X%)
  95.         wjy = Char.GetData(player,%对象_Y%)
  96.         if Char.PartyNum(wanjia[player][1]) == -1 then
  97.                 Char.Warp(wanjia[player][1],wjmap,wjfloor,wjx,wjy)
  98.                 Char.JoinParty(wanjia[player][1],player);
  99.                 --print(Char.IsDummy(wanjia[player][1]))
  100.         end
  101.         if Char.PartyNum(wanjia[player][2]) == -1 then
  102.                 Char.Warp(wanjia[player][2],wjmap,wjfloor,wjx,wjy)
  103.                 Char.JoinParty(wanjia[player][2],player);
  104.         end
  105.         if Char.PartyNum(wanjia[player][3]) == -1 then
  106.                 Char.Warp(wanjia[player][3],wjmap,wjfloor,wjx,wjy)
  107.                 Char.JoinParty(wanjia[player][3],player);
  108.         end
  109.         if Char.PartyNum(wanjia[player][4]) == -1 then
  110.                 Char.Warp(wanjia[player][4],wjmap,wjfloor,wjx,wjy)
  111.                 Char.JoinParty(wanjia[player][4],player);
  112.         end
  113.         if Char.PartyNum(wanjia[player][5]) == -1 then
  114.                 Char.Warp(wanjia[player][5],wjmap,wjfloor,wjx,wjy)
  115.                 Char.JoinParty(wanjia[player][5],player);
  116.         end
  117.         if Char.PartyNum(wanjia[player][6]) == -1 then
  118.                 Char.Warp(wanjia[player][6],wjmap,wjfloor,wjx,wjy)
  119.                 Char.JoinParty(wanjia[player][6],player);
  120.         end
  121. end
  122. if msg == "/killai" or msg == "、killai" then--干掉ai的命令
  123. if wanjia[player][1] > 0 then
  124.         Char.DelDummy(wanjia[player][1])
  125.         wanjia[player][1] = -1
  126.         wanjia[player][0] = 0
  127. end
  128. if wanjia[player][2] > 0 then
  129.         Char.DelDummy(wanjia[player][2])
  130.         wanjia[player][2] = -1
  131.         wanjia[player][0] = 0
  132. end
  133. if wanjia[player][3] > 0 then
  134.         Char.DelDummy(wanjia[player][3])
  135.         wanjia[player][3] = -1
  136.         wanjia[player][0] = 0
  137. end
  138. if wanjia[player][4] > 0 then
  139.         Char.DelDummy(wanjia[player][4])
  140.         wanjia[player][4] = -1
  141.         wanjia[player][0] = 0
  142. end
  143. if wanjia[player][5] > 0 then
  144.         Char.DelDummy(wanjia[player][5])
  145.         wanjia[player][5] = -1
  146.         wanjia[player][0] = 0
  147. end
  148. if wanjia[player][6] > 0 then
  149.         Char.DelDummy(wanjia[player][6])
  150.         wanjia[player][6] = -1
  151.         wanjia[player][0] = 0
  152. end
  153. NLG.SystemMessage(player, '已开除所有佣兵。' )
  154. end
  155. if msg == "/aig" or msg == "、aig" then--召唤弓箭手佣兵
  156.         if wanjia[player][0] > 3 then
  157.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  158.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  159.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  160.         elseif allyb > 750 then
  161.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  162.         else
  163.         if wanjia[player][1] <= 0 then
  164.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  165.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  166.         allyb = charIndex1
  167.         print("编号:"..charIndex1.."")
  168.         wanjia[player][1] = charIndex1
  169.         
  170.         Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  171.         Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  172.         Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  173.         Char.SetData(charIndex1, CONST.CHAR_名字, '恶魔猎手');
  174.         Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  175.         Char.SetData(charIndex1, CONST.CHAR_形象, 100269);
  176.         Char.SetData(charIndex1, CONST.CHAR_原形, 105791);
  177.         Char.SetData(charIndex1, CONST.CHAR_原始图档, 100269);
  178.         print('charIndex1', charIndex1)
  179.         --print(player)
  180.         Char.SetData(charIndex1, CONST.CHAR_体力, rx);
  181.         Char.SetData(charIndex1, CONST.CHAR_力量, rg);
  182.         Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  183.         Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  184.         Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
  185.         Char.SetData(charIndex1, CONST.CHAR_风属性, 100);
  186.         Char.SetData(charIndex1, CONST.CHAR_闪躲, 30);
  187.         Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  188.         Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  189.         Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  190.         NLG.UpChar(charIndex1);
  191.         Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  192.         Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  193.         Char.GiveItem(charIndex1, 2100, 1, false);
  194.         Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  195.         Char.SetData(charIndex1, CONST.CHAR_职业, 44);
  196.         Char.SetData(charIndex1, CONST.CHAR_职类ID, 40);
  197.         Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  198.         Char.AddSkill(charIndex1, 95);
  199.         --Char.GivePet(charIndex1, 3004);
  200.         --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  201.         --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  202.         --local petIndex = Char.GetPet(charIndex1, 0);
  203.         --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  204.         NLG.SystemMessage(player, '召唤佣兵: 弓箭手' )
  205.         Char.JoinParty(charIndex1, player);
  206.         else
  207.         NLG.SystemMessage(player, '只能召唤1位弓箭手。' )
  208.         end
  209.         end
  210. elseif msg == "/aij" or msg == "、aij" then
  211.         if wanjia[player][0] > 3 then
  212.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  213.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  214.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  215.         elseif allyb > 750 then
  216.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  217.         else
  218.         if wanjia[player][2] <= 0 then
  219.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  220.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  221.         allyb = charIndex1
  222.         print("编号:"..charIndex1.."")
  223.         wanjia[player][2] = charIndex1
  224. Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  225. Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  226. Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  227. Char.SetData(charIndex1, CONST.CHAR_名字, '剑圣');
  228. Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  229. Char.SetData(charIndex1, CONST.CHAR_形象, 100528);
  230. Char.SetData(charIndex1, CONST.CHAR_原形, 101127);
  231. Char.SetData(charIndex1, CONST.CHAR_原始图档, 100528);
  232. print('charIndex1', charIndex1)
  233. Char.SetData(charIndex1, CONST.CHAR_体力, rx);
  234. Char.SetData(charIndex1, CONST.CHAR_力量, rg);
  235. Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  236. Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  237. Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
  238. Char.SetData(charIndex1, CONST.CHAR_地属性, 100);
  239. Char.SetData(charIndex1, CONST.CHAR_命中, 30);
  240. Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  241. Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  242. Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  243. NLG.UpChar(charIndex1);
  244. Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  245. Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  246. --Char.GiveItem(charIndex1, 900048, 1, false);
  247. --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  248. Char.SetData(charIndex1, CONST.CHAR_职业, 14);
  249. Char.SetData(charIndex1, CONST.CHAR_职类ID, 10);
  250. Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  251. Char.AddSkill(charIndex1, 1006);
  252. --Char.GivePet(charIndex1, 3004);
  253. --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  254. --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  255. --local petIndex = Char.GetPet(charIndex1, 0);
  256. --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  257. NLG.SystemMessage(player, '召唤佣兵: 剑士' )
  258. Char.JoinParty(charIndex1, player);
  259. else
  260.         NLG.SystemMessage(player, '只能召唤1位剑士。' )
  261.         end
  262.         end
  263. elseif msg == "/aif" or msg == "、aif" then
  264.         if wanjia[player][0] > 3 then
  265.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  266.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  267.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  268.         elseif allyb > 750 then
  269.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  270.         else
  271.         if wanjia[player][3] <= 0 then
  272.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  273.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  274.         allyb = charIndex1
  275.         print("编号:"..charIndex1.."")
  276.         wanjia[player][3] = charIndex1
  277. Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  278. Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  279. Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  280. Char.SetData(charIndex1, CONST.CHAR_名字, '法国榔头');
  281. Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  282. Char.SetData(charIndex1, CONST.CHAR_形象, 100125);
  283. Char.SetData(charIndex1, CONST.CHAR_原形, 105997);
  284. Char.SetData(charIndex1, CONST.CHAR_原始图档, 100125);
  285. print('charIndex1', charIndex1)
  286. Char.SetData(charIndex1, CONST.CHAR_体力, rx);
  287. Char.SetData(charIndex1, CONST.CHAR_力量, rg);
  288. Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  289. Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  290. Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
  291. Char.SetData(charIndex1, CONST.CHAR_火属性, 100);
  292. Char.SetData(charIndex1, CONST.CHAR_必杀, 30);
  293. Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  294. Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  295. Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  296. NLG.UpChar(charIndex1);
  297. Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  298. Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  299. --Char.GiveItem(charIndex1, 900049, 1, false);
  300. --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  301. Char.SetData(charIndex1, CONST.CHAR_职业, 24);
  302. Char.SetData(charIndex1, CONST.CHAR_职类ID, 20);
  303. Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  304. Char.AddSkill(charIndex1, 3);
  305. --Char.GivePet(charIndex1, 3004);
  306. --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  307. --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  308. --local petIndex = Char.GetPet(charIndex1, 0);
  309. --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  310. NLG.SystemMessage(player, '召唤佣兵: 战斧' )
  311. Char.JoinParty(charIndex1, player);
  312. else
  313.         NLG.SystemMessage(player, '只能召唤1位战斧。' )
  314.         end
  315.         end
  316. elseif msg == "/aiq" or msg == "、aiq" then
  317.         if wanjia[player][0] > 3 then
  318.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  319.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  320.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  321.         elseif allyb > 750 then
  322.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  323.         else
  324.         if wanjia[player][4] <= 0 then
  325.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  326.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  327.         allyb = charIndex1
  328.         print("编号:"..charIndex1.."")
  329.         wanjia[player][4] = charIndex1
  330. Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  331. Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  332. Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  333. Char.SetData(charIndex1, CONST.CHAR_名字, 'Archer');
  334. Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  335. Char.SetData(charIndex1, CONST.CHAR_形象, 100073);
  336. Char.SetData(charIndex1, CONST.CHAR_原形, 101142);
  337. Char.SetData(charIndex1, CONST.CHAR_原始图档, 100073);
  338. print('charIndex1', charIndex1)
  339. Char.SetData(charIndex1, CONST.CHAR_体力, rx);
  340. Char.SetData(charIndex1, CONST.CHAR_力量, rg);
  341. Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  342. Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  343. Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
  344. Char.SetData(charIndex1, CONST.CHAR_水属性, 100);
  345. Char.SetData(charIndex1, CONST.CHAR_反击, 30);
  346. Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  347. Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  348. Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  349. NLG.UpChar(charIndex1);
  350. Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  351. Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  352. --Char.GiveItem(charIndex1, 2100, 1, false);
  353. --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  354. Char.SetData(charIndex1, CONST.CHAR_职业, 34);
  355. Char.SetData(charIndex1, CONST.CHAR_职类ID, 30);
  356. Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  357. Char.AddSkill(charIndex1, 1);
  358. --Char.GivePet(charIndex1, 3004);
  359. --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  360. --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  361. --local petIndex = Char.GetPet(charIndex1, 0);
  362. --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  363. NLG.SystemMessage(player, '召唤佣兵: 骑士' )
  364. Char.JoinParty(charIndex1, player);
  365. else
  366.         NLG.SystemMessage(player, '只能召唤1位骑士。' )
  367.         end
  368.         end
  369. elseif msg == "/aigd" or msg == "、aigd" then
  370.         if wanjia[player][0] > 3 then
  371.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  372.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  373.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  374.         elseif allyb > 750 then
  375.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  376.         else
  377.         if wanjia[player][5] <= 0 then
  378.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  379.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  380.         allyb = charIndex1
  381.         print("编号:"..charIndex1.."")
  382.         wanjia[player][5] = charIndex1
  383. Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  384. Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  385. Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  386. Char.SetData(charIndex1, CONST.CHAR_名字, '加盐纯净水');
  387. Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  388. Char.SetData(charIndex1, CONST.CHAR_形象, 100108);
  389. Char.SetData(charIndex1, CONST.CHAR_原形, 119500);
  390. Char.SetData(charIndex1, CONST.CHAR_原始图档, 100108);
  391. print('charIndex1', charIndex1)
  392. Char.SetData(charIndex1, CONST.CHAR_体力, rx);
  393. Char.SetData(charIndex1, CONST.CHAR_力量, rg);
  394. Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  395. Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  396. Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
  397. Char.SetData(charIndex1, CONST.CHAR_地属性, 100);
  398. Char.SetData(charIndex1, CONST.CHAR_命中, 30);
  399. Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  400. Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  401. Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  402. NLG.UpChar(charIndex1);
  403. Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  404. Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  405. --Char.GiveItem(charIndex1, 2100, 1, false);
  406. --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  407. Char.SetData(charIndex1, CONST.CHAR_职业, 144);
  408. Char.SetData(charIndex1, CONST.CHAR_职类ID, 140);
  409. Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  410. Char.AddSkill(charIndex1, 4);
  411. --Char.GivePet(charIndex1, 3004);
  412. --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  413. --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  414. --local petIndex = Char.GetPet(charIndex1, 0);
  415. --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  416. NLG.SystemMessage(player, '召唤佣兵: 格斗' )
  417. Char.JoinParty(charIndex1, player);
  418. else
  419.         NLG.SystemMessage(player, '只能召唤1位格斗。' )
  420.         end
  421.         end
  422. elseif msg == "/aim" or msg == "、aim" then
  423.         if wanjia[player][0] > 3 then
  424.         NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
  425.         elseif Char.GetData(player,%对象_战宠%) == -1 then
  426.         NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
  427.         elseif allyb > 750 then
  428.         NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
  429.         else
  430.         if wanjia[player][6] <= 0 then
  431.         local charIndex1 = Char.CreateDummy()--生成ai佣兵
  432.         wanjia[player][0] = wanjia[player][0] + 1--统计ai佣兵数量
  433.         allyb = charIndex1
  434.         print("编号:"..charIndex1.."")
  435.         wanjia[player][6] = charIndex1
  436. Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
  437. Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
  438. Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
  439. Char.SetData(charIndex1, CONST.CHAR_名字, '马猴烧酒');
  440. Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
  441. Char.SetData(charIndex1, CONST.CHAR_形象, 100322);
  442. Char.SetData(charIndex1, CONST.CHAR_原形, 104968);
  443. Char.SetData(charIndex1, CONST.CHAR_原始图档, 100322);
  444. print('charIndex1', charIndex1)
  445. Char.SetData(charIndex1, CONST.CHAR_体力, rx/2);
  446. Char.SetData(charIndex1, CONST.CHAR_力量, 0);
  447. Char.SetData(charIndex1, CONST.CHAR_强度, rf);
  448. Char.SetData(charIndex1, CONST.CHAR_速度, rs);
  449. Char.SetData(charIndex1, CONST.CHAR_魔法, rm*10);
  450. Char.SetData(charIndex1, CONST.CHAR_风属性, 100);
  451. Char.SetData(charIndex1, CONST.CHAR_闪躲, 30);
  452. Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
  453. Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
  454. Char.SetData(charIndex1, CONST.CHAR_种族, 0);
  455. NLG.UpChar(charIndex1);
  456. Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
  457. Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
  458. --Char.GiveItem(charIndex1, 2100, 1, false);
  459. --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
  460. Char.SetData(charIndex1, CONST.CHAR_职业, 74);
  461. Char.SetData(charIndex1, CONST.CHAR_职类ID, 70);
  462. Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
  463. Char.AddSkill(charIndex1, 22);
  464. --Char.GivePet(charIndex1, 3004);
  465. --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
  466. --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
  467. --local petIndex = Char.GetPet(charIndex1, 0);
  468. --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
  469. NLG.SystemMessage(player, '召唤佣兵: 法师')
  470. Char.JoinParty(charIndex1, player);
  471. else
  472.         NLG.SystemMessage(player, '只能召唤1位法师。' )
  473.         end
  474.         end
  475. end
  476. end
  477. --[[
  478. function ybModule:handleTalkEvent(player, msg)
  479. local command = msg:match('^/([%w]+)')
  480.   if commandsNormal[command] then
  481.   local arg = msg:match('^/[%w]+ +(.+)$')
  482.     arg = arg and string.split(arg, ' ') or {}
  483.     commandsNormal[command](player, arg);
  484.     return
  485.   end
  486.   return 1;
  487. end
  488. ]]
  489. --- 加载模块钩子
  490. function ybModule:onLoad()
  491.   self:logInfo('load')
  492.   self:regCallback('TalkEvent', Func.bind(self.handleTalkEvent, self))
  493. end
  494. --- 卸载模块钩子
  495. function ybModule:onUnload()
  496.   self:logInfo('unload')
  497. end
  498. return ybModule;
复制代码


发表于 2021-12-25 17:30:08 | 显示全部楼层
本帖最后由 13669297 于 2021-12-25 17:32 编辑

6666666666666666

发表于 2021-12-27 02:20:33 | 显示全部楼层
根据大佬的yb.lua ,进一步更新了一些内容!
主要几点:
1.佣兵防御过低,初始佣兵增加少量防御BP
2.佣兵不再单独1人,会携带专属宠物上场战斗
3.物理系佣兵和法系佣兵分开,解决法系人物没有力量BP召唤的佣兵没有攻击力问题。
4.佣兵单独一项BP增长翻倍,另类解决佣兵无法装备武器防具的BUG
物理系佣兵召唤指令:/yb01--/yb05
法系佣兵召唤指令:/ai01--/ai05
除了剑士不带宠物,其他佣兵都携带宠物进入战斗
宠物数据匹配人,AI压缩包里有,可自行修改

佣兵指令和相关AI.rar

4.44 KB, 下载次数: 110

发表于 2021-12-27 02:51:59 | 显示全部楼层
不是 我召唤出佣兵了 得切换或者进入下一个场景才能加入,但是,他们不动啊。就是战斗卡住了,不会攻击什么的,这就是佣兵吗,他们能战斗吗

发表于 2021-12-27 03:23:56 | 显示全部楼层
可以了  但是楼上的 ,佣兵依然没有带宠物啊

发表于 2021-12-27 03:25:41 来自手机 | 显示全部楼层
可以战斗啊,你用的哪个版本的yb.lua?要ai,佣兵名字,宠物名字要匹配才不会卡住

发表于 2021-12-27 03:27:33 来自手机 | 显示全部楼层
跃动幽助 发表于 2021-12-27 02:51
不是 我召唤出佣兵了 得切换或者进入下一个场景才能加入,但是,他们不动啊。就是战斗卡住了,不会攻击什么 ...

实在不会可以直接下载大佬的全套lua包,删除原版lua替换掉,更改下佣兵的形象即可
您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2026-6-5 09:08 , Processed in 0.035108 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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