oserc
Advanced OT User
Hey boys and girls, how you all doing?
I'm working on a lumberjacking system, which works as follow: when you a lumberjacking axe (new custom item on my server) on a fir tree, you obtain some woods from it. For game aesthetics, when the player right click the axe and then the fir tree, he gets frozen for a few secs, and then he gives 3 hits on the tree, with 3 magic effects running over the fir tree (POFFS). The wood is added to his backpack at the final hit (second event). I'm workin with AddEvents, but I can't get the events to call back the tree position, in order to send the magic effec at the same position.
Anny suggestions to make this work?
BTW, I'm using TFS 1.4.1.
Script below:
I'm working on a lumberjacking system, which works as follow: when you a lumberjacking axe (new custom item on my server) on a fir tree, you obtain some woods from it. For game aesthetics, when the player right click the axe and then the fir tree, he gets frozen for a few secs, and then he gives 3 hits on the tree, with 3 magic effects running over the fir tree (POFFS). The wood is added to his backpack at the final hit (second event). I'm workin with AddEvents, but I can't get the events to call back the tree position, in order to send the magic effec at the same position.
Anny suggestions to make this work?
BTW, I'm using TFS 1.4.1.
Script below:
Lua:
function chop1(player, item, fromPosition, target, toPosition, isHotkey)
for _, player in ipairs(Game.getPlayers()) do
player:say("Chop!", TALKTYPE_MONSTER_SAY)
tree:sendMagicEffect(CONST_ME_POFF)
addEvent(chop2, 2500, tree)
end
return true
end
function chop2(player, item, fromPosition, target, toPosition, isHotkey)
for _, player in ipairs(Game.getPlayers()) do
player:say("Chop!", TALKTYPE_MONSTER_SAY)
tree:sendMagicEffect(CONST_ME_POFF)
player:addItem(5901, 1)
player:sendCancelMessage("You were able to chop some wood.")
player:setMovementBlocked(false)
player:setStorageValue(lumberjacking, 0)
end
return true
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if getTileItemById(toPosition, 2700).uid > 0 then
if player:getStorageValue(lumberjacking) == 0 then
player:setStorageValue(lumberjacking, 1)
player:setMovementBlocked(true)
player:say("Chop!", TALKTYPE_MONSTER_SAY)
local tree = target:getPosition()
tree:sendMagicEffect(CONST_ME_POFF)
addEvent(chop1, 2500, tree)
player:addSkillTries(SKILL_LUMBERJACKING, 1)
else
player:sendCancelMessage("Your hands are already busy.")
end
return true
end
end
Last edited by a moderator: