채팅0

    형님들 여기서 뭐가 잘못 되었는지 힌트 좀 받을 수 있을까요?

    조회수 313

    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) and isvalid(kb) and isvalid(ai)) then
            local hasAI = ai ~= nil and 1 or 0
            local hasKnockback = kb ~= nil and 1 or 0
            local hasRigid = rb ~= nil and 1 or 0
            log_warning(string.format("hasAI: %d  hasKnockback: %d  hasRigid: %d", hasAI, hasKnockback, hasRigid))
            return
        end
    
        local mobPos = mob.TransformComponent.WorldPosition
        local mobX = mobPos.x
        local mobY = mobPos.y
    
        -- Define the gathering point coordinates
        local gatherTargetX = 100
        local gatherTargetY = 200
    
        -- Check if the monster is alone on the map
        local aloneOnMap = true
        for _, otherMob in pairs(_MonsterManager.MonsterList) do
            if otherMob.Id ~= mob.Id then
                local otherPos = otherMob.TransformComponent.WorldPosition
                local distance = math.sqrt((otherPos.x - mobX)^2 + (otherPos.y - mobY)^2)
                if distance < 10 then -- Adjust the distance threshold as needed
                    aloneOnMap = false
                    break
                end
            end
        end
    
        if aloneOnMap then
            -- Calculate the direction towards the gathering point
            local dirVecX, dirVecY = gatherTargetX - mobPos.x, gatherTargetY - mobPos.y
            dirVecX = dirVecX * 1
            dirVecY = dirVecY * 1
    
            local targetX = mobPos.x + dirVecX
            local targetY = mobPos.y + dirVecY
    
            kb:SetShoeAttr(0)
    
            -- Make the monster fly towards the gathering point
            ai:RequestFly(targetX, targetY, 1.0, "Npc")
        end
    end

    end


    gatherTargetX 0.8

    gatherTargetY 0.2

    좌표 수정해도 몬스터가 안모여유 ㅠㅠ

    댓글2

    회원프로필

    ?

    2024.01.27 15:05
    회원프로필

    와 개어렵네

    2024.01.27 15:06

      게시글 리스트
      제목작성자작성일조회
      공지10-2022126
      6167701:0334
      6167611-14117
      6167511-14135
      6167411-14132
      6167311-14141
      6167211-13236
      6167111-13289
      6167011-13271
      6166911-13256
      6166811-13268
      6166711-13290
      6166611-13413
      6166511-12422
      6166411-12444
      6166311-12504
      6166211-11642
      6166111-11594
      6166011-11765
      6165911-11643
      안내 배너 이미지