채팅0

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

    조회수 314

    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

      게시글 리스트
      제목작성자작성일조회
      1939401-27334
      1939301-27762
      1939201-27394
      1939101-27264
      1939001-27163
      1938901-27436
      1938801-27185
      1938701-27348
      1938601-27315
      1938501-27474
      1938401-27284
      1938301-27180
      1938201-27178
      1938101-27118
      1938001-27135
      1937901-27127
      1937801-271118
      1937701-27152
      1937601-27178
      1937501-27177
      안내 배너 이미지