sestorme
Member
Here's original Obsidian Knife script:
Here's my edited version:
Code basically works, it does provide items and skill but it does not change the corpse properly. It is changing it into +1 and also it's weight, but sprite remains the same until I leave local area and come back. Then it's all fine. It's also unmovable in the first place.
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}
}
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)
else
effect = CONST_ME_POFF
end
doSendMagicEffect(toPosition, effect)
doTransformItem(itemEx.uid, itemEx.itemid + 1)
return true
end
Here's my edited version:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.itemid == 3073)then
doSendMagicEffect(toPosition,0)
doTransformItem(itemEx.uid, itemEx.itemid + 1)
doDecayItem(itemEx.uid)
doPlayerAddSkillTry(cid, SKILL_AXE, 2)
local mine = getPlayerSkillLevel(cid, 3)
if(mine >= 10)then
doPlayerSay(cid, "Slash!",TALKTYPE_ORANGE_1)
doPlayerAddItem(cid, 11213, 1)
doPlayerAddSkillTry(cid, SKILL_AXE, 2)
elseif(mine >= 10) and (math.random(1, 2) = 1)then
doPlayerSay(cid, "Slash!",TALKTYPE_ORANGE_1)
doPlayerAddItem(cid, 11213, 1)
doPlayerAddItem(cid, 2145, 1)
doPlayerAddSkillTry(cid, SKILL_AXE, 4)
elseif(mine >= 10) and (math.random(1, 3) = 1)then
doPlayerSay(cid, "Slash!",TALKTYPE_ORANGE_1)
doPlayerAddItem(cid, 11213, 1)
doPlayerAddItem(cid, 2145, 1)
doPlayerAddItem(cid, 5878, 1)
doPlayerAddSkillTry(cid, SKILL_AXE, 6)
return true
end
end
return destroyItem(cid, itemEx, toPosition)
end
Code basically works, it does provide items and skill but it does not change the corpse properly. It is changing it into +1 and also it's weight, but sprite remains the same until I leave local area and come back. Then it's all fine. It's also unmovable in the first place.