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

Lua Skinning doesnt work

Glidarn

Member
Joined
May 9, 2009
Messages
970
Reaction score
16
Location
Åkersberga, Sweden
As the topic says i can't skin creatures, it works fine with blessed wooden stake but nothing happends when i'm trying to skin them.


obbi knife lua

Lua:
local config = {
	level = 2
}

local SKINS = {
	-- Minotaurs
	[2830] = {25000, 5878},
	[2871] = {25000, 5878},
	[2866] = {25000, 5878},
	[2876] = {25000, 5878},
	[3090] = {25000, 5878},

	[11133] = {25000, 11130},

	-- Lizards
	[4259] = {25000, 5876},
	[4262] = {25000, 5876},
	[4256] = {25000, 5876},

	[11271] = {25000, 5876},
	[11275] = {25000, 5876},
	[11267] = {25000, 5876},
	[11279] = {25000, 5876},
	[11263] = {25000, 5876},

	-- Dragons
	[3104] = {25000, 5877},
	[2844] = {25000, 5877},

	-- Dragon Lords
	[2881] = {25000, 5948},

	-- Behemoths
	[2931] = {25000, 5893},

	-- Bone Beasts
	[3031] = {25000, 5925},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerLevel(cid) < config.level) then
		doPlayerSendCancel(cid, "You have to be at least Level " .. config.level .. " to use this tool.")
		return true
	end
	if(itemEx.itemid == 12256 and getPlayerStorageValue(cid,42828) < 0) then
		doPlayerAddItem(cid,12263,1)
		doPlayerRemoveItem(cid, 12256,1)
		setPlayerStorageValue(cid, 42828, 1)		
		doCreatureSay(cid, 'You carve a solid bowl out of the chunk of wood.', TALKTYPE_ORANGE_1)
	end
	local skin = SKINS[itemEx.itemid]
	if(not skin) then
		if (itemEx.itemid == 9009) then
			if (getPlayerStorageValue(cid, 27005) == EMPTY_STORAGE) then
				doPlayerAddItem(cid, 8310, 1)
				doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
				setPlayerStorageValue(cid, 27005, 1)
			else
				doCreatureSay(cid, "You cannot skin the corpse more than once.", TALKTYPE_MONSTER_YELL)
			end
			return true
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end
	end
	 if itemEx.itemid == 9010 then
		if getPlayerStorageValue(cid, 65049) <= 0 then
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
			doPlayerAddItem(cid, 8310, 1)
			setPlayerStorageValue(cid, 65049, 1)
		else
			doCreatureSayWithRadius(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, 1, 1)
		end
		return TRUE
	end

	local random, effect = math.random(1, 100000), CONST_ME_GROUNDSHAKER
	if(random <= skin[1]) then
		doPlayerAddItem(cid, skin[2], 1)
	elseif(skin[3] and random >= skin[3]) then
		doPlayerAddItem(cid, skin[4], 1)
	else
		effect = CONST_ME_POFF
	end

	doSendMagicEffect(toPosition, effect)
	doTransformItem(itemEx.uid, itemEx.itemid + 1)
	return true
end


skinning.lua

Lua:
local SKINS = {
	[5908] = {
		-- Minotaurs
		[2830] = {25000, 5878},
		[2871] = {25000, 5878},
		[2866] = {25000, 5878},
		[2876] = {25000, 5878},
		[3090] = {25000, 5878},

		-- Lizards
		[4259] = {25000, 5876},
		[4262] = {25000, 5876},
		[4256] = {25000, 5876},

		-- Dragons
		[3104] = {25000, 5877},
		[2844] = {25000, 5877},

		-- Dragon Lords
		[2881] = {25000, 5948},

		-- Behemoths
		[2931] = {25000, 5930, 90000, 5893},

		-- Bone Beasts
		[3031] = {25000, 5925}
	},
	[5942] = {
		-- Demon
		[2956] = {25000, 5905},

		-- Vampire
		[2916] = {25000, 5906}
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local skin = SKINS[item.itemid][itemEx.itemid]
	if(skin == nil) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	end

	local random, effect = math.random(1, 100000), CONST_ME_MAGIC_GREEN
	if(random <= skin[1]) then
		doPlayerAddItem(cid, skin[2], 1)
	elseif(skin[3] and random >= skin[3]) then
		doPlayerAddItem(cid, skin[4], 1)
	else
		effect = CONST_ME_POFF
	end

	doSendMagicEffect(toPosition, effect)
	doTransformItem(itemEx.uid, itemEx.itemid + 1)
	return true
end


anyone know why it doesnt work and how to solve it?
 
try it ob knife
Code:
local config = {
	level = 2
}
 
local SKINS = {
	-- Minotaurs
	[2830] = {25000, 5878},
	[2871] = {25000, 5878},
	[2866] = {25000, 5878},
	[2876] = {25000, 5878},
	[3090] = {25000, 5878},
 
	-- Lizards
	[4259] = {25000, 5876},
	[4262] = {25000, 5876},
	[4256] = {25000, 5876},
 
	-- Dragons
	[3104] = {25000, 5877},
	[2844] = {25000, 5877},
 
	-- Dragon Lords
	[2881] = {25000, 5948},
 
	-- Behemoths
	[2931] = {25000, 5893},
 
	-- Bone Beasts
	[3031] = {25000, 5925},
 
	-- Mutated Pumpkin
	[8960] = {25000, 2096, 25000, 2683, 25000, 2688, 25000, 6492, 25000, 6526, 25000, 6570, 25000, 6571, 25000, 6574, 25000, 8860, 25000, 9005, 25000, 9006}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerLevel(cid) < config.level) then
		doPlayerSendCancel(cid, "You have to be at least Level " .. config.level .. " to use this tool.")
		return true
	end
 
	local skin = SKINS[itemEx.itemid]
	if(not skin) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	end
 
	local random, effect = math.random(1, 100000), CONST_ME_GROUNDSHAKER
	if(random <= skin[1]) then
		doPlayerAddItem(cid, skin[2], 1)
	elseif(skin[3] and random >= skin[3]) then
		doPlayerAddItem(cid, skin[4], 1)
	elseif(skin[5] and random >= skin[5]) then
		doPlayerAddItem(cid, skin[6], 50)
	elseif(skin[7] and random >= skin[7]) then
		doPlayerAddItem(cid, skin[8], 1)
	elseif(skin[9] and random >= skin[9]) then
		doPlayerAddItem(cid, skin[10], 1)
	elseif(skin[11] and random >= skin[11]) then
		doPlayerAddItem(cid, skin[12], 1)
	elseif(skin[13] and random >= skin[13]) then
		doPlayerAddItem(cid, skin[14], 1)
	elseif(skin[15] and random >= skin[15]) then
		doPlayerAddItem(cid, skin[16], 1)
	elseif(skin[17] and random >= skin[17]) then
		doPlayerAddItem(cid, skin[18], 1)
	elseif(skin[19] and random >= skin[19]) then
		doPlayerAddItem(cid, skin[20], 20)
	elseif(skin[21] and random >= skin[21]) then
		doPlayerAddItem(cid, skin[22], 1)
	else
		effect = CONST_ME_POFF
	end
 
	local random = math.random(1, 100)
	if(itemEx.itemid == 7441) then
		if(random <= 30) then
			doTransformItem(itemEx.uid, 7442)
		else
			effect = CONST_ME_POFF
			doRemoveItem(itemEx.uid, 1)
		end
	elseif(itemEx.itemid == 7442) then
		if(random <= 20) then
			doTransformItem(itemEx.uid, 7444)
		else
			effect = CONST_ME_POFF
			doRemoveItem(itemEx.uid, 1)
		end
	elseif(itemEx.itemid == 7444) then
		if(random <= 10) then
			doTransformItem(itemEx.uid, 7445)
		else
			effect = CONST_ME_POFF
			doRemoveItem(itemEx.uid, 1)
		end
	elseif(itemEx.itemid == 7445) then
		if(random <= 5) then
			doTransformItem(itemEx.uid, 7446)
		else
			effect = CONST_ME_POFF
			doRemoveItem(itemEx.uid, 1)
		end
	end
 
	doSendMagicEffect(toPosition, effect)
	doTransformItem(itemEx.uid, itemEx.itemid + 1)
	return true
end
 
I think Elf submitted and updated my skinning script some time ago. You should check the latest TFS revs for a file called skinning.lua.
 
Back
Top