Fermantor
Active Member
Hello, as I didn't found an obsidian knife script which matched my expectations I made one on my own.
I has the following features:
Here is the script. I tested it on my standard 1.2 TFS server
I has the following features:
Code:
sculpting piece of marble rock
sculpting ice cubes
skinning monsters
skinning fresh corpses only if you are the owner
Here is the script. I tested it on my standard 1.2 TFS server
Lua:
local MINOTAUR_LEATHER = 5878
local LIZARD_LEATHER = 5876
local GREEN_DRAGON_LEATHER = 5877
local RED_DRAGON_LEATHER = 5948
local HARDENED_BONE = 5925
local BEHEMOTH_FANG = 5893
local config = {
[3090] = {chance = 6, product = MINOTAUR_LEATHER, toCorpse = 3091}, -- Minotaur
[5969] = {chance = 6, product = MINOTAUR_LEATHER, toCorpse = 3091, owner = true},
[2866] = {chance = 7, product = MINOTAUR_LEATHER, toCorpse = 2867}, -- Minotaur Mage
[5981] = {chance = 7, product = MINOTAUR_LEATHER, toCorpse = 2867, owner = true},
[2871] = {chance = 6, product = MINOTAUR_LEATHER, toCorpse = 2872}, -- Minotaur Archer
[5982] = {chance = 6, product = MINOTAUR_LEATHER, toCorpse = 2872, owner = true},
[2876] = {chance = 7, product = MINOTAUR_LEATHER, toCorpse = 2877}, -- Minotaur Guard
[5983] = {chance = 7, product = MINOTAUR_LEATHER, toCorpse = 2877, owner = true},
[3104] = {chance = 10, product = GREEN_DRAGON_LEATHER, toCorpse = 3105}, -- Dragon
[5973] = {chance = 10, product = GREEN_DRAGON_LEATHER, toCorpse = 3105, owner = true},
[2881] = {chance = 20, product = RED_DRAGON_LEATHER, toCorpse = 2882}, -- Dragon Lord
[5984] = {chance = 20, product = RED_DRAGON_LEATHER, toCorpse = 2882, owner = true},
[2931] = {chance = 22, product = BEHEMOTH_FANG, toCorpse = 2932}, -- Behemoth
[5999] = {chance = 22, product = BEHEMOTH_FANG, toCorpse = 2932, owner = true},
[4256] = {chance = 14, product = LIZARD_LEATHER, toCorpse = 4257}, -- Lizard Templar
[4251] = {chance = 14, product = LIZARD_LEATHER, toCorpse = 4257, owner = true},
[4259] = {chance = 10, product = LIZARD_LEATHER, toCorpse = 4260}, -- Lizard Sentinel
[6040] = {chance = 10, product = LIZARD_LEATHER, toCorpse = 4260, owner = true},
[4262] = {chance = 20, product = LIZARD_LEATHER, toCorpse = 4263}, -- Lizard Snakecharmer
[6041] = {chance = 20, product = LIZARD_LEATHER, toCorpse = 4263, owner = true},
[3031] = {chance = 10, product = HARDENED_BONE, toCorpse = 3032}, -- Bonebeast
[6030] = {chance = 10, product = HARDENED_BONE, toCorpse = 3032, owner = true}
}
local sculpting =
{
[7441] = {randsize = 31, newid = 7442},
[7442] = {randsize = 19, newid = 7444},
[7444] = {randsize = 10, newid = 7445},
[7445] = {randsize = 7, newid = 7446},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local skinnedObject = target:getId()
if toPosition.x == CONTAINER_POSITION then
toPosition = player:getPosition()
end
-- Sculpting (Piece of Marble Rock)
if skinnedObject == 11343 then
local value = math.random(1,1000)
local playerName = player:getName(cid)
if value <= 625 then -- Broke
target:remove()
player:say("Your attempt at shaping that marble rock failed miserably.", TALKTYPE_MONSTER_SAY)
elseif value <= 890 then -- Rough
target:transform(11344)
target:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This shoddy work was made by " .. playerName .. ".")
elseif value <= 990 then -- Marble
target:transform(11345)
target:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This little figurine made by " .. playerName .. " has some room for improvement.")
elseif value <= 1000 then -- Beautiful
target:transform(11346)
target:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This little figurine of Tibiasula was masterfully sculpted by " .. playerName .. ".")
end
toPosition:sendMagicEffect(CONST_ME_HITAREA)
end
-- Sculpting (Ice Cube)
local iceCube = sculpting[skinnedObject]
if(iceCube) then
if(math.random(1,100) <= iceCube.randsize) then
target:transform(iceCube.newid)
else
target:remove()
player:say("The attempt at sculpting failed miserably.", TALKTYPE_MONSTER_SAY)
end
toPosition:sendMagicEffect(CONST_ME_HITAREA)
return true
end
-- Skinning
local monster = config[skinnedObject]
if(not(monster)) then
return false
else
if monster.owner == true then
local owner = target:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER)
if owner ~= 0 and owner ~= player:getId() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are not the owner.")
return true
end
end
if math.random(1,100) <= monster.chance then
player:addItem(monster.product, 1)
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
else
toPosition:sendMagicEffect(CONST_ME_BLOCKHIT)
end
target:transform(monster.toCorpse)
target:decay()
return true
end
end