채팅0

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

    조회수 312

    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

      게시글 리스트
      제목작성자작성일조회
      1939801-271005
      1939701-27806
      1939601-27154
      1939501-27271
      1939401-27333
      1939301-27749
      1939201-27392
      1939101-27260
      1939001-27160
      1938901-27433
      1938801-27184
      1938701-27346
      1938601-27313
      1938501-27470
      1938401-27282
      1938301-27178
      1938201-27176
      1938101-27117
      1938001-27134
      1937901-27126
      안내 배너 이미지