elnelson
Lunaria World Dev
Hello, otlanders. I rework this script to make it more RPGish but i found a strange error when someone tries to skin something that is not in the table i made.Tried to patch it with some conditions but seems i failed tho.
The console spams an error (see attached image):
Here is the script
The console spams an error (see attached image):
Here is the script
LUA:
local MINOTAUR_LEATHER, LIZARD_LEATHER, GREEN_DRAGON_LEATHER, RED_DRAGON_LEATHER, HARDENED_BONE, BEHEMOTH_FANG = 5878, 5876, 5877, 5948, 5925, 5893
local config = {
[3086] = {25, 5897, skill = 10}, --wolfpaw
[2969] = {25, 5897, skill = 25}, --wolfpaw
[3109] = {25, 5896, skill = 25}, --bearpaw
[2935] = {25, 10610, skill = 0}, --pig foot
[4265] = {25, 5890, skill = 0}, --chicken feather
[3090] = {25, MINOTAUR_LEATHER, skill = 20},
[2871] = {25, MINOTAUR_LEATHER, skill = 30},
[2866] = {25, MINOTAUR_LEATHER, skill = 40},
[2876] = {25, MINOTAUR_LEATHER, skill = 50},
[4298] = {25, 5894, skill = 10}, --batwing
[3104] = {25, GREEN_DRAGON_LEATHER, skill = 100},
[2881] = {25, RED_DRAGON_LEATHER, skill = 250},
[2931] = {25, BEHEMOTH_FANG, skill = 300},
[4256] = {25, LIZARD_LEATHER, skill = 50},
[4259] = {25, LIZARD_LEATHER, skill = 50},
[4262] = {25, LIZARD_LEATHER, skill = 50},
[11285] = {25, LIZARD_LEATHER, skill = 50},
[11277] = {25, LIZARD_LEATHER, skill = 50},
[11269] = {25, LIZARD_LEATHER, skill = 50},
[11273] = {25, LIZARD_LEATHER, skill = 50},
[11281] = {25, LIZARD_LEATHER, skill = 50},
[6303] = {25, 2231, skill = 100},
[3031] = {25, HARDENED_BONE, skill = 150},
[2817] = {25, 10611, skill = 0}, --snakeskin
[3067] = {25, 10606, skill = 5}, --troll hair
[2897] = {25, 10568, skill = 0} --troll hair
}
local pumpkin_items = {
[1] = {2683},
[2] = {2688, 50},
[3] = {6571},
[4] = {6492},
[5] = {6574},
[6] = {6526},
[7] = {2096},
[8] = {9005, 20}
}
local sculpting = {
[7441] = {randsize = 4, newid = 7442},
[7442] = {randsize = 5, newid = 7444},
[7444] = {randsize = 6, newid = 7445},
[7445] = {randsize = 7, newid = 7446},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 8961 then
if getPlayerStorageValue(cid, 81279) <= 0 then
doCreatureSay(cid, "Happy Halloween!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), math.random(28,30))
setPlayerStorageValue(cid, 81279, 1)
local v = pumpkin_items[math.random(#pumpkin_items)]
doPlayerAddItem(cid, v[1], v[2] or 1)
else
doCreatureSay(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, false, cid)
end
return true
end
-- Sculpting
local v = sculpting[itemEx.itemid]
if v then
if(math.random(v.randsize) == 1) then
doTransformItem(itemEx.uid, v.newid)
else
doRemoveItem(itemEx.uid)
doCreatureSay(cid, "The attempt at sculpting failed miserably.", TALKTYPE_ORANGE_1)
end
doSendMagicEffect(toPosition, CONST_ME_HITAREA)
return true
end
-- summons
local professionSkill = getPlayerStorageValue(cid, 1035)
if itemEx.actionid == 91347 then
return doPlayerSendCancel(cid, "You cant skin a summon corpse.")
end
local skin = config[itemEx.itemid]
if not(isInArray({2897, 3067, 2806,3086, 2969, 3109, 2935, 4265, 3090, 2871, 2866, 2786, 4298, 3104, 2881, 2931, 4256,4259,4262,11285,11277,11269,11273,11281,6303,3031,2817}, itemEx.itemid)) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doCreatureSay(cid, "You cant skin this!", TALKTYPE_ORANGE_1)
return false
end
local reqskill = config[itemEx.itemid].skill
if isInArray({3067}, itemEx.itemid) and professionSkill >= reqskill then
local chance = (math.random (1,math.ceil(professionSkill/200)))
doPlayerAddItem(cid, 10606, chance)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
doTransformItem(itemEx.uid, 2806)
end
if professionSkill < reqskill and isInArray({2897, 3067, 3086, 2969, 3109, 2935, 4265, 3090, 2871, 2866, 2786, 4298, 3104, 2881, 2931, 4256,4259,4262,11285,11277,11269,11273,11281,6303,3031,2817}, itemEx.itemid) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doCreatureSay(cid, "You have to be at least skill ".. config[itemEx.itemid].skill .." in tanning to do that!", TALKTYPE_ORANGE_1)
return false
end
-- Skinning
v = config[itemEx.itemid]
if not v then
return false
elseif math.random(100) <= v[1]+professionSkill/20 then
local chance = (math.random (1,math.ceil(professionSkill/200)))
doPlayerAddItem(cid, v[2], chance)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
end
if math.random(1, professionSkill*1.15) >= professionSkill then
if professionSkill < 500 then
setPlayerStorageValue(cid, 1035, professionSkill + 1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in tanning ["..professionSkill.."].")
end
end
if not isInArray({3067}, itemEx.itemid) then
doTransformItem(itemEx.uid, itemEx.itemid + 1)
doDecayItem(itemEx.uid)
end
return true
end
Attachments
-
obk_spam.png6.5 KB · Views: 13 · VirusTotal