• 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!

TFS 1.X+ Demon oak left branch doesn't work

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
TFS 1.3
Hello guys, i got the scripts and codes from otx and is working good, except for one branch, left branch
fdcfab8d1bc39975bb199d86ddb07055.png


that branch is id 8289, i have done everything in my power to try to fix this but i cant find the reason why, all others work :/

im going to post the the axe, if some file is needed i will post it, but i think those two are related to this:
plz guys help :C


axe:
Code:
local config = {
    demonOakIds = {8288, 8289, 8290, 8291},
    sounds = {
        'MY ROOTS ARE SHARP AS A SCYTHE! FEEL IT?!?',
        'CURSE YOU!',
        'RISE, MINIONS, RISE FROM THE DEAD!!!!',
        'AHHHH! YOUR BLOOD MAKES ME STRONG!',
        'GET THE BONES, HELLHOUND! GET THEM!!',
        'GET THERE WHERE I CAN REACH YOU!!!',
        'ETERNAL PAIN AWAITS YOU! NICE REWARD, HUH?!?!',
        'YOU ARE GOING TO PAY FOR EACH HIT WITH DECADES OF TORTURE!!',
        'ARGG! TORTURE IT!! KILL IT SLOWLY MY MINION!!'
    },
    bonebeastChance = 90,
    bonebeastCount = 4,
    waves = 10,
    questArea = {
        fromPosition = {x = 843, y = 1113, z = 7},
        toPosition = {x = 862, y = 1125, z = 7}
    },
    summonPositions = {
        {x = 851, y = 1116, z = 7},
        {x = 849, y = 1117, z = 7},
        {x = 848, y = 1119, z = 7},
        {x = 850, y = 1122, z = 7},
        {x = 853, y = 1122, z = 7},
        {x = 856, y = 1122, z = 7},
        {x = 858, y = 1119, z = 7},
        {x = 856, y = 1116, z = 7}
    },
    summons = {
        [8288] = {
            [5] = {'Spectre', 'Blightwalker', 'Braindeath', 'Demon'},
            [10] = {'Betrayed Wraith', 'Betrayed Wraith'}
        },
        [8289] = {
            [5] = {'Plaguesmith', 'Plaguesmith', 'Blightwalker'},
            [10] = {'Dark Torturer', 'Blightwalker'}
        },
        [8290] = {
            [5] = {'Banshee', 'Plaguesmith', 'Hellhound'},
            [10] = {'Grim Reaper'}
        },
        [8291] = {
            [5] = {'Plaguesmith', 'Hellhound', 'Hellhound'},
            [10] = {'Undead Dragon', 'Hand of Cursed Fate'}
        }
    },
    storages = {
        [8288] = Storage.DemonOak.AxeBlowsBird,
        [8289] = Storage.DemonOak.AxeBlowsLeft,
        [8290] = Storage.DemonOak.AxeBlowsRight,
        [8291] = Storage.DemonOak.AxeBlowsFace
    }
}

local function getRandomSummonPosition()
    return config.summonPositions[math.random(#config.summonPositions)]
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not isInArray(config.demonOakIds, target.itemid) then
        return true
    end

    local totalProgress = 0
    for k,v in pairs(config.storages) do
        totalProgress = totalProgress + math.max(0, player:getStorageValue(v))
    end

    local spectators, hasMonsters = Game.getSpectators(DEMON_OAK_POSITION, false, false, 9, 9, 6, 6), false
    for i = 1, #spectators do
        if spectators[i]:isMonster() then
            hasMonsters = true
            break
        end
    end

    local isDefeated = totalProgress == (#config.demonOakIds * (config.waves + 1))
    if (config.killAllBeforeCut or isDefeated)
            and hasMonsters then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You need to kill all monsters first.')
        return true
    end

    if isDefeated then
        player:teleportTo(DEMON_OAK_KICK_POSITION)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Tell Oldrak about your great victory against the demon oak.')
        player:setStorageValue(Storage.DemonOak.Done, 1)
        player:setStorageValue(Storage.DemonOak.Progress, 3)
        return true
    end

    local cStorage = config.storages[target.itemid]
    local progress = math.max(player:getStorageValue(cStorage), 1)
    if progress >= config.waves + 1 then
        toPosition:sendMagicEffect(CONST_ME_POFF)
        return true
    end

    local isLastCut = totalProgress == (#config.demonOakIds * (config.waves + 1) - 1)
    local summons = config.summons[target.itemid]
    if summons and summons[progress] then
        -- Summon a single demon on the last hit
        if isLastCut then
            Game.createMonster('Demon', getRandomSummonPosition(), false, true)

        -- Summon normal monsters otherwise
        else
            for i = 1, #summons[progress] do
                Game.createMonster(summons[progress][i], getRandomSummonPosition(), false, true)
            end
        end

    -- if it is not the 5th or 10th there is only a chance to summon bonebeasts
    elseif math.random(100) >= config.bonebeastChance then
        for i = 1, config.bonebeastCount do
            Game.createMonster('Bonebeast', getRandomSummonPosition(), false, true)
        end
    end

    player:say(isLastCut and 'HOW IS THAT POSSIBLE?!? MY MASTER WILL CRUSH YOU!! AHRRGGG!' or config.sounds[math.random(#config.sounds)], TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_POSITION)
    toPosition:sendMagicEffect(CONST_ME_DRAWBLOOD)
    player:setStorageValue(cStorage, progress + 1)
    player:say('-krrrrak-', TALKTYPE_MONSTER_YELL, false, player, toPosition)
    doTargetCombatHealth(0, player, COMBAT_EARTHDAMAGE, -170, -210, CONST_ME_BIGPLANTS)
    return true
end
 
If you're not getting an error, ensure the id 8289 is present in actions.xml
If you are getting an error, post it
all i have is this

Code:
<!-- Demon Oak -->
    <action itemid="8293" script="quests/demon oak/demonOak.lua" />
    <action fromuid="9008" touid="9011" script="quests/demon oak/demonOakChest.lua" />
    <action uniqueid="9007" script="quests/demon oak/demonOakGravestone.lua" />

and no errors in console :S
 
all i have is this

Code:
<!-- Demon Oak -->
    <action itemid="8293" script="quests/demon oak/demonOak.lua" />
    <action fromuid="9008" touid="9011" script="quests/demon oak/demonOakChest.lua" />
    <action uniqueid="9007" script="quests/demon oak/demonOakGravestone.lua" />

and no errors in console :S

do you get any message ingame when you try to use it?
 
none at all, just nothing happens, not even "you cant use this item" or any of those type of messages :/
Screen capture - ed4702e957a614bc8d5b74d71b853eb4 - Gyazo
That is certainly weird. If you aren't even getting a cancel message, that means the script is running and returning true.
I have a copy of OTX on my PC and I've tested it and it works, and apart from the positions, everything else in the scripts are identical. Go into your database and check the storages for your character that you're testing on. Look for storages 8288, 8289, 8290 and 8291 and see what their values are.
 
That is certainly weird. If you aren't even getting a cancel message, that means the script is running and returning true.
I have a copy of OTX on my PC and I've tested it and it works, and apart from the positions, everything else in the scripts are identical. Go into your database and check the storages for your character that you're testing on. Look for storages 8288, 8289, 8290 and 8291 and see what their values are.
SELECT *
FROM `player_storage`
WHERE `key` =8289
LIMIT 0 , 30

no results :S
 
well that's certainly interesting
do you have a storages file somewhere? in OTX it's data/lib/miscellaneous/051-storages.lua
currently the script is trying to pull those values
in addition it's also trying to pull things like DEMON_OAK_POSITION out of data/lib/miscellaneous/demonOakQuest.lua
if those don't exist, or those global variables don't exist anywhere else, that's probably related to the issue you're having
 
well that's certainly interesting
do you have a storages file somewhere? in OTX it's data/lib/miscellaneous/051-storages.lua
currently the script is trying to pull those values
in addition it's also trying to pull things like DEMON_OAK_POSITION out of data/lib/miscellaneous/demonOakQuest.lua
if those don't exist, or those global variables don't exist anywhere else, that's probably related to the issue you're having
i do have those libs, check demonOakQuest lib:

Code:
DEMON_OAK_POSITION = Position(853, 1119, 7)
DEMON_OAK_KICK_POSITION = Position(853, 1108, 7)
DEMON_OAK_ENTER_POSITION = Position(853, 1115, 7)
DEMON_OAK_REWARDROOM_POSITION = Position(854, 1173, 8)

and 051-storages:

Code:
DemonOak = {
        Done = 1010,
        Progress = 1013,
        Squares = 1014,

        AxeBlowsBird = 8288,
        AxeBlowsLeft = 8289,
        AxeBlowsRight = 8290,
        AxeBlowsFace = 8291
    },
 
i do have those libs, check demonOakQuest lib:

Code:
DEMON_OAK_POSITION = Position(853, 1119, 7)
DEMON_OAK_KICK_POSITION = Position(853, 1108, 7)
DEMON_OAK_ENTER_POSITION = Position(853, 1115, 7)
DEMON_OAK_REWARDROOM_POSITION = Position(854, 1173, 8)

and 051-storages:

Code:
DemonOak = {
        Done = 1010,
        Progress = 1013,
        Squares = 1014,

        AxeBlowsBird = 8288,
        AxeBlowsLeft = 8289,
        AxeBlowsRight = 8290,
        AxeBlowsFace = 8291
    },
player:setStorageValue(cStorage, progress + 1)
this line should set the storages whenever you use the axe
the fact you're not having your storages set is very odd
Is the demon oak yelling things when you hit the other 3 parts of the tree?
 
not sure but did u try do the demon oak on a player cuz i had the same problem back in the days on my server with that demon oak.
remember i had to fix someting in data/lib/miscellaneous/DemonOakQuest.lua
 
player:setStorageValue(cStorage, progress + 1)
this line should set the storages whenever you use the axe
the fact you're not having your storages set is very odd
Is the demon oak yelling things when you hit the other 3 parts of the tree?

yeah it yells, i walked to the area and heard the yelling, then i was able to enter the area, just like original demon oak

not sure but did u try do the demon oak on a player cuz i had the same problem back in the days on my server with that demon oak.
remember i had to fix someting in data/lib/miscellaneous/DemonOakQuest.lua
yeah i tried :(


altho now a player tried and he doesnt hear the yelling, maybe its because the quest its unfinish by me?










OK I FIGURED IT OUT!!!!!
i had more than one of those trees in the map, so out of curiosity, i went to the other one and tried to use the axe of it's left branch and it worked xD started spawning monsters in the real demonoak area and i was very far using the axe in the other brach, i guess all of this happened because it was duplicated, althoo, the whole tree was duplicated, and only this branch presented troubles
 
Last edited:
Well that's certainly a weird one
Even with multiple on the map, everything is based on itemid. Seems unlikely that it would cause issues but if the other one worked, I can only wonder what was going on.
There's not some sort of small stone or something on top of the left branch is there? xD
 
I agree with @RazorBlade that has nothing to do with have multiple oak trees on the map. Since we are not checking actionid or uniqueids. You should do:
Code:
print(target.itemid)
and check if there is something that blocking the branch from the script to execute.
 
Back
Top