therefore i present 100% working (i'm sure you can find some problem if you look xD) remove item and return item to inventory script!!!
- create a timer and a script entity
- set the timer to running and connect it on activate to the checkTorch() function
Code: Select all
function itemCheck(item)
for champ = 1,4 do
for slot = 7,8 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == item then
party:getChampion(champ):removeItem(slot)
print("item removed")
returnItem(item)
end
end
end
end
end
function returnItem(item)
local itemReturned = false
for slot = 11,32 do
for champ = 1,4 do
if itemReturned == false then
if slot < 32 then
if party:getChampion(champ):getItem(slot) == nil then
print("item returned")
party:getChampion(champ):insertItem(slot,x)
itemReturned = true
end
else
spawn(item,player.level,player.x,player.y,player.facing)
end
end
end
end
end
function checkTorch()
itemCheck("torch")
end
if you guys want to check it out that'd be good, then we can add it to the useful scripts repository =) (my first entry ^_^)