redbull915
I learn...
Welcome i created woodcuting system, but it's not like I wanted, for that filed the request for help with writing a very similar system which appears on the movie link below along with the script already written.
Movie: YouTube - Kingdom Age - WoodCuting System!
Movie: YouTube - Kingdom Age - WoodCuting System!
Lua:
local config = {
trees = {2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2712,2717,2718,2720,2722},
skill = "Woodcutting",
addTries = 3023,
branches = 8786,
item = 5901,
amount = 1,
effect = CONST_ME_BLOCKHIT,
msgType = MESSAGE_EVENT_ADVANCE,
sounds = {"Pock", "Pec", "Tck"},
seconds = 5
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(config.trees, itemEx.itemid) then
local itemid, timeSound = itemEx.itemid, 1.1
for i = 1, 10 do
addEvent(function()
doSendAnimatedText(toPosition, config.sounds[math.random(1, table.maxn(config.sounds))], COLOR_LIGHTGREEN)
end, (i*timeSound) * 1000, {toPosition = toPosition})
chance = math.random(100)
end
if chance <= 80 then
doPlayerSendTextMessage(cid, config.msgType, "Not found.")
return true
elseif chance > 80 then
doRemoveItem(getThingFromPos(toPosition).uid)
doSendMagicEffect(toPosition, CONST_ME_HITAREA or config.effect)
doCreateItem(config.branches, 1, toPosition)
addCustomSkillTry(cid, config.skill, config.addTries)
doPlayerAddItem(cid, config.item, config.amount)
addEvent(function()
doRemoveItem(getThingFromPos(toPosition).uid)
doSendMagicEffect(toPosition, 45)
doCreateItem(2769, 1, toPosition)
addEvent(function()
doRemoveItem(getThingFromPos(toPosition).uid)
doSendMagicEffect(toPosition, 45)
doCreateItem(2768, 1, toPosition)
addEvent(function()
doRemoveItem(getThingFromPos(toPosition).uid)
doSendMagicEffect(toPosition, 45)
doCreateItem(itemid, 1, toPosition)
end, config.seconds * 1000, {itemid = itemid, toPosition = toPosition})
end, config.seconds * 1000, {itemid = itemid, toPosition = toPosition})
end, config.seconds * 1000, {itemid = itemid, toPosition = toPosition})
end
else
doPlayerSendTextMessage(cid, config.msgType, "Either this tree can't be choped.")
end
return true
end