-- ... (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
endend
-- 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)
endend
-- ... (remaining code)
흠.....
댓글4
oh
루아 게임스크립트 어디안에 넣는거야?
파일올려주면 좋은데 ㅠㅠ 초보는 웁니다.
텔포도하고 템박도하는거임?