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

Action Working Demon Oak Quest

no just the parts with the positions of my map..here is my lib

Code:
oneByQuest = true
killAllBeforeCut = true
level = 120
positions =
{
    kick = {x = 788, y = 1500, z = 7},
    summon =
    {
        {x = 768, y = 1486, z = 7},
        {x = 769, y = 1490, z = 7},
        {x = 772, y = 1493, z = 7},
        {x = 777, y = 1493, z = 7},
        {x = 779, y = 1492, z = 7},
        {x = 778, y = 1488, z = 7},
        {x = 778, y = 1485, z = 7},
        {x = 774, y = 1485, z = 7}
    },
    rewardRoom = {x = 865, y = 1560, z = 8}
}

summons =
{
    [1] = {"Demon", "Grim Reaper", "Elder Beholder", "Demon Skeleton"},
    [2] = {"Dark Torturer", "Banshee", "Betrayed Wraith", "Blightwalker"},
    [3] = {"Bonebeast", "Fire Spectre", "Diabolic Imp", "Giant Spider"},
    [4] = {"Hand of Cursed Fate", "Lich", "Undead Dragon", "Vampire"},
    [5] = {"braindeath", "Demon", "Bonebeast", "Diabolic Imp"},
    [6] = {"Demon Skeleton", "Banshee", "Elder Beholder", "Bonebeast"},
    [7] = {"Dark Torturer", "Undead Dragon", "Demon", "Demon"},
    [8] = {"Elder Beholder", "Betrayed Wraith", "Demon Skeleton", "Giant Spider"},
    [9] = {"Demon", "Banshee", "Blightwalker", "Demon Skeleton"},
    [10] = {"Grim Reaper", "Demon", "Diabolic Imp", "Fire Spectre"},
    [11] = {"Banshee", "Grim Reaper", "Hand of Cursed Fate", "Demon"}
}

areaPosition =
{
    {x = 763, y = 1484, z = 7, stackpos = 255},
    {x = 784, y = 1497, z = 7, stackpos = 255}
}

demonOak = {8288, 8289, 8290, 8291}

storages =
{
    done = 35701,
    treeCut = 35702
}

blockingTree =
{
    [2709] = {32193, 3614}
}

floorDamage =
{
    min = 270,
    max = 310,
    type = COMBAT_EARTHDAMAGE,
    effect = CONST_ME_BIGPLANTS
}

rewards =
{
    [12901] = {done = 12900, reward = 2495, count = 1},
    [12902] = {done = 12900, reward = 2539, count = 1},
    [12903] = {done = 12900, reward = 8918, count = 1},
    [12904] = {done = 12900, reward = 8851, count = 1}
}

HALLOWEDAXE_PRICE = 1000

ERROR_NOERROR = 0
ERROR_TREEPOSITION = 1
ERROR_NOTENOUGHLEVEL = 2
ERROR_ALREADYDONE = 3
ERROR_ALREADYCUT = 4
ERROR_WAITFOR = 5
ERROR_UNKNOWN = 6

TYPE_PLAYER = 1
TYPE_MONSTER = 2
TYPE_NPC = 3
TYPE_CREATURE = 4
GET_COUNT = 1
GET_UID = 2

function canEnter(cid, tree)

    if isInRange(tree, areaPosition[1], areaPosition[2]) then
        return ERROR_TREEPOSITION
    elseif getPlayerLevel(cid) < level then
        return ERROR_NOTENOUGHLEVEL
    elseif getCreatureStorage(cid, storages.done) > 0 then
        return ERROR_ALREADYDONE
    elseif getCreatureStorage(cid, storages.treeCut) > 0 then
        return ERROR_ALREADYCUT
    elseif oneByQuest then
        local players = getPlayersOnline()
        for _, pid in ipairs(players) do
            if isInRange(getCreaturePosition(pid), areaPosition[1], areaPosition[2]) then
                return ERROR_WAITFOR
            end
        end
    else
        return ERROR_UNKNOWN
    end
    return ERROR_NOERROR
end


function getError(err, tree)
    if err == ERROR_TREEPOSITION then
        return print("[Warning - Action::Demon Oak Script] Dead tree position is inside the quest area positions.\nDead tree position: (x: " .. tree.x .. ", y: " .. tree.y .. ", z: " .. tree.z .. ")\nNorth-West area position (x: " .. areaPosition[1].x .. ", y: " .. areaPosition[1].y .. ", z: " .. areaPosition[1].z .. ")\nSouth-West area position (x: " .. areaPosition[2].x .. ", y: " .. areaPosition[2].y .. ", z: " .. areaPosition[2].z .. ")\nScript will not work correctly, please fix it.") and "Something is wrong, please contact a staff member."
    elseif err == ERROR_NOTENOUGHLEVEL then
        return "You need level " .. level .. " or higher to enter to the quest area."
    elseif err == ERROR_ALREADYDONE then
        return "You already done this quest."
    elseif err == ERROR_ALREADYCUT then
        return "You can not leave the quest area by here."
    elseif err == ERROR_WAITFOR then
        return "Wait until the player inside the quest area finish the quest."
    end
    return ""
end

function getCreaturesInRange(type, fromPos, toPos, get, countSummon)

    local types =
    {
        [TYPE_PLAYER] = isPlayer,
        [TYPE_MONSTER] = isMonster,
        [TYPE_NPC] = isNpc,
        [TYPE_CREATURE] = isCreature
    }
    local tmp = {}

    local t = types[type]
    if(not t) then return print("[Warning - Function::getCreaturesInRange] Unknow type " .. (type or "(nil value)")) end

    local thing
    local pos
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                    if countSummon then
                        if isSummon(thing.uid) then
                            table.insert(tmp, thing.uid)
                        end
                    else
                        if not isSummon(thing.uid) then
                            table.insert(tmp, thing.uid)
                        end
                    end
                end
            end
        end
    end
    if(get == GET_COUNT) then
        return table.maxn(tmp)
    elseif(get == GET_UID) then
        return tmp
    else
        print("[Warning - Function::getCreaturesInRange] Unknow type to get " .. (get or "(nil value)"))
    end
end

function monsterExists(name)

    local file = "data/monster/monsters.xml"
    local m_name, getName, getFile, m_file = 0, 0, 0, 0
    local monsterExists, fileExists = false, false
    if io.open(file, "r") ~= nil then
        for line in io.lines(file) do
            if line:find('name=".*".*') and line:find('file=".*".*') then
                getName = string.match(line, 'name=".*".*')
                getFile = string.match(line, 'file=".*".*')
                m_name = string.sub(getName, string.find(getName, '="') + 2, string.find(getName, '" ') - 1)
                m_file = string.sub(getFile, string.find(getFile, '="') + 2, string.find(getFile, '"/') - 1)
                if m_name == name then
                    monsterExists = true
                    if io.open("data/monster/" .. m_file, "r") ~= nil then
                        fileExists = true
                    end
                end
            end
        end
    end
    return monsterExists and fileExists or false
end

function isSummon(cid)
    return getCreatureMaster(cid) ~= cid or false
end
 
this
Lua:
areaPosition =
{
    {x = 763, y = 1484, z = 7, stackpos = 255},
    {x = 784, y = 1497, z = 7, stackpos = 255}
}

Replace it with
Lua:
questAreaPosition =
{
    {x = 763, y = 1484, z = 7, stackpos = 255},
    {x = 784, y = 1497, z = 7, stackpos = 255}
}
 
Code:
26/12/2012 01:34:08] Error: [MoveEvent::configureMoveEvent] No event found.
[26/12/2012 01:34:08] Warning: [BaseEvents::loadFromXml] Can not configure event
[26/12/2012 01:34:08] Error: [MoveEvent::configureMoveEvent] No event found.
[26/12/2012 01:34:08] Warning: [BaseEvents::loadFromXml] Can not configure event
[26/12/2012 01:34:08] Error: [MoveEvent::configureMoveEvent] No event found.
[26/12/2012 01:34:08] Warning: [BaseEvents::loadFromXml] Can not configure event
[26/12/2012 01:34:08] [Error - CreatureEvent::configureEvent] No valid type for creature event.attack
[26/12/2012 01:34:08] Warning: [BaseEvents::loadFromXml] Can not configure event

Anyone knows the error? i use mystic 9.6
 
Last edited:
Nice coding :) but its sad that its not working as rl tibia.
 
@Darkhaos i got some problems.. I have to use the hallowed axe on the same spot like 40 times until its done. Can i change that somewhere?
 
I actually created one that works as rl tibia, but just for sales.

But you released this one, which is almost 100%, why not release the one which is on sale :p?
 
Lua:
summons =
{
	[1] = {"demon", "grim reaper", "elder beholder", "demon skeleton"},
	[2] = {"dark torturer", "banshee", "betrayed wraith", "blightwalker"},
	[3] = {"bonebeast", "braindeath", "diabolic imp", "giant spider"},
	[4] = {"hand of cursed fate", "lich", "undead dragon", "vampire"},
	[5] = {"braindeath", "demon", "bonebeast", "diabolic imp"},
	[6] = {"demon skeleton", "banshee", "elder beholder", "bonebeast"},
	[7] = {"dark torturer", "undead dragon", "demon", "demon"},
	[8] = {"elder beholder", "betrayed wraith", "demon skeleton", "giant spider"},
	[9] = {"demon", "banshee", "blightwalker", "demon skeleton"},
	[10] = {"grim reaper", "demon", "diabolic imp", "braindeath"},
	[11] = {"banshee", "grim reaper", "hand of cursed fate", "demon"} --LAST WAVE, EDIT MONSTERS HERE
}
 
Well, i tried to skip the wave thing and make it as rl but failed :/ Cmon Darkhaos :(
 
Lua:
summons =
{
	[1] = {"demon", "grim reaper", "elder beholder", "demon skeleton"},
	[2] = {"dark torturer", "banshee", "betrayed wraith", "blightwalker"},
	[3] = {"bonebeast", "braindeath", "diabolic imp", "giant spider"},
	[4] = {"hand of cursed fate", "lich", "undead dragon", "vampire"},
	[5] = {"braindeath", "demon", "bonebeast", "diabolic imp"},
	[6] = {"demon skeleton", "banshee", "elder beholder", "bonebeast"},
	[7] = {"dark torturer", "undead dragon", "demon", "demon"},
	[8] = {"elder beholder", "betrayed wraith", "demon skeleton", "giant spider"},
	[9] = {"demon", "banshee", "blightwalker", "demon skeleton"},
	[10] = {"grim reaper", "demon", "diabolic imp", "braindeath"},
	[11] = {"banshee", "grim reaper", "hand of cursed fate", "demon"} --LAST WAVE, EDIT MONSTERS HERE
}

Well i changed my mind.. I wan't to have random waves on all the parts on the Demon Oak, not just the exact same waves going over and over again..
do you copy?
 
Works 50%..

I kill demon oak, i can obtain the reward, but when I go "demon oak" is always dead
Any player can enter, and only break a one first to finish the quest..

The demon oak is not regenerated after quest.

Console no show any errors.

--updated--
FIXED :D
 
Last edited:
Back
Top