-- 몬스터 제어 함수
return function (self, mob)
local ai = mob.MobAIComponent
local kb = mob.MobKnockbackComponent
local rb = mob.MobRigidbodyComponent
-- Rigidbody가 없으면 제어 타이머 설정 후 종료
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
-- 몬스터의 마지막 foothold가 없으면 주석 처리한 로그 출력 후 종료
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
nextAction = _GlobalRand32:RandomIntegerRange(200, 900) / 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
-- 플레이어가 유효하지 않거나 몬스터가 추격 중이 아닌 경우
nextAction = (_GlobalRand32:RandomIntegerRange(100, 300) / 1000)
newInputX = _GlobalRand32:RandomIntegerRange(-1, 1)
end
-- 현재 맵의 플랫폼 정보
local platforms = mob.CurrentMap.PlatformInfoComponent
local timelines = {}
local timelineIndex = 0
-- local lastTimeline = 0
-- 플레이어의 마지막 foothold가 없거나 현재 foothold의 ZMass가 시작할 때와 다르면
if (playerFh == 0 or platforms.ZMass[playerFh] ~= ai.LocalStartChaseZMass) then
-- 주석 처리된 코드
-- ai.LocalUnchaseTick += 1
-- ai:IncUnTick()
local rb = mob.MobRigidbodyComponent
end
-- Timeline 명령 생성 함수
local function makeCommand(cmd, value, timeline, nextActionTime)
timelines[timelineIndex + 1] = {cmd, value, timeline, nextActionTime}
timelineIndex = timelineIndex + 1
-- lastTimeline = timeline
end
-- Move 명령 생성
makeCommand(_MobActionPartType.Move, newInputX, 0, nextAction)
-- 무기의 신발 속성 초기화
kb:SetShoeAttr(0)
-- Timeline이 존재하면 몬스터 제어 권한 요청
if (timelineIndex > 0) then
mob.CurrentMap.LifeControllerComponent:RequestControl(mob, timelines, timelineIndex, false)
end
-- 다음 동작을 위한 제어 타이머 설정
ai:EnableNextControlTimer(nextAction)end
도대체 점프는어디에?
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 공지 | 게시판 이용 안내+156 | 10-20 | 22387 | |
| 61793 | 03:20 | 153 | ||
| 61792 | 12-28 | 429 | ||
| 61791 | 12-28 | 477 | ||
| 61790 | 12-26 | 716 | ||
| 61789 | 12-25 | 862 | ||
| 61788 | 12-25 | 805 | ||
| 61787 | 12-24 | 1094 | ||
| 61786 | 12-23 | 1450 | ||
| 61785 | 12-22 | 1446 | ||
| 61784 | 12-22 | 1599 | ||
| 61783 | 12-22 | 1405 | ||
| 61782 | 12-21 | 1472 | ||
| 61781 | 12-21 | 1646 | ||
| 61780 | 12-21 | 1561 | ||
| 61779 | 12-19 | 1752 | ||
| 61778 | 12-18 | 1843 | ||
| 61777 | 12-18 | 2481 | ||
| 61776 | 12-16 | 2360 | ||
| 61775 | 12-14 | 2449 |
댓글4
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
챗gpt로 만들수있으면 다만들지 ㅋㅋㅋ
걔한테 물어보면 안돼..
야 그래도 이거 덕분에 좌표는 알아냈다