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

Demon Oak Bug with script need help!

Byllan

Member
Joined
Dec 29, 2009
Messages
1,079
Reaction score
12
Location
SWEDEN
Postion for Dead Tree
PHP:
12:34 You see a dead tree.
ItemID: [2709], ActionID: [32193], UniqueID: [32193].
Position: [X: 32716] [Y: 32345] [Z: 7].

DemonOak script

PHP:
  function onUse(cid, item, fromPosition, itemEx, toPosition)

local onePerQuest = true
local level = 120
local positions =
{
        kick = { x = 32716, y = 32340, z = 7 },
        summon =
        {
                {x=32712, y=32347, z=7},
                {x=32712, y=32353, z=7},
                {x=32721, y=32353, z=7},
                {x=32721, y=32347, z=7}
        }
}

local 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"}
}

local areaPosition =
{
        {x=32702, y=32340, z=7, stackpos = 255},
        {x=32730, y=32360, z=7, stackpos = 255}
}

local demonOak = {8288, 8289, 8290, 8291}

local storages =
{
        done = 35700,
        cutTree = 36901
}

local blockingTree =
{
        [2709] = {32193, 3669}
}

        if blockingTree[itemEx.itemid] and itemEx.uid == blockingTree[itemEx.itemid][1] then

                local tree = toPosition
                if isInRange(tree, areaPosition[1], areaPosition[2]) then
                        print("[Warning - Error::Demon Oak] 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.")
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Something is wrong, please contact a gamemaster.")
                        return false
                end

                if getPlayerLevel(cid) < level then
                        doPlayerSendCancel(cid, "You need level " .. level .. " or more to enter this quest.")
                        return true
                end

                if getPlayerStorageValue(cid, storages.done) > 0 then
                        doPlayerSendCancel(cid, "You already done this quest.")
                        return true
                end

                if getPlayerStorageValue(cid, storages.cutTree) > 0 then
                        return false
                end

                if onePerQuest then
                local players = getPlayersOnline()
                        for _, pid in ipairs(players) do
                        if isInRange(getCreaturePosition(pid), areaPosition[1], areaPosition[2]) then
                                doPlayerSendCancel(cid, "Wait until " .. getCreatureName(pid) .. " finish the quest.")
                                return true
                        end
                        end
                end

                doTransformItem(itemEx.uid, blockingTree[itemEx.itemid][2])
                doSendMagicEffect(toPosition, CONST_ME_POFF)
                doMoveCreature(cid, SOUTH)
                doPlayerSetStorageValue(cid, storages.cutTree, 1)
                return true

        elseif isInArray(demonOak, itemEx.itemid) then

                local get = getPlayerStorageValue(cid, itemEx.itemid)
                if get == -1 then
                        doPlayerSetStorageValue(cid, itemEx.itemid, 1)
                end

                if(getPlayerStorageValue(cid, 8288) == 12 and getPlayerStorageValue(cid, 8289) == 12 and getPlayerStorageValue(cid, 8290) == 12 and getPlayerStorageValue(cid, 8291) == 12) then
                        doTeleportThing(cid, positions.kick)
                        doPlayerSetStorageValue(cid, storages.done, 1)
                        return true
                end

                if getPlayerStorageValue(cid, itemEx.itemid) > 11 then
                        doSendMagicEffect(toPosition, CONST_ME_POFF)
                        return true
                end

                if(math.random(100) <= 1) then
                        doPlayerSetStorageValue(cid, itemEx.itemid, 12)
                        return true
                end


                if summons[get] then
                for i = 1, #summons[get] do
                        doCreateMonster(summons[get][i], positions.summon[i])
                end
                        doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
                        doPlayerSetStorageValue(cid, itemEx.itemid, get + 1)
                        if math.random(100) >= 50 then
                                doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
                        end
                end
        return false
        end
end

Console says when i hit the dead tree with Hallowed axe

PHP:
[04/04/2010 14:31:14] [Warning - Error::Demon Oak] Dead tree position is inside the quest area positions.
[04/04/2010 14:31:14] Dead tree position (x: 32716, y: 32345, z: 7)
[04/04/2010 14:31:14] North-West area position (x: 32702, y: 32340, z: 7)
[04/04/2010 14:31:14] South-West area position (x: 32730, y: 32360, z: 7)
[04/04/2010 14:31:14] Script will not work correctly, please fix it.

Help me and i give Rep++
 
Last edited:
Then change this and make sure it doesn't cover the tile the tree is at.
Code:
local areaPosition =
{
[B][COLOR="Red"]        {x=32702, y=32340, z=7, stackpos = 255},[/COLOR][/B]
        {x=32730, y=32360, z=7, stackpos = 255}
}
I don't see why it throws the error, the tree HAS to be inside those positions because of 1 tile.

If you want, you can remove this part:
Code:
                if isInRange(tree, areaPosition[1], areaPosition[2]) then
                        print("[Warning - Error::Demon Oak] 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.")
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Something is wrong, please contact a gamemaster.")
                        return false
                end
 
Not work

17:31 You see a dead tree.
ItemID: [2709], ActionID: [32193], UniqueID: [32193].
Position: [X: 32716] [Y: 32345] [Z: 7].
 
Fail in this thread..
Code:
local onePerQuest = true
local level = 120
local positions = {
	kick = { x = 32716, y = 32340, z = 7 },
	summon = {
		{x=32712, y=32347, z=7},
		{x=32712, y=32353, z=7},
		{x=32721, y=32353, z=7},
		{x=32721, y=32347, z=7}
	}
}
local 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"}
}
local areaPosition = {
	{x=32702, y=32340, z=7},
	{x=32730, y=32360, z=7}
}
local demonOak = {8288, 8289, 8290, 8291}
local storages = {
	done = 35700,
	cutTree = 36901
}
local blockingTree = {
	[2709] = {32193, 3669}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if blockingTree[itemEx.itemid] and itemEx.uid == blockingTree[itemEx.itemid][1] then
		if getPlayerLevel(cid) < level then
			return doPlayerSendCancel(cid, "You need to be level " .. level .. " or higher to enter this area.")
		elseif getPlayerStorageValue(cid, storages.done) > 0 then
			return doPlayerSendCancel(cid, "You have already completed this quest.")
		elseif getPlayerStorageValue(cid, storages.cutTree) > 0 then
			return false
		elseif onePerQuest then
			local players = getPlayersOnline()
			for _, pid in ipairs(players) do
				if isInRange(getThingPos(pid), areaPosition[1], areaPosition[2]) then
					return doPlayerSendCancel(cid, "Wait until " .. getCreatureName(pid) .. " finishes the quest.")
				end
			end
		end
		doTransformItem(itemEx.uid, blockingTree[itemEx.itemid][2])
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doMoveCreature(cid, SOUTH)
		return setPlayerStorageValue(cid, storages.cutTree, 1)
	elseif isInArray(demonOak, itemEx.itemid) then
		local get = getPlayerStorageValue(cid, itemEx.itemid)
		setPlayerStorageValue(cid, itemEx.itemid, math.max(1, get))
		if getPlayerStorageValue(cid, 8288) == 12 and getPlayerStorageValue(cid, 8289) == 12 and getPlayerStorageValue(cid, 8290) == 12 and getPlayerStorageValue(cid, 8291) == 12 then
			doTeleportThing(cid, positions.kick)
			return setPlayerStorageValue(cid, storages.done, 1)
		elseif getPlayerStorageValue(cid, itemEx.itemid) > 11 then
			return doSendMagicEffect(toPosition, CONST_ME_POFF)
		elseif math.random(100) <= 1 then
			return setPlayerStorageValue(cid, itemEx.itemid, 12)
		elseif summons[get] then
			for i = 1, #summons[get] do
				doCreateMonster(summons[get][i], positions.summon[i])
			end
			doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
			if math.random(100) >= 50 then
				doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
			end
			return setPlayerStorageValue(cid, itemEx.itemid, get + 1)
		end
	end
end
 
Back
Top