this seems to ignore alot of the newer monsters any ideas how to fix that? no errors ~
well not only new i guess its just some monsters. example is otherworld monsters (Sparkion, Breach brood, reality reaver, dread intruder) the autolooter wont pickup any loot from them, dont really need to reproduce it just never loots them.what do you mean by newer monsters? and care to share some screenshot or gift of the problem and steps of how to reproduce it
well not only new i guess its just some monsters. example is otherworld monsters (Sparkion, Breach brood, reality reaver, dread intruder) the autolooter wont pickup any loot from them, dont really need to reproduce it just never loots them.
no they are normal creaturesaren't they reward bosses? I don't think this autoloot works with it
did you configure their corpses correctly on items.xml?this seems to ignore alot of the newer monsters any ideas how to fix that? no errors ~
<item id="2806" article="a" name="dead troll">
<attribute key="weight" value="60000" />
<attribute key="containerSize" value="10" />
<attribute key="decayTo" value="2810" />
<attribute key="duration" value="600" />
<attribute key="corpseType" value="blood" />
<attribute key="fluidSource" value="blood" />
</item>
yes that was the problem thank you.did you configure their corpses correctly on items.xml?
example:
XML:<item id="2806" article="a" name="dead troll"> <attribute key="weight" value="60000" /> <attribute key="containerSize" value="10" /> <attribute key="decayTo" value="2810" /> <attribute key="duration" value="600" /> <attribute key="corpseType" value="blood" /> <attribute key="fluidSource" value="blood" /> </item>
dead troll has attribute "corpseType", did you miss that in your monster's corpses?
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/autoloot.lua:onSay
data/talkactions/scripts/autoloot.lua:6: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/talkactions/scripts/autoloot.lua:6: in function <data/talkactions/scripts/autoloot.lua:1>
Hi, I'm receiving this error in terminal:
Code:Lua Script Error: [TalkAction Interface] data/talkactions/scripts/autoloot.lua:onSay data/talkactions/scripts/autoloot.lua:6: attempt to index a nil value stack traceback: [C]: in function '__index' data/talkactions/scripts/autoloot.lua:6: in function <data/talkactions/scripts/autoloot.lua:1>
I did everything right, step by step. I also registered the function "AutoLoot" in login.lua, in function onLogin(player), under the last return true. So I don't know what's wrong, I'm using TFS 1.2, maybe it could be something wrong with the source files?
local item = split[2]:gsub("%s+", "", 1)
function onSay(player, words, param)
local split = param:split(",")
local action, split2 = split[1], split[2]
if action == "add" then
if not split2 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Please enter the itemID or name.\n!autoloot add, itemId or !autoloot add, itemName.")
return false
end
local item = split2:gsub("%s+", "", 1)
local itemType = ItemType(item)
if itemType:getId() == 0 then
itemType = ItemType(tonumber(item))
if itemType:getId() == 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is no item with that id or name.")
return false
end
end
local itemName = tonumber(split2) and itemType:getName() or item
local size = 0
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
local storage = player:getStorageValue(i)
if size == AUTO_LOOT_MAX_ITEMS then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "The list is full, please remove from the list to make some room.")
break
end
if storage == itemType:getId() then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." is already in the list.")
break
end
if storage <= 0 then
player:setStorageValue(i, itemType:getId())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." has been added to the list.")
break
end
size = size + 1
end
elseif action == "remove" then
if not split2 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Please enter the itemID or name.\n!autoloot remove, itemId or !autoloot remove, itemName.")
return false
end
local item = split2:gsub("%s+", "", 1)
local itemType = ItemType(item)
if itemType:getId() == 0 then
itemType = ItemType(tonumber(item))
if itemType:getId() == 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is no item with that id or name.")
return false
end
end
local itemName = tonumber(split2) and itemType:getName() or item
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
if player:getStorageValue(i) == itemType:getId() then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." has been removed from the list.")
player:setStorageValue(i, 0)
return false
end
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." was not founded in the list.")
elseif action == "show" then
local text = "-- Auto Loot List --\n"
local count = 1
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
local storage = player:getStorageValue(i)
if storage > 0 then
text = string.format("%s%d. %s\n", text, count, ItemType(storage):getName())
count = count + 1
end
end
if text == "" then
text = "Empty"
end
player:showTextDialog(1950, text, false)
elseif action == "clear" then
for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do
player:setStorageValue(i, 0)
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "The autoloot list has been cleared.")
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Use the commands: !autoloot {add, remove, show, clear}")
end
return false
end
!autoloot add, itemId or name
split[1] = add
split[2] = itemId/name
Most likely you did not enter the second param and the code doesn't check to see if it's there before using it:
Lua:local item = split[2]:gsub("%s+", "", 1)
In there it attempts to index split[2] but if the user did not enter a second parameter, then it "attempts to index a nil value".
try this:
Lua:function onSay(player, words, param) local split = param:split(",") local action, split2 = split[1], split[2] if action == "add" then if not split2 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Please enter the itemID or name.\n!autoloot add, itemId or !autoloot add, itemName.") return false end local item = split2:gsub("%s+", "", 1) local itemType = ItemType(item) if itemType:getId() == 0 then itemType = ItemType(tonumber(item)) if itemType:getId() == 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is no item with that id or name.") return false end end local itemName = tonumber(split2) and itemType:getName() or item local size = 0 for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do local storage = player:getStorageValue(i) if size == AUTO_LOOT_MAX_ITEMS then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "The list is full, please remove from the list to make some room.") break end if storage == itemType:getId() then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." is already in the list.") break end if storage <= 0 then player:setStorageValue(i, itemType:getId()) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." has been added to the list.") break end size = size + 1 end elseif action == "remove" then if not split2 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Please enter the itemID or name.\n!autoloot remove, itemId or !autoloot remove, itemName.") return false end local item = split2:gsub("%s+", "", 1) local itemType = ItemType(item) if itemType:getId() == 0 then itemType = ItemType(tonumber(item)) if itemType:getId() == 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is no item with that id or name.") return false end end local itemName = tonumber(split2) and itemType:getName() or item for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do if player:getStorageValue(i) == itemType:getId() then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." has been removed from the list.") player:setStorageValue(i, 0) return false end end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, itemName .." was not founded in the list.") elseif action == "show" then local text = "-- Auto Loot List --\n" local count = 1 for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do local storage = player:getStorageValue(i) if storage > 0 then text = string.format("%s%d. %s\n", text, count, ItemType(storage):getName()) count = count + 1 end end if text == "" then text = "Empty" end player:showTextDialog(1950, text, false) elseif action == "clear" then for i = AUTOLOOT_STORAGE_START, AUTOLOOT_STORAGE_END do player:setStorageValue(i, 0) end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "The autoloot list has been cleared.") else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Use the commands: !autoloot {add, remove, show, clear}") end return false end
[Warning - Event::checkScript] Event onKill not found. scripts/autoloot.lua
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/thornia_systems/autoloot.lua:16: 'for' initial valu
e must be a number
stack traceback:
[C]: at 0x7ff6c4304c40
data/creaturescripts/scripts/thornia_systems/autoloot.lua:16: in functio
n <data/creaturescripts/scripts/thornia_systems/autoloot.lua:1>
Thats impossible without client side code, you can probably find backpacks but it will never go directly to the backpack player selected.Great work mate!
I have question about related to where are items stored. I mean can someone tell me if there is option to change the containers where loot will be putted. At this moment all of the items are going to main bp and I would love to change to other container. Is there someone who can help me with it?
Regards
Thats impossible without client side code, you can probably find backpacks but it will never go directly to the backpack player selected.
Do you think thats acceptable way to solve that? put a label with action id in backpack? You cant save items cause their uids change. Items should have its own uid like creatures do which would identify them in lua environment, sadly its something to fix in tfs (imo)You can recursively search backpacks in your inventory, and each item has an temporarily uid.
TFS 1.X+ - containerItem
if AutoLootList.players[playerId] ~= nil then local lootList = AutoLootList.players[playerId].lootList if lootList ~= nil then if corpse:getType():isCorpse() then for a = corpse:getSize() - 1, 0, -1 do local containerItem...otland.net
For instance, a label with a special actionid can be placed in an container that a script can identify and figure out where to place whatever is written in that label?
Do you think thats acceptable way to solve that? put a label with action id in backpack? You cant save items cause their uids change
Ah yes my bad then, this is impossible if you dont want to workaround it with some weird tricks.Just initialize the list of uids on player login, the uids should persist across a player session (unless the item gets manipulated, which isnt normal on backpacks). So you only need to scan the inventory once each login. And the inventory scan only needs to grab any label items it can find, grab the text, see if text represents an item, and associate the backpack holding that label to that item.
It might not be the perfect solution, but it proves that this is not impossible?