채팅0

    펫박 스크립트

    조회수 701

    -- ... (existing code)


    -- Function to teleport the pet to a specific position

    local function teleportToPosition(position)

    setWaitingServer()

    self:RequestPetAction("TELEPORT", 0, position.x, position.y)

    clearSweepTarget()

    end


    -- NEW CODE: Function to command the pet to pull an item towards itself

    local function pullItemToPet(item)

    setWaitingServer()

    self:RequestPetAction("PULL_ITEM", 0, item.EntityId) -- Assuming "PULL_ITEM" is a valid pet action

    clearSweepTarget()

    end


    -- ... (existing code)


    -- Check for sweepable drops

    local sdrops = getSweepableDrops()

    if (#sdrops > 0) then

    for i = 1, #sdrops do

    local drop = sdrops[i]

    local dropPos = drop.TransformComponent.WorldPosition

    local dropId = drop.DropComponent.DropId

    local timeout = self.SweepTemporaryExceptions[dropId] or 0

        if (timeout > now) then
            -- Drop is temporarily excluded
            continue
        end
    
        -- Pull the item towards the pet
        pullItemToPet(drop)
        self.SweepTemporaryExceptions[dropId] = now + 10
        self.SweepTarget = nil  -- No need to set a sweep target as we are pulling the item
        return
    end

    end


    -- NEW CODE: Pull a random item towards the pet if no sweepable drops are found

    if (isvalid(self.SweepTarget) == nil) then

    -- Assuming getRandomSweepableDrop() is a function that returns a random sweepable drop

    local randomDrop = getRandomSweepableDrop()

    if (isvalid(randomDrop)) then
        -- Pull the random item towards the pet
        pullItemToPet(randomDrop)
    end

    end


    -- ... (remaining code)


    흠.....

    댓글4

    회원프로필

    oh

    2024.01.17 23:07
    회원프로필

    루아 게임스크립트 어디안에 넣는거야?

    2024.01.17 23:07
    회원프로필

    파일올려주면 좋은데 ㅠㅠ 초보는 웁니다.

    2024.01.17 23:11
    회원프로필

    텔포도하고 템박도하는거임?

    2024.01.17 23:26

      게시글 리스트
      제목작성자작성일조회
      공지10-2022153
      6168810:3478
      6168711-17165
      6168611-17203
      6168511-17188
      6168411-16491
      6168311-16426
      6168211-16425
      6168111-16399
      6168011-16552
      6167911-16800
      6167811-15470
      6167711-15465
      6167611-15643
      6167511-14747
      6167411-14851
      6167311-14769
      6167211-14684
      6167111-13793
      6167011-13926
      안내 배너 이미지