return function (self, mob)
local ai = mob.MobAIComponent
local kb = mob.MobKnockbackComponent
local rb = mob.MobRigidbodyComponent
if (not isvalid(rb)) then
if (isvalid(ai)) then
ai:EnableNextControlTimer(0.1)
end
return
end
if (not mob.Visible) then
ai:EnableNextControlTimer(0.1)
return
end
local fh = rb.LastFoothold
if (fh == 0) then
-- log("last foothold is 0")
-- ai:EnableNextControlTimer(0.1)
end
local now = _UtilLogic.ServerElapsedSeconds
if (now < ai.NextActionTime) then
ai:EnableNextControlTimer(math.max(ai.NextActionTime - now, 0) + 0.1)
return
end
local target = _UserService.LocalPlayer
local nextAction = 0
local newInputX = nil
local mobX = mob.TransformComponent.WorldPosition.x
if (isvalid(target) and ai.LocalUnchaseTick < 7) then
if (ai.AttackWasLast) then
-- 수정: 몹 점프수 5회
nextAction = 5 / 1000
else
nextAction = _GlobalRand32:RandomIntegerRange(100, 160) / 1000
end
local targetX = target.TransformComponent.WorldPosition.x + 0.5
newInputX = targetX > mobX and 1 or -1
else
-- 수정: 몹 점프수를 5회
nextAction = 5 / 1000
newInputX = _GlobalRand32:RandomIntegerRange(-1, 1)
end
local platforms = mob.CurrentMap.PlatformInfoComponent
local timelines = {}
local timelineIndex = 0
local lastTimeline = 0
local playerFh = _UserService.LocalPlayer.WsUserController.LastFoothold
if (playerFh == 0 or platforms.ZMass[playerFh] ~= ai.LocalStartChaseZMass) then
-- ai.LocalUnchaseTick += 1
-- ai:IncUnTick()
local rb = mob.MobRigidbodyComponent
end
local function makeCommand(cmd, value, timeline, nextActionTime)
timelines[timelineIndex + 1] = {cmd, value, timeline - lastTimeline, nextActionTime}
timelineIndex = timelineIndex + 1
lastTimeline = timeline
end
makeCommand(_MobActionPartType.Move, newInputX, 0, nextAction)
ai.NextRandomJump = math.max(ai.NextRandomJump, now + 1)
kb:SetShoeAttr(0)
if (timelineIndex > 0) then
mob.CurrentMap.LifeControllerComponent:RequestControl(mob, timelines, timelineIndex, false)
end
ai:EnableNextControlTimer(nextAction)end
댓글2
몹 조금더 가까워지게는 어떻게 설정하나요
몹이 아예 멈춰버리는데 왜이러는건가요?