PDA

View Full Version : Drop Assassin stars when more than X



smoq
04-19-2016, 08:36 AM
Hi guys!
I am playing on OT Server and i need simply script to drop assassin stars when got more than X.
(I go hunt with 100 stars, when i got more than 120 stars bot should drop 20)
If possible to do something like that?

dinmamma
04-24-2016, 08:10 PM
smoq


itemId = 3578 -- Item Id that you want to drop
dropMin = 9 -- Which ammount (minimum) do you want to drop?
dropMax = 15 -- Which ammount (maximum) do you want to drop?

function dropItem(id, cnt)
local cont = Container.GetFirst()

while (cont:isOpen()) do
for spot = 0, cont:ItemCount() do
local item = cont:GetItemData(spot)
if (item.id == id and item.count >= cnt) then
cont:MoveItemToGround(spot, Self.Position().x, Self.Position().y, Self.Position().z)
return true
end
end

cont = cont:GetNext()
end

return false
end


while (true) do
if (dropItem(itemId,math.random(dropMin,dropMax))) then
wait(30000, 45000)
else
wait(2000)
end

I'm using this, it randomizes the count for more randomness, you can just set both values to 20 if you play OT.