채팅0

    스크립트 수정했는데 뭐가 잘못된지 아시는분 댓글점 1:1 드리겠습니

    조회수 478

    return function (self, mob)


    if zz_y7.use_momo then

    local ai = mob.MobAIComponent


    local kb = mob.MobKnockbackComponent


    local rb = mob.MobRigidbodyComponent


    if (not isvalid(rb) or not isvalid(kb) or not isvalid(ai)) then


    local hasAI = ai ~= nil and 1 or 0

            loca

    local hasKnockback = kb ~= nil and 1 or 0


    local hasRigid = rb ~= nil and 1 or 0

    log_warning(

    log_warning(str

            lo

    string.format("hasAI: %d hasKnockback: %d hasRigid: %d", hasAI, hasKnockback, hasRigid))

            retur

    return

    end


    local target = _UserService.LocalPlayer


    local nextAction = 0


    local timelines = {}


    local timelineIndex = 0

        loc

    local currentX, currentY = mob.TransformComponent.WorldPosition.x, mob.TransformComponent.WorldPosition.y

        loca

    local function makeCommand(cmd, destX, destY, floating, layer)


    local duration = math.sqrt((destX - currentX)^2 + (destY - currentY)^2) / (rb.FlySpeed * _Physics.FlySpeed / 1)

    currentX = destX

    currentY = destY

            timelines[timelineIndex + 
            currentX = destX
            currentY = destY
    
            timelines[timeli
    
            currentX = destX
            currentY = destY
    
            
            currentX = destX
            currentY = destY
    
     
    
            currentX = destX
            currentY = d
    
            currentX = destX
            
    
            current

    1] = { cmd, { destX, destY, duration, floating, layer }, duration }

    timelineIndex = timelineIndex +

    tim


    1

    return duration

    end

        kb:SetShoeAttr(

        if (isvalid(target)) then
            local targetPos = target.TransformComponent.WorldPosition:ToVector2()
            local targetX = targetPos.x
            local targetY = targetPos.y
    
            local dirVecX, dirVecY = targetX - mob.TransformComponent.WorldPosition.x, targetY - mob.TransformComponent.WorldPosition.y
            dirVecX = dirVecX * 
            dirVecX = dirVecX 

    1 -- 조절 가능한 값

    dirVecY = dirVecY * 1 -- 조절 가능한 값

            targetX = mob.TransformComponent.WorldPosition.x + dirVecX
            targetY = mob.TransformComponent.WorldPosition.y + dirVecY
    
            makeCommand(_MobActionPartType.Fly, targetX, targetY, 
    
            targetX = mob.TransformComponent.WorldPosition.x + dirVecX
            targetY = mob.TransformComponent.WorldPosition.y + dirVecY
    
            makeCommand(_Mo
    
    
            targetX = mob.TransformComponent.WorldPosition.x + dirVecX
            targetY = mob.TransformCompone
    
    
            targetX = mob.TransformComponent.WorldPositi

    false, "Npc")


    end

        if timelineIndex > 0 then
            mob.CurrentMap.LifeControllerComponent:RequestControl(mob, timelines, timelineIndex, 
            mob.CurrentMap.LifeControllerComponent:RequestControl(mob, 
    
            mo

    true)

    end

    ai:EnableNextControlTimer(nextAction)

        ai:En

    end

    end

    여기서 뭐가 문제인지를 모르겠네


    실행도됨 몬스터들이 자꾸 구석으로 다 모여서 그렇지;;

    댓글8

    회원프로필

    코드가 왜이렇게 잣같이보이냐

    2024.01.27 00:16
    회원프로필

    고수가 아니니 그렇지;;; 내가 아는방식에서는 최선임..

    2024.01.27 00:16
    회원프로필

    모이는 방향이 구석이야... 이거 뭐가 잘못된거?

    2024.01.27 00:16
    회원프로필

    파일로 업로드해바

    2024.01.27 00:16
    회원프로필

    파일로 업로드를 왜해 코드가 떡하니 다나와있는데
    등신임?

    2024.01.27 00:18
    회원프로필

    니 저거 보고 읽을 수 있음?

    2024.01.27 00:29
    회원프로필

    문제를 해결하기 위해 다음과 같은 접근 방식을 시도해 볼 수 있습니다:

    dirVecX와 dirVecY 값을 조절하여 이동 방향을 변경합니다. 현재 스크립트에서는 dirVecX와 dirVecY를 각각 1로 설정하고 있습니다. 이 값을 적절히 조정하여 원하는 이동 방향을 설정할 수 있습니다.
    targetX와 targetY의 값을 조정하여 목표 위치를 변경합니다. 현재 스크립트에서는 targetX와 targetY를 현재 위치에 dirVecX와 dirVecY를 더하여 설정하고 있습니다. 이 값을 적절히 조정하여 원하는 위치로 이동할 수 있습니다.

    그렇대

    2024.01.27 00:17
    회원프로필

    파일로 해라 보기 즂같다

    2024.01.27 00:18

      게시글 리스트
      제목작성자작성일조회
      1879801-27479
      1879701-27506
      1879601-27528
      1879501-27190
      1879401-27805
      1879301-27200
      1879201-27459
      1879101-27216
      1879001-27666
      1878901-27173
      1878801-27395
      1878701-27526
      1878601-27178
      1878501-27255
      1878401-27478
      1878301-26733
      1878201-26456
      1878101-26273
      1878001-261030
      1877901-26241
      안내 배너 이미지