03-13-2024, 06:45 PM
Would it be possible to make a script which sometimes randomly pushes items which are on the floor to a random other position?
Like, when I'm hunting manually, out of boredom I tend to randomly move items i come across on the floor. Mostly corpses of monsters.
For example, I am hunting dwarf guards, and I want a script which with a certain random value throws a dead body some SQM away.
Like:
But this isn't working.
I'm sure you know what I mean and can come up with something brilliant again.
Best would be if i sometimes quickly throw something when walking past that specific item
Like, when I'm hunting manually, out of boredom I tend to randomly move items i come across on the floor. Mostly corpses of monsters.
For example, I am hunting dwarf guards, and I want a script which with a certain random value throws a dead body some SQM away.
Like:
local itemIDs = {3294, 2853, 3049}
local function getRandomOffset()
return math.random(-3, 3)
end
-- Main loop
while true do
for _, itemId in ipairs(itemIDs) do
local nearbyItem = finditemonground(itemId)
if nearbyItem then
-- Calculate random offsets for target coordinates
local offsetX, offsetY = getRandomOffset(), getRandomOffset()
-- Calculate the target position
local targetX, targetY, targetZ = posx() + offsetX, posy() + offsetY, posz()
-- Move the item to the target position
if ground(targetX, targetY, targetZ) == 1 then
moveitem(itemId, targetX, targetY, targetZ)
end
end
end
-- Adjust the probability of moving an item by changing the range of the random value
if math.random(1, 100) <= 50 then
wait(1000, 10000)
end
end
But this isn't working.
I'm sure you know what I mean and can come up with something brilliant again.
Best would be if i sometimes quickly throw something when walking past that specific item