• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Tfs2.0] Hallowed Axe - Problem Solved!

chricke90

New Member
Joined
Sep 14, 2007
Messages
51
Reaction score
0
Now its only Tree and Npc whichs not working!



Code:
--script on hallowed axe--
function onUse(cid,item,frompos,item2,topos)
number = math.random(1,100)
chance = 95
minItem = 1
maxItem = 3
mind = 300
maxd = 500


if chance > 100 or chance == 0 then
chance = 100
end
-----------------------------------------------------------------------------------------
-- Variables
leftspikedballpos11 = {x=topos.x-3, y=topos.y+2, z=topos.z}
leftspikedballpos12 = {x=topos.x+5, y=topos.y+2, z=topos.z}
leftspikedballpos13 = {x=topos.x-3, y=topos.y-3, z=topos.z}
leftspikedballpos14 = {x=topos.x+5, y=topos.y-3, z=topos.z}
leftspikedballpos21 = {x=topos.x-3, y=topos.y-2, z=topos.z}
leftspikedballpos22 = {x=topos.x-4, y=topos.y-1, z=topos.z}
leftspikedballpos31 = {x=topos.x-3, y=topos.y+3, z=topos.z}
leftspikedballpos32 = {x=topos.x-4, y=topos.y+2, z=topos.z}

birdpos11 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos12 = {x=topos.x+3, y=topos.y+1, z=topos.z}
birdpos13 = {x=topos.x+2, y=topos.y, z=topos.z}
birdpos14 = {x=topos.x+5, y=topos.y, z=topos.z}
birdpos21 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos22 = {x=topos.x+3, y=topos.y+1, z=topos.z}
birdpos31 = {x=topos.x-4, y=topos.y+1, z=topos.z}
birdpos32 = {x=topos.x-4, y=topos.y, z=topos.z}

rightspikedballpos11 = {x=topos.x+2, y=topos.y, z=topos.z}
rightspikedballpos12 = {x=topos.x+2, y=topos.y-2, z=topos.z}
rightspikedballpos13 = {x=topos.x+1, y=topos.y+2, z=topos.z}
rightspikedballpos14 = {x=topos.x+3, y=topos.y+1, z=topos.z}
rightspikedballpos21 = {x=topos.x+2, y=topos.y+2, z=topos.z}
rightspikedballpos22 = {x=topos.x+2, y=topos.y+1, z=topos.z}
rightspikedballpos31 = {x=topos.x-6, y=topos.y+4, z=topos.z}
rightspikedballpos32 = {x=topos.x-6, y=topos.y+1, z=topos.z}

faceoftreepos11 = {x=topos.x-3, y=topos.y-1, z=topos.z}
faceoftreepos12 = {x=topos.x+3, y=topos.y-1, z=topos.z}
faceoftreepos13 = {x=topos.x+2, y=topos.y-2, z=topos.z}
faceoftreepos14 = {x=topos.x-2, y=topos.y-2, z=topos.z}
faceoftreepos21 = {x=topos.x-4, y=topos.y-1, z=topos.z}
faceoftreepos22 = {x=topos.x-3, y=topos.y-3, z=topos.z}
faceoftreepos31 = {x=topos.x-5, y=topos.y+4, z=topos.z}
faceoftreepos32 = {x=topos.x-3, y=topos.y+3, z=topos.z}
-----------------------------------------------------------------------------------------

--------------------Demon oak(The left spiked ball)--------------------
if item2.itemid == 8289 then
leftspikedball = getPlayerStorageValue(cid,20000)
if leftspikedball == -1 or leftspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("bone beast",leftspikedballpos11)
doSummonCreature("bone beast",leftspikedballpos12)
doSummonCreature("bone beast",leftspikedballpos13)
doSummonCreature("bone beast",leftspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos11)
doSummonCreature("lich",leftspikedballpos12)
doSummonCreature("lich",leftspikedballpos13)
doSummonCreature("lich",leftspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos21)
doSummonCreature("giant spider",leftspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos21)
doSummonCreature("dark torturer",leftspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",leftspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos31)
doSummonCreature("dark torturer",leftspikedballpos32)
end
end

else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20000,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end

--------------------Demon oak(The bird)--------------------
if item2.itemid == 8288 then
bird = getPlayerStorageValue(cid,20001)
if bird == -1 or bird == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("banshee",birdpos11)
doSummonCreature("banshee",birdpos12)
doSummonCreature("banshee",birdpos13)
doSummonCreature("banshee",birdpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("braindeath",birdpos11)
doSummonCreature("braindeath",birdpos12)
doSummonCreature("braindeath",birdpos13)
doSummonCreature("braindeath",birdpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",birdpos21)
doSummonCreature("diabolic imp",birdpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("blightwalker",birdpos21)
doSummonCreature("betrayed wraith",birdpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",birdpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",birdpos31)
doSummonCreature("dark torturer",birdpos32)
end
end

else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20001,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end

--------------------Demon oak(The right spiked ball)--------------------
if item2.itemid == 8290 then
rightspikedball = getPlayerStorageValue(cid,20002)
if rightspikedball == -1 or rightspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",rightspikedballpos11)
doSummonCreature("lich",rightspikedballpos12)
doSummonCreature("lich",rightspikedballpos13)
doSummonCreature("lich",rightspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("giant spider",rightspikedballpos11)
doSummonCreature("giant spider",rightspikedballpos12)
doSummonCreature("giant spider",rightspikedballpos13)
doSummonCreature("giant spider",rightspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("dark torturer",rightspikedballpos21)
doSummonCreature("demon",rightspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",rightspikedballpos21)
doSummonCreature("diabolic imp",rightspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",rightspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",rightspikedballpos31)
doSummonCreature("grim reaper",rightspikedballpos32)
end
end

else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20002,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end

--------------------Demon oak(The face of the tree)--------------------
if item2.itemid == 8291 then
faceoftree = getPlayerStorageValue(cid,20003)
if faceoftree == -1 or faceoftree == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("vampire",faceoftreepos11)
doSummonCreature("vampire",faceoftreepos12)
doSummonCreature("vampire",faceoftreepos13)
doSummonCreature("vampire",faceoftreepos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",faceoftreepos11)
doSummonCreature("diabolic imp",faceoftreepos12)
doSummonCreature("diabolic imp",faceoftreepos13)
doSummonCreature("diabolic imp",faceoftreepos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",faceoftreepos21)
doSummonCreature("grim reaper",faceoftreepos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",faceoftreepos21)
doSummonCreature("hand of cursed fate",faceoftreepos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
end
end

else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20003,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end

return 0
end
 
this is teh script of the npc.

Code:
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

        player_gold = getPlayerItemCount(cid,2148)
        player_plat = getPlayerItemCount(cid,2152)*100
        player_crys = getPlayerItemCount(cid,2160)*10000
        player_money = player_gold + player_plat + player_crys
        playerCap = getPlayerFreeCap(cid)
        item = 8293 --Hallowed Axe
        itemweight = getItemWeight(item, 1)
        
        if msgcontains(msg, 'hallowed axe') then
            if isPlayer(cid) then
                if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
                    selfSay('Do you want to buy a Hallowed Axe from me?')
                    talk_state = 1
                else
                    selfSay('You have to bring me an axe and 50000 gp first.')
                    talk_state = 0
                end
            else
                selfSay('You need premium to buy this axe from me.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            talk_state = 0
            if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
                    if doPlayerTakeItem(cid,2386,1) == 0 and doPlayerRemoveMoney(cid,50000) == TRUE then
                        selfSay('Here you are. You can now defeat the demon oak with this axe.')
                        doPlayerAddItem(cid,8293,1)
                        talk_state = 0
                    else
                        selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
                        talk_state = 0
                    end
            else
                selfSay('Please bring with you an axe and enough with money.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'demon oak') then
            if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
                selfSay('Did you defeat the demon oak?')
                talk_state = 2
            else
                selfSay('Go defeat the demon oak.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            talk_state = 0
            if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
                setPlayerStorageValue(cid,20004,1)
                selfSay('Good job!')
            end
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
            selfSay('Ok thanks.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

with the hallowed axe script it will work automtically with the tree and with this npc you will get the hallowed axe and will give you the storage for the prices room
 
Last edited by a moderator:
this is teh script of the npc.

Code:
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

        player_gold = getPlayerItemCount(cid,2148)
        player_plat = getPlayerItemCount(cid,2152)*100
        player_crys = getPlayerItemCount(cid,2160)*10000
        player_money = player_gold + player_plat + player_crys
        playerCap = getPlayerFreeCap(cid)
        item = 8293 --Hallowed Axe
        itemweight = getItemWeight(item, 1)
        
        if msgcontains(msg, 'hallowed axe') then
            if isPlayer(cid) then
                if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
                    selfSay('Do you want to buy a Hallowed Axe from me?')
                    talk_state = 1
                else
                    selfSay('You have to bring me an axe and 50000 gp first.')
                    talk_state = 0
                end
            else
                selfSay('You need premium to buy this axe from me.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            talk_state = 0
            if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
                    if doPlayerTakeItem(cid,2386,1) == 0 and doPlayerRemoveMoney(cid,50000) == TRUE then
                        selfSay('Here you are. You can now defeat the demon oak with this axe.')
                        doPlayerAddItem(cid,8293,1)
                        talk_state = 0
                    else
                        selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
                        talk_state = 0
                    end
            else
                selfSay('Please bring with you an axe and enough with money.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'demon oak') then
            if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
                selfSay('Did you defeat the demon oak?')
                talk_state = 2
            else
                selfSay('Go defeat the demon oak.')
                talk_state = 0
            end
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
            talk_state = 0
            if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
                setPlayerStorageValue(cid,20004,1)
                selfSay('Good job!')
            end
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
            selfSay('Ok thanks.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

with the hallowed axe script it will work automtically with the tree and with this npc you will get the hallowed axe and will give you the storage for the prices room

The Tree isnt include in the script lol?
I mean the DEAD TREE where you need to pass to get in to the room!

DEAD TREE itemid: 2717
 
this is the script that will make the tree disapear:p.

dead tree.lua

Code:
function decayGround(params)
    pos = {x=params.pos.x, y=params.pos.y, z=params.pos.z, stackpos = 0}
    item = getThingfromPos(pos)
	doCreateItem(2717,1,wall1)
end

function onStepIn(cid, item, pos)

    local delaySeconds = 3600

wall1 = {x=xxxx, y=xxxx, z=x, stackpos=1} ----- dead tree position
getwall1 = getThingfromPos(wall1)

if item.uid == 6668 then ----- uniqueid on the sqm that will be the switch
doRemoveItem(getwall1.uid,1)
        params = {pos = pos, getwall1 = item.itemid}
        addEvent(decayGround, delaySeconds*1000, params)
    end
end








note that the tree will reaper an hour later to block the path again like in tibia rl, but you step again on the floor with the uniqueid and it will remove it for another hour:).
 
Last edited:
this is the script that will make the tree disapear:p.

dead tree.lua

Code:
function decayGround(params)
    pos = {x=params.pos.x, y=params.pos.y, z=params.pos.z, stackpos = 0}
    item = getThingfromPos(pos)
	doCreateItem(2717,1,wall1)
end

function onStepIn(cid, item, pos)

    local delaySeconds = 3600

wall1 = {x=xxxx, y=xxxx, z=x, stackpos=1} ----- dead tree position
getwall1 = getThingfromPos(wall1)

if item.uid == 6668 then ----- uniqueid on the sqm that will be the switch
doRemoveItem(getwall1.uid,1)
        params = {pos = pos, getwall1 = item.itemid}
        addEvent(decayGround, delaySeconds*1000, params)
    end
end








note that the tree will reaper an hour later to block the path again like in tibia rl, but you step again on the floor with the uniqueid and it will remove it for another hour:).

Maybe you should add, movements in "MOVEMENTS.XML" or "ACTIONS.XML"???..

<movevent event="StepIn" uniqueid="6668" script="deadtree.lua" /> or What should I wrote in Movements.xml?
 
Last edited:
Maybe you should add, movements in "MOVEMENTS.XML" or "ACTIONS.XML"???..

<movevent event="StepIn" uniqueid="6668" script="deadtree.lua" /> or What should I wrote in Movements.xml?

About this Script here, The Delaying time is not working because you can step there and tree being removed everytime. Thats the only problem then I've fully working.
 
About this Script here, The Delaying time is not working because you can step there and tree being removed everytime. Thats the only problem then I've fully working.

you mean that you want it to make the tree desapear until you have finished the quest?, or you want it that you can only step on it once and that all?

or explain it better.:confused:
 
The Npc does not work for me, It does not reply on 'Hallowed axe' or 'Demon oak' Just when you say 'hi' he replise..

EDIT; Thanks for this awsome script! (But the NPC still does not work :p)
 
Last edited:
Back
Top