채팅0

    gpt에게 물어본 점언 주석

    조회수 480

    -- 몬스터 제어 함수

    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


    도대체 점프는어디에?

    댓글4

    회원프로필

    ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

    2024.01.27 23:24
    회원프로필

    챗gpt로 만들수있으면 다만들지 ㅋㅋㅋ

    2024.01.27 23:25
    회원프로필

    걔한테 물어보면 안돼..

    2024.01.27 23:29
    회원프로필

    야 그래도 이거 덕분에 좌표는 알아냈다

    2024.01.27 23:48

      게시글 리스트
      제목작성자작성일조회
      공지10-2022125
      6167616:5580
      6167515:4388
      6167415:2782
      6167309:05109
      6167211-13201
      6167111-13246
      6167011-13234
      6166911-13224
      6166811-13236
      6166711-13259
      6166611-13380
      6166511-12387
      6166411-12413
      6166311-12473
      6166211-11609
      6166111-11564
      6166011-11729
      6165911-11613
      6165811-11777
      안내 배너 이미지