채팅0

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

    조회수 315

    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-2022387
      6179312-30201
      6179212-28471
      6179112-28518
      6179012-26752
      6178912-25900
      6178812-25845
      6178712-241134
      6178612-231493
      6178512-221487
      6178412-221645
      6178312-221445
      6178212-211509
      6178112-211687
      6178012-211601
      6177912-191789
      6177812-181879
      6177712-182523
      6177612-162398
      6177512-142484
      안내 배너 이미지