• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent Autoloot

what all did you put in creaturescripts.xml?
<event type="kill" name="autoloot" event="script" value="autoloot.lua"/>

doesn't work, i can use the talkaction but no looting is taking place... figured this is whats wrong.. tfs 0.3.6p
 
what all did you put in creaturescripts.xml?
<event type="kill" name="autoloot" event="script" value="autoloot.lua"/>

doesn't work, i can use the talkaction but no looting is taking place... figured this is whats wrong.. tfs 0.3.6p
This is happening to me too, can anyone help? thank. The talkaction is workin, but it doesn't loot.
 
for those that have the "no fire" symptom and it does not work, try changing your creatureevent script from this

Code:
 if (corpse ~= -1) and isContainer(corpse) and(getItemAttribute(corpse, "corpseowner") == cid) then 
		scanContainer(cid, corpse, tostring(getPlayerStorageValue(cid, stor)):gsub('_', ''):explode(','))
	end
to
Code:
 if (corpse ~= -1) and isContainer(corpse) and(getItemAttribute(corpse, "corpseowner") == getPlayerGUID(cid)) then 
		scanContainer(cid, corpse, tostring(getPlayerStorageValue(cid, stor)):gsub('_', ''):explode(','))
	end
 
Last edited:
The talkaction script work fine here, except when I try to add some item.

I'm using SVN Code, and the commands works like:

!loot"check --> works perfectly ...
!loot"clean --> works perfectly ...

!loot"add --> don't work ...
!loot"remove --> don't work ...

That's the error

PHP:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/autoloot.lua:onSay

luaGetItemIdByName(). Item not found

That is the add part:

PHP:
	elseif (action:lower() == 'add') then
		local infos, list = getPlayerStorageValue(cid, stor), {}
		if (infos ~= -1) then
			list = tostring(infos):gsub('_', ''):explode(',')
		end
 
		if (#list >= limit) then
			return doPlayerSendCancel(cid, 'You already have ' .. limit .. ' autolooting items.')
		end
 
		local item = tonumber(rst)
		if not item then
			--item = getItemIdByName(rst)
			item = getItemIdByName(rst, false)
			if not item then
				return doPlayerSendCancel(cid, 'Not a valid item.')
			end
		end
 
		if not allow_container and isItemContainer(item) then
			return doPlayerSendCancel(cid, 'This item can not be autolooted.')
		end
 
		local attrs = getItemInfo(item)
		if not attrs then
			return doPlayerSendCancel(cid, 'Not a valid item.')
		elseif not attrs.movable or not attrs.pickupable then
			return doPlayerSendCancel(cid, 'This item can not be autolooted.')
		end
 
		if isInArray(list, item) then
			return doPlayerSendCancel(cid, 'This item is already added in your list.')
		end
		table.insert(list, tostring(item))
 
		local new = ''
		for v, id in ipairs(list) do
			new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
		end
		setPlayerStorageValue(cid, stor, tostring(new))
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< has been added to the autoloot list.')

And that is the remove part:

PHP:
	elseif (action:lower() == 'remove') then
		local infos, list = getPlayerStorageValue(cid, stor), {}
		if (infos ~= -1) then
			list = tostring(infos):gsub('_', ''):explode(',')
		end
 
		if (#list == 0) then
			return doPlayerSendCancel(cid, 'You do not have any item added.')
		end
 
		local item = tonumber(rst)
		if not item then
			item = getItemIdByName(rst)
			--item = getItemIdByName(rst, false)
			if not item then
				return doPlayerSendCancel(cid, 'Not a valid item.')
			end
		end
 
		if not isInArray(list, item) then
			return doPlayerSendCancel(cid, 'This item is not in the list.')
		end
 
		local new = ''
		for v, id in ipairs(list) do
			if (tonumber(id) ~= item) then
				new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')
			end
		end
		setPlayerStorageValue(cid, stor, tostring(new))
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< removed from the autoloot list.')
 
Last edited:
mroe info, like server version? try to use it without false as param #2
 
would be awesome if someone made it to tfs 0.3.6 :(
 
Jano you know if it work in tfs .4 cause i was triying to use it on it and it doesnt work for me :/
 
[1:10:27.952] [Error - CreatureScript Interface]
[1:10:27.952] In a timer event called from:
[1:10:27.952] domodlib('Loot_func')
[1:10:27.952] function onDeath(cid, corpse, deathList)
[1:10:27.952] local killer,pos = deathList[1],getCreaturePosition(cid)
[1:10:27.952] addEvent(corpseRetireItems,1,killer,pos)
[1:10:27.952] return true
[1:10:27.952] end:eek:nDeath
[1:10:27.952] Description:
[1:10:27.952] (luaGetContainerSize) Container not found

[1:10:27.952] [Error - CreatureScript Interface]
[1:10:27.952] In a timer event called from:
[1:10:27.952] domodlib('Loot_func')
[1:10:27.952] function onDeath(cid, corpse, deathList)
[1:10:27.952] local killer,pos = deathList[1],getCreaturePosition(cid)
[1:10:27.952] addEvent(corpseRetireItems,1,killer,pos)
[1:10:27.952] return true
[1:10:27.952] end:eek:nDeath
[1:10:27.952] Description:
[1:10:27.952] [string "info = {..."]:153: bad argument #1 to 'pairs' (table expected, got boolean)
[1:10:27.952] stack traceback:
[1:10:27.952] [C]: in function 'pairs'
[1:10:27.952] [string "info = {..."]:153: in function <[string "info = {..."]:142>


Could tell me what is wrong??
 
I cant get it to work but there is no error... I used it without talkAction, with the list table instead
 
Is there any way to use this script in TFS1.1 ? TFS1.1 only supports int32 on storage values, not strings like it used to.
 
Back
Top