-- 战场跑怪 改成如下代码
--me.Msg("战场跑怪")
--判断是否跑到了
nX1 = self.g_killnpcs[nSubTaskId].x
nY1 = self.g_killnpcs[nSubTaskId].y
local nMapId, nCurWorldPosX, nCurWorldPosY = me.GetWorldPos();
if math.abs(nX1-nCurWorldPosX) < 5 and math.abs(nY1-nCurWorldPosY) < 5 then
me.Msg("<color=0,255,255>跑到了,开始战斗<color>")
self:TeamApply();
TimeLastApply = 0
AutoAi:UpdateCfg(Ui.tbLogic.tbAutoFightData:ShortKey())
--self:CreateTeam();
self.nActionType = 5
else
me.AutoPath(nX1, nY1)
end
elseif self.nActionType == 5 then
--虫子下马
local tbSkillInfo = KFightSkill.GetSkillInfo(me.nLeftSkill, 1);
if (tbSkillInfo.nHorseLimited == 1 and me.GetNpc().nIsRideHorse == 1) then -- 此技能必须下马,且当前在马上
Switch("horse"); -- 下马
end
if (TimeLastApply == 0) then
TimeLastApply = GetTime();
elseif(TimeLastApply + 6 <= GetTime()) then
self:CreateTeam(); -- 6秒后建立队伍
end
--战斗中,判断任务是否完成
--me.Msg("打怪中...")