• 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.0 demon oak error

frock1337

New Member
Joined
Aug 31, 2014
Messages
35
Reaction score
0
upload_2014-9-3_23-53-3.png

Im getting these 2 errors
Error 1: Im getting this error when im using the hallowed axe on the tree to enter demon oak.
Error 2: Im getting this error when im using the hallowed axe on any part of the demon oak.

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 = 360, y = 411, z = 7},
toPosition = {x = 379, y = 423, z = 7}
},
summonPositions = {
{x = 368, y = 414, z = 7},
{x = 366, y = 415, z = 7},
{x = 365, y = 417, z = 7},
{x = 367, y = 420, z = 7},
{x = 370, y = 420, z = 7},
{x = 373, y = 420, z = 7},
{x = 375, y = 417, z = 7},
{x = 373, y = 414, z = 7}
},
summons = {
[8288] = {
[5] = {'Braindeath', 'Braindeath', 'Braindeath', 'Bonebeast'},
[10] = {'Betrayed Wraith', 'Betrayed Wraith'}
},
[8289] = {
[5] = {'Lich', 'Lich', 'Lich'},
[10] = {'Dark Torturer', 'Blightwalker'}
},
[8290] = {
[5] = {'Banshee', 'Banshee', 'Banshee'},
[10] = {'Grim Reaper'}
},
[8291] = {
[5] = {'Giant Spider', 'Giant Spider', 'Lich'},
[10] = {'Undead Dragon', 'Hand of Cursed Fate'}
}
}
}

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.demonOakIds, itemEx.itemid) then
return true
end

local player = Player(cid)

local totalProgress = 0
for i = 1, #config.demonOakIds do
totalProgress = totalProgress + math.max(0, player:getStorageValue(config.demonOakIds))
end

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

if isDefeated then
player:teleportTo(372, 402, 7)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Tell Oldrak about your great victory against the demon oak.')
player:setStorageValue(1010, 1)
player:setStorageValue(1013, 3)
return true
end

local progress = math.max(player:getStorageValue(itemEx.itemid), 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[itemEx.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], 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(itemEx.itemid, progress + 1)
player:say('-krrrrak-', TALKTYPE_MONSTER_YELL, false, player, toPosition)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -170, -210, CONST_ME_BIGPLANTS)
return true
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(Storage.DemonOak.Done) == 2 then
player:teleportTo(DEMON_OAK_REWARDROOM_POSITION)
DEMON_OAK_REWARDROOM_POSITION:sendMagicEffect(CONST_ME_TELEPORT)
return true
end
end
 
Part 2
function onStepIn(cid, item, position, fromPosition)
if Player(cid) and math.random(24) == 1 then
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
return true
end

function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
if not player then
return true
end

if player:getStorageValue(1010) >= 1 then
player:teleportTo(372, 402, 7)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end

if player:getLevel() < 120 then
player:say("LEAVE LITTLE FISH, YOU ARE NOT WORTH IT!", TALKTYPE_MONSTER_YELL, false, cid, DEMON_OAK_POSITION)
player:teleportTo(372, 402, 7)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end

if player:getStorageValue(1014) == 5 and not isPlayerInArea({x = 361, y = 410, z = 7, stackpos = 255}, {x = 379, y = 423, z = 7, stackpos = 255}) then
player:teleportTo(370, 413, 7)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:setStorageValue(1013, 1)
player:say("I AWAITED YOU! COME HERE AND GET YOUR REWARD!", TALKTYPE_MONSTER_YELL, false, cid, DEMON_OAK_POSITION)
else
player:teleportTo(372, 402, 7)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
return true
end

local voices = {
'Release me and you will be rewarded greatefully!',
'What is this? Demon Legs lying here? Someone might have lost them!',
'I\'m trapped, come here and free me fast!!',
'I can bring your beloved back from the dead, just release me!',
'What a nice shiny golden armor. Come to me and you can have it!',
'Find a way in here and release me! Pleeeease hurry!',
'You can have my demon set, if you help me get out of here!'
}

local startUid = 9000
function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
if not player then
return true
end

local status = math.max(player:getStorageValue(Storage.DemonOak.Squares), 0)
if item.uid - startUid == status + 1 then
player:setStorageValue(Storage.DemonOak.Squares, status + 1)
player:say(voices[math.random(#voices)], TALKTYPE_MONSTER_YELL, false, cid, DEMON_OAK_POSITION)
end
return true
end

DEMON_OAK_POSITION = Position(370, 418, 7)
DEMON_OAK_KICK_POSITION = Position(372, 402, 7)
DEMON_OAK_ENTER_POSITION = Position(370, 413, 7)
DEMON_OAK_REWARDROOM_POSITION = Position(372, 400, 8)

I think that was all :p (btw the reward chests do work fine but haven't tested the gravestone because I can't complete the demon oak)
And I do have the right movement & actions libs
 
Is DEMON_OAK_POSITION defined somewhere? If not, define it as a position or change DEMON_OAK_POSITION to a position.
 
Entrance error
Code:
player:teleportTo(372, 402, 7)
Change it to a position, so Position(370, 402, 7) or {x = 372, y = 402, z = 7}.
 
Np, don't change the name of the function, only the parameter.
player:teleportTo(change it here)

Btw, I can't reproduce the error on line 109. I've tested it by changing DEMON_OAK_POSITION to a position and it works fine for me.
 
Np, don't change the name of the function, only the parameter.
player:teleportTo(change it here)

Btw, I can't reproduce the error on line 109. I've tested it by changing DEMON_OAK_POSITION to a position and it works fine for me.

Hmm im not getting any entrance error now but when I walk on tile (370, 410, 7) im getting teleported to (372, 402, 7)
 
If you added that position, it will teleport the player to that position, if it should teleport the player to a different position, change the position.
 
Back
Top