• 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!

Corpse to Cookie :)

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello.
TFS 0.3.5pl1 (tibia 8.50)
Well i have something effective and creative idea! :)

If you are vocation 3 and you kill monster, and standing 1 sqm down than corpse and your looking direction is on corpse, after saying words: "cookie" the corpse is changing into cookie.

Picture:
corpsefood.png



Can anyone script that ? :)
Of course in talkactions or in spell :)
 
Code:
local corpses = {
	666,
	1337
}

local cookie = 1234

function onSay(cid, words, param, channel)
	if not getPlayerVocation(cid) == 3 then
		return true
	end

	local corpse = getThingFromPos(getCreatureLookPosition(cid))
	if isInArray(corpses, corpse.itemid) then
		doTransformItem(corpse.uid, cookie)
	end

	return true
end
 
Nice :)
But you can re-make it, I can only use cookie on corpses killed by me ? :)
And also message: "You cannot use cookie command", "You cannot change this corpse to cookie.", "You cannot change other killer corpse"
 
You need onDeath event that will 'set corpse owner', requires registering it for all/certain monsters tho:
Code:
local function setCorpseOwner(cid, corpse)
	local func = doItemSetAttribute
	if func then
		doItemSetAttribute(corpse.uid, 'aid', cid)
	else
		doSetItemActionId(corpse.uid, cid)
	end
end

function onDeath(cid, corpse, deathList)
	local killer
	for _, v in ipairs(deathList) do
		if isPlayer(v) then
			killer = v
			break
		end
	end

	if isMonster(cid) then
		addEvent(setCorpseOwner, 0, killer, corpse)
	end

	return true
end

And talkaction:
Code:
local corpses = {
	666,
	1337
}

local cookie = 1234

local function isCookieOwner(cid, corpse)
	return corpse == cid
end

function onSay(cid, words, param, channel)
	if not getPlayerVocation(cid) == 3 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You cannot use cookie command')
		return true
	end

	local corpse = getThingFromPos(getCreatureLookPosition(cid))
	if isInArray(corpses, corpse.itemid) then
		if isCookieOwner(cid, corpse.actionid) then
			doTransformItem(corpse.uid, cookie)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You cannot change other killer corpse.')
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You cannot change this corpse to cookie.')
	end

	return true
end
 
Last edited:
Back
Top