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

[MOD] Working Demon Oak Quest V0.4 [TFS 0.3.5]

i think this will work, untested!

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="demonOakQuest" version="0.4" author="Darkhaos" contact="[email protected]" enabled="yes">
 
        <description>
        Working Demon Oak Quest for TFS 0.3.6
        </description>
 
        <config name="demonOak_config"><![CDATA[
                onePerQuest = true
                level = 120
                positions =
                {
                        reward = {x=99, y=123, z=7},
                        kick = { x = 571, y = 621, z = 7 },
                        summon =
                        {
                                {x=575, y=630, z=7},
                                {x=583, y=629, z=7},
                                {x=579, y=635, z=7},
                                {x=575, y=634, z=7}
                        }
                }
 
                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"}
                }
 
                areaPosition =
                {
                        {x=568, y=624, z=7, stackpos = 255},
                        {x=589, y=640, z=7, stackpos = 255}
                }
 
                demonOak = {8288, 8289, 8290, 8291}
 
                storages =
                {
                        done = 35700,
                        cutTree = 36901
                }
 
                blockingTree =
                {
                        [2709] = {32193, 3669}
                }
 
		uid =
		{
      		 	[12901] = {done = 12900, reward = 2495, count = 1},
       			[12902] = {done = 12900, reward = 8905, count = 1},
       			[12903] = {done = 12900, reward = 2495, count = 1},
       			[12904] = {done = 12900, reward = 8905, count = 1}
		}
 
		areaDamage = 
		{
			min = 270,
			max = 310
		}
 
        ]]></config>
 
        <action itemid="8293" event="buffer"><![CDATA[
		domodlib('demonOak_config')
 
		if blockingTree[itemEx.itemid] and itemEx.uid == blockingTree[itemEx.itemid][1] then
 
			local tree = toPosition
                	if isInRange(tree, areaPosition[1], areaPosition[2]) then
                		print("MOD>> [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
                	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 true
                	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(getThingFromPos(toPosition).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.uid, 12)
				return true
                	end
 
 
                	if summons[get] then
                        	for i = 1, #summons[get] do
                                	doCreateMonster(summons[get][i], positions.summon[i])
                                	doSendMagicEffect(positions.summon[i], CONST_ME_TELEPORT)
                        	end
                                	doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
                                	doPlayerSetStorageValue(cid, itemEx.itemid, get + 1)
                        	if math.random(100) >= 50 then
                                	doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -" .. areaDamage.min, -" .. areaDamage.max, CONST_ME_BIGPLANTS)
                        	end
			return
                	end
        	end
	]]></action>
 
        <action uniqueid="55100" event="buffer"><![CDATA[
        	domodlib('demonOak_config')
 
        	if getPlayerStorageValue(cid, 35700) > 1 then
                	doTeleportThing(cid, positions.reward)
                	doSendMagicEffect(positions.reward, CONST_ME_TELEPORT)
        	else
                	return
        	end
        ]]></action>
 
        <action uniqueid="12901-12904" event="buffer"><![CDATA[
		domodlib('demonOak_config')
 
		if uid[item.uid] then
		local t = uid[item.uid]
			if(getPlayerStorageValue(cid, t.done) < 1) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. getItemArticleById(t.reward) .. " " .. getItemNameById(t.reward) .. ".")
                        	doPlayerAddItem(cid, t.reward, t.count)
                        	doPlayerSetStorageValue(cid, t.done, 1)
                	else
                        	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It's empty.")
                	end
        	else
                	return
        	end
        ]]></action>
 
        <movevent type="StepOut" uniqueid="32193" event="script">
 
        	if item.uid == 32193 then
                	doTransformItem(item.uid, 2709)
        	end
        </movevent>
 
        <movevent type="StepIn" itemid="8292" event="script">
		domodlib('demonOak_config')
        	if isPlayer(cid) and math.random(1, 24) == 1 then
                	doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -" .. areaDamage.min, -" .. areaDamage.max, CONST_ME_BIGPLANTS)
        	end
        </movevent>
 
	<event type="logout" name="demonOakLogout" event="script"><![CDATA[
 
		function onLogout(cid)
        		if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
				doPlayerSetStorageValue(cid, 36901, 0)
			end
 
        	return true
		end 
	]]></event>
 
	<event type="death" name="demonOakDeath" event="script"><![CDATA[
 
		function onDeath(cid, corpse)
			if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
				doPlayerSetStorageValue(cid, 36901, 0)
			end
 
		return true
		end 
	]]></event>
 
</mod>
 
Great mod! This saved me from having to add several different scripts :p
 
There's a bug in the npc.
This is the error in console
Code:
[19/09/2010 19:04:48] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Oldrak.xml).
[19/09/2010 19:04:48] Line: 9, Info: Extra content at the end of the document

and this is what I found in the line 9

Code:
</npc>
[/CODE]

How can I fix it? thanks.
 
The quest itself is working alright, but after I finish the quest and go to talk to Oldrak I say Hi and he does not reply.
This is the error I get in console everytime i use the hallowed axe in the demon oak:

Code:
[20/09/2010 23:04:49] [Error - Action Interface] 
[20/09/2010 23:04:49] buffer
[20/09/2010 23:04:49] Description: 
[20/09/2010 23:04:49] [string "loadBuffer"]:97: attempt to perform arithmetic on a string value

I tried making a new Oldrak, he did reply and I went and took the reward.
What could be wrong ?
Anyways thanks in advanced and rep+ for you!
 
The quest itself is working alright, but after I finish the quest and go to talk to Oldrak I say Hi and he does not reply.
This is the error I get in console everytime i use the hallowed axe in the demon oak:

Code:
[20/09/2010 23:04:49] [Error - Action Interface] 
[20/09/2010 23:04:49] buffer
[20/09/2010 23:04:49] Description: 
[20/09/2010 23:04:49] [string "loadBuffer"]:97: attempt to perform arithmetic on a string value

I tried making a new Oldrak, he did reply and I went and took the reward.
What could be wrong ?
Anyways thanks in advanced and rep+ for you!

The npc isn't a mod script, paste the code as a normal npc script on data/npcs.
 
Dude, I didnt add it in the mods folder lol, you said it was at data/npc at your 1st post.
I wont post my oldrak since its same as yours, but the error in the console comes up when I attack the demon oak.
And somehow that affects the npc so he doesnt talk to me anymore?
 
try this for all who gets error : perform arithmetic on a string value.


try to relplace this line :

Code:
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -" .. areaDamage.min, -" .. areaDamage.max, CONST_ME_BIGPLANTS)

to

Code:
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, - (areaDamage.min), -  (areaDamage.max), CONST_ME_BIGPLANTS)
 
Hola! This MOD rocks a lot, but I want to ask if is possible to add few things.

1. When you finish to hit the oak with the axe and you get 'kick' for end the oak, can you get a message of congratulation? if is possible how I can add?
2. There is a HUGE delay when you use the axe in the oak, how I can change that? Sometime I need to wait to much for the next cut with the axe.
3. When the player use the grave (after talk with the npc) he go to the reward room BUT he can go anytime he want using the grave, this can be abuse for pk, since is a "safe room" and only player who finish the quest can use.

That's all, thanks for this great mod =)
Rep+.


edit; bug?

When the player die and try again to enter in the oak, his axe will not cut the dead tree.

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

But if this line are remove will work and player can enter back :)
 
Last edited:
Lol, more people can go into the demon oak quest...
the scripts aint working good :S
 
Back
Top