• 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

Hello, i'd like some help im using TFS 3.7 and the mounts system stop working after i enable this demon oak lib, can you help fixing it? Thnx in advance, here's my taming code:
Code:
--[[
	The 'CHANCE' values that I'm not sure about have been defaulted to 40%
	TODO: Get real FAIL_MSG and SUCCESS_MSG for some of the tammings

	Info:
		[xxxxx] 	 = tamming itemid
		NAME 		 = name of the creature tamming item is used on
		ID 			 = mount id for storage (check out data/XML/mounts.xml)
		TYPE 		 = type of creature taming item is used on (TYPE_MONSTER/TYPE_NPC/TYPE_ACTION/TYPE_UNIQUE)
		CHANCE 		 = X/100%
		FAIL_MSG 	 = { {action (ACTION_RUN/ACTION_BREAK/ACTION_NONE/ACTION_ALL), "message"} }
		SUCCESS_MSG  = "message"
]]

local ACTION_RUN, ACTION_BREAK, ACTION_NONE, ACTION_ALL = 1, 2, 3, 4
local TYPE_MONSTER, TYPE_NPC, TYPE_ACTION, TYPE_UNIQUE = 1, 2, 3, 4

local config = {
	[5907] = 	{NAME = 'Bear', 				ID = 3, 	TYPE = TYPE_MONSTER, 	CHANCE = 20, 	FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You have tamed the bear."},
	[13295] = 	{NAME = 'Black Sheep', 			ID = 4, 	TYPE = TYPE_MONSTER, 	CHANCE = 25, 	FAIL_MSG = { {1, "The black sheep ran away."}, {2, "Oh no! The reins were torn."}, {3, "The black sheep is trying to run away."} }, SUCCESS_MSG = "You have tamed the sheep."},
	[13293] = 	{NAME = 'Midnight Panther',		ID = 5, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The panther has escaped."}, {2, "The whip broke."} }, SUCCESS_MSG = "You have tamed the panther."},
	[13298] = 	{NAME = 'Terror Bird', 			ID = 2, 	TYPE = TYPE_MONSTER, 	CHANCE = 15, 	FAIL_MSG = { {1, "The bird ran away."}, {3, "The terror bird is pecking you."} }, SUCCESS_MSG = "You have tamed the bird."},
	[13247] = 	{NAME = 'Boar', 				ID = 10, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The boar has run away"}, {3, "The boar attacks you."} }, SUCCESS_MSG = "You have tamed the boar."},
	[13305] = 	{NAME = 'Crustacea Gigantica', 	ID = 7, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The crustacea has run away."}, {2, "The crustacea ate the shrimp."} }, SUCCESS_MSG = "You have tamed the crustacea."},
	[13291] = 	{NAME = 'Undead Cavebear', 		ID = 12, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The undead bear has run away."} }, SUCCESS_MSG = "You have tamed the skeleton."},
	[13307] = 	{NAME = 'Wailing Widow', 		ID = 1, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The widow has run away."}, {2, "The widow has eaten the sweet bait."} }, SUCCESS_MSG = "You have tamed the widow."},
	[13292] = 	{NAME = 'Tin Lizzard', 			ID = 8, 	TYPE = TYPE_NPC, 		CHANCE = 40, 	FAIL_MSG = { {2, "The key broke inside."} }, SUCCESS_MSG = "You have started the Tin Lizzard!"},
	[13294] = 	{NAME = 'Draptor', 			ID = 6, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The draptor has run away."}, {3, "The draptor has fled."} }, SUCCESS_MSG = "You have tamed the draptor."},
	[13536] = 	{NAME = 'Crystal Wolf', 		ID = 16, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The wolf has run away."} }, SUCCESS_MSG = "You have tamed the wolf."},
	[13539] = 	{NAME = 'White Deer', 			ID = 18, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {2, "The cone broke."}, {3, "The deer has fled in fear."} }, SUCCESS_MSG = "You have tamed the deer."},
	[13538] = 	{NAME = 'Panda', 				ID = 19, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {4, "Panda ate the leaves and ran away."} }, SUCCESS_MSG = "You have tamed the panda."},
	[13535] = 	{NAME = 'Dromedary', 			ID = 20, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "Dromedary has run away."} }, SUCCESS_MSG = "You have tamed the dromedary."},
	[13498] = 	{NAME = 'Sandstone Scorpion', 	ID = 21, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The scorpion has vanished."}, {2, "Scorpion broken the sceptre."} }, SUCCESS_MSG = "You have tamed the scorpion"},
	[13537] = 	{NAME = 'Donkey', 			ID = 13, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The witch has escaped!"} }, SUCCESS_MSG = "You have tamed the mule."},
	[13938] = 	{NAME = 'Uniwheel', 			ID = 15, 	TYPE = TYPE_NPC, 		CHANCE = 40, 	FAIL_MSG = { {2, "The oil is having no effect."} }, SUCCESS_MSG = "You have found an Uniwheel."},
	[13508] = 	{NAME = 'Slug', 				ID = 14, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The slug has run away."}, {3, "The drug had no effect."} }, SUCCESS_MSG = "You have tamed the slug."},
	[13939] = 	{NAME = 'Wild Horse', 			ID = 23, 	TYPE = TYPE_MONSTER, 	CHANCE = 15, 	FAIL_MSG = { {1, "The horse runs away."}, {2, "The horse ate the oats."} }, SUCCESS_MSG = "You have tamed the horse."},
	[15545] =	{NAME = 'Manta Ray', 			ID = 28, 	TYPE = TYPE_MONSTER, 	CHANCE = 30, 	FAIL_MSG = { {1, "The manta ray fled."}, {3, "The manta ray is trying to escape."} }, SUCCESS_MSG = "You have tamed the manta ray."},
	[15546] =	{NAME = 'Ladybug', 			ID = 27, 	TYPE = TYPE_MONSTER, 	CHANCE = 30, 	FAIL_MSG = { {1, "The ladybug got scared and ran away."}, {3, "The ladybug is trying to nibble."} }, SUCCESS_MSG = "You tame a ladybug."},
	[20138] = 	{NAME = 'Water Buffalo', 		ID = 35, 	TYPE = TYPE_MONSTER, 	CHANCE = 30, 	FAIL_MSG = { {1, "The water buffalo got scared and ran away."}, {3, "The water buffalo is trying to nibble."} }, SUCCESS_MSG = "You tamed a water buffalo."}
}

local function doFailAction(cid, mount, pos, item, itemEx)
	local action, effect = mount.FAIL_MSG[math.random(1, table.maxn(mount.FAIL_MSG))], CONST_ME_POFF
	if(action[1] == ACTION_RUN) then
		doRemoveCreature(itemEx.uid)
	elseif(action[1] == ACTION_BREAK) then
		effect = CONST_ME_BLOCKHIT
		doRemoveItem(item.uid, 1)
	elseif(action[1] == ACTION_ALL) then
		doRemoveCreature(itemEx.uid)
		doRemoveItem(item.uid, 1)
	end

	doSendMagicEffect(pos, effect)
	doCreatureSay(cid, action[2], TALKTYPE_MONSTER_SAY)
	return action
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mount = config[item.itemid]
	if(mount == nil or getPlayerMount(cid, mount.ID)) then
		return false
	end

	local rand = math.random(1, 100)
	--Monster Mount
	if(isMonster(itemEx.uid) and not isSummon(itemEx.uid) and mount.TYPE == TYPE_MONSTER) then
		if(mount.NAME == getCreatureName(itemEx.uid)) then
			if(rand > mount.CHANCE) then
				doFailAction(cid, mount, toPosition, item, itemEx)
				return true
			end

			doPlayerAddMount(cid, mount.ID)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

			doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
			doRemoveCreature(itemEx.uid)

			doSendMagicEffect(toPosition, CONST_ME_POFF)
			doRemoveItem(item.uid, 1)
			return true
		end
	--NPC Mount
	elseif(isNpc(itemEx.uid) and mount.TYPE == TYPE_NPC) then
		if(mount.NAME == getCreatureName(itemEx.uid)) then
			if(rand > mount.CHANCE) then
				doFailAction(cid, mount, toPosition, item, itemEx)
				return true
			end

			doPlayerAddMount(cid, mount.ID)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

			doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
			doRemoveItem(item.uid, 1)
			return true
		end
	--Action Mount
	elseif(itemEx.actionid > 0 and mount.TYPE == TYPE_ACTION) then
		if(mount.NAME == itemEx.actionid) then
			if(rand > mount.CHANCE) then
				doFailAction(cid, mount, toPosition, item, itemEx)
				return true
			end

			doPlayerAddMount(cid, mount.ID)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

			doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

			doRemoveItem(item.uid, 1)
			return true
		end
	--Unique Mount
	elseif(itemEx.uid <= 65535 and mount.TYPE == TYPE_UNIQUE) then
		if(mount.NAME == itemEx.uid) then
			if(rand > mount.CHANCE) then
				doFailAction(cid, mount, toPosition, item, itemEx)
				return true
			end

			doPlayerAddMount(cid, mount.ID)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

			doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

			doRemoveItem(item.uid, 1)
			return true
		end
	end

	return false
end
 
[02/10/2013 22:21:58] [Error - Action Interface]
[02/10/2013 22:21:58] data/actions/scripts/demonOak.lua:eek:nUse
[02/10/2013 22:21:58] Description:
[02/10/2013 22:21:58] data/lib/102-demonOak.lua:244: attempt to call method 'lower' (a nil value)
[02/10/2013 22:21:58] stack traceback:
[02/10/2013 22:21:58] data/lib/102-demonOak.lua:244: in function 'monsterExists'
[02/10/2013 22:21:58] data/actions/scripts/demonOak.lua:59: in function <data/actions/scripts/demonOak.lua:1>

What's wrong?

When I use the axe the plant appears and the text msg, but no monsters, after few tries thats the error I get.
 
Last edited:
I was about to post the same as the user above. Everything seems to work just fine but when you hit the tree with the axe no monsters are summoned, after some tries the error appears on console.
 
Semms to be like function 'lower' is not in your server anymore.

Try replacing all str:lower() functions with string.lower(str)

An example:
Change
Code:
--Line 244, where the error is showed first.
if m_name:lower() == name:lower() then
To
Code:
if string.lower(m_name) == string.lower(name) then
 
Semms to be like function 'lower' is not in your server anymore.

Try replacing all str:lower() functions with string.lower(str)

An example:
Change
Code:
--Line 244, where the error is showed first.
if m_name:lower() == name:lower() then
To
Code:
if string.lower(m_name) == string.lower(name) then

When doing so the console shows a new error and the symptoms are the same.

[3/10/2013 11:18:11] [Error - Action Interface]
[3/10/2013 11:18:11] data/actions/scripts/quests/demonOak.lua:eek:nUse
[3/10/2013 11:18:11] Description:
[3/10/2013 11:18:11] data/lib/102-demonOak.lua:244: bad argument #1 to 'lower' (string expected, got table)
[3/10/2013 11:18:11] stack traceback:
[3/10/2013 11:18:11] [C]: in function 'lower'
[3/10/2013 11:18:11] data/lib/102-demonOak.lua:244: in function 'monsterExists'
[3/10/2013 11:18:11] data/actions/scripts/quests/demonOak.lua:59: in function <data/actions/scripts/quests/demonOak.lua:1>
 
Can't put the whole code, so in2 posts:

--PLEASE SPECIFY HERE WHAT DISTRO VERSION YOU ARE USING. IF YOU ARE USING (0.40/0.4.0)DEV SPECIFY IT AS 040
--IF YOU ARE USING 0.3.7/0.3.7PL1/0.3.6/0.3.5.... OR ANY OTHER VERSION OF 0.3, SPECIFY IT AS 037/036/035, ETC...
--THE IDEA IS TO SPECIFY IT WITHOUT ANY STRING CHARACTER, JUST NUMBERS
--MUST SPECIFY THIS PROPERLY TO MAKE SCRIPT WORKS CORRECTLY
DISTRO_VERSION = 036
--END

_INFO =
{
UPDATED = "June 26 2012",
VERSION = "0.70",
REV = 1,
AUTHOR = "Darkhaos",
CONTACT = "http://otland.net/members/darkhaos/"
}

if getStorage(0x65535) < 1 then
doSetStorage(0x65536, os.clock())
print("\n>> Loading Demon Oak Lib V" .. (_INFO.VERSION or "?") .. " REV: " .. (_INFO.REV or "?") .. " (" .. (_INFO.UPDATED or "?") .. ") By " .. (_INFO.AUTHOR or "?") .. " (Contact: " .. (_INFO.CONTACT or "?") .. ")")
doSetStorage(0x65535, 1)
end

ITEM_DEADTREE = 2709

HALLOWEDAXE_PRICE = 1000

ERROR_NOERROR = 0
ERROR_TREEPOSITION = 1
ERROR_NOTENOUGHLEVEL = 2
ERROR_ALREADYDONE = 3
ERROR_ALREADYCUT = 4
ERROR_PLAYERINAREA = 5
ERROR_MISSINGINFO = 6

TYPE_PLAYER = 1
TYPE_MONSTER = 2
TYPE_NPC = 3
TYPE_ALL = 4

GET_COUNT = 1
GET_UID = 2

STORAGE_LIB = 11257
STORAGE_OAKTHINK = 11258

OAKTHINK_TIME = 10000
OAKTHINK_CHANCE = 30

oneInArea = true
killAllBeforeCut = true
oakThink = true

logEnabled = true

level = 120
waves = 11
positions =
{
kick = {x = 42716, y = 42340, z = 7},
summon =
{
{x = 42711, y = 42347, z = 7},
{x = 42711, y = 42351, z = 7},
{x = 42714, y = 42354, z = 7},
{x = 42719, y = 42355, z = 7},
{x = 42721, y = 42352, z = 7},
{x = 42721, y = 42349, z = 7},
{x = 42718, y = 42347, z = 7},
{x = 42715, y = 42347, z = 7}
},
rewardRoom = {x = 42713, y = 42398, z = 8},
demonOak = {x = 42716, y = 42351, z = 7}
}

summons =
{
[1] = {"demon", "grim reaper", "elder bonelord", "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 bonelord", "bonebeast"},
[7] = {"dark torturer", "undead dragon", "demon", "demon"},
[8] = {"elder bonelord", "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"}
}

questAreaPosition =
{
{x = 42710, y = 42345, z = 7, stackpos = 255},
{x = 42725, y = 42354, z = 7, stackpos = 255}
}

demonOak = {8288, 8289, 8290, 8291}

storages =
{
done = 35712,
treeCut = 38551
}

blockingTree =
{
[ITEM_DEADTREE] = {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 = 8905, count = 1},
[12903] = {done = 12900, reward = 8918, count = 1},
[12904] = {done = 12900, reward = 8851, count = 1}
}

sounds =
{
[1] = --Messages shown when you wlak on special tiles
{
"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!"
},
[2] = --Messages shown when you use axe on Demon Oak
{
"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!!"
}
}

function canEnter(cid, tree)
if type(questAreaPosition) == "table" and type(questAreaPosition[1]) == "table" and type(questAreaPosition[2]) == "table" and level and type(storages) == "table" then
if isInRange(tree, questAreaPosition[1], questAreaPosition[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 oneInArea then
if getCreaturesInQuestArea(TYPE_PLAYER, questAreaPosition[1], questAreaPosition[2], GET_COUNT) > 0 then
return ERROR_PLAYERINAREA
end
end
else
return ERROR_MISSINGINFO
end
return ERROR_NOERROR
end


function getError(data, tree)
if data == 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: " .. questAreaPosition[1].x .. ", y: " .. questAreaPosition[1].y .. ", z: " .. questAreaPosition[1].z .. ")\nSouth-West area position (x: " .. questAreaPosition[2].x .. ", y: " .. questAreaPosition[2].y .. ", z: " .. questAreaPosition[2].z .. ")\nScript will not work correctly, please fix it.") and "Something is wrong, please contact a staff member."
elseif data == ERROR_NOTENOUGHLEVEL then
return "You need level " .. level .. " or higher to enter to the quest area."
elseif data == ERROR_ALREADYDONE then
return "You already done this quest."
elseif data == ERROR_ALREADYCUT then
return "You can not leave the quest area by here."
elseif data == ERROR_PLAYERINAREA then
return "Wait until the player inside the quest area finishes the quest."
elseif data == ERROR_MISSINGINFO then
return "Sorry, not possible."
end
return ""
end

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

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

local tmp = {}
local t = types[type]
if not t then
return print("[!] --> [Warning - Function::getCreaturesInQuestArea] 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
table.insert(tmp, thing.uid)
if not countSummon and isSummon(thing.uid) then
for i = 1, #tmp do
if tmp == thing.uid then
table.remove(tmp, i)
break
end
end
end
end
end
end
end
return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknow type to get " .. (get or "(nil value)")))
end

function monsterExists(name)

local file = "data/monster/monsters.xml"
local openFile = io.open(file, "r")
local m_name, getName, getFile, m_file = 0, 0, 0, 0
local monsterExists, fileExists = false, false
if openFile ~= 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=".*".*')
if getName and getFile then
m_name = string.sub(getName, string.find(getName, '="') + 2, (string.find(getName, '" ') or string.find(getName, '"f') or 1) - 1)
m_file = string.sub(getFile, string.find(getFile, '="') + 2, (string.find(getFile, '"/') or string.find(getFile, '" ') or 1) - 1)
if string.lower(m_name) == string.lower(name) then
monsterExists = true
mfile = io.open("data/monster/" .. m_file, "r")
if mfile ~= nil then
fileExists = true
mfile:close()
end
end
end
end
end
openFile:close()
end
return monsterExists and fileExists or false
end

function isSummon(cid)
if DISTRO_VERSION < 040 then
return getCreatureMaster(cid) ~= cid or false
else
return getCreatureMaster(cid) ~= nil or false
end
end

function isLastCut(cid)
local k, s = 0, 0
if not demonOak or type(demonOak) ~= "table" then
return false
end
for i = demonOak[1], demonOak[#demonOak] do
if getCreatureStorage(cid, i) == #summons + 1 then
k = k + 1
end
if getCreatureStorage(cid, i) == #summons then
s = s + 1
end
end
return (k == 3 and s == 1 and true or false)
end
function checkLib()

local final = "[" .. os.date() .. "]\n"
print("\n[!] -> Checking demon oak lib...")
local start = os.clock()
local r = 0
if not ITEM_DEADTREE or type(ITEM_DEADTREE) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load dead tree id (number expected, got " .. (type(ITEM_DEADTREE) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load dead tree id (number expected, got " .. (type(ITEM_DEADTREE) or "nil") .. ")\n"
r = r + 1
end
if not HALLOWEDAXE_PRICE or type(HALLOWEDAXE_PRICE) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load hallowed axe price (number expected, got " .. (type(HALLOWEDAXE_PRICE) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load hallowed axe price (number expected, got " .. (type(HALLOWEDAXE_PRICE) or "nil") .. ")\n"
r = r + 1
end
if not ERROR_NOERROR or type(ERROR_NOERROR) ~= "number" or not ERROR_TREEPOSITION or type(ERROR_TREEPOSITION) ~= "number"
or not ERROR_NOTENOUGHLEVEL or type(ERROR_NOTENOUGHLEVEL) ~= "number" or not ERROR_ALREADYDONE or type(ERROR_ALREADYDONE) ~= "number"
or not ERROR_ALREADYCUT or type(ERROR_ALREADYCUT) ~= "number" or not ERROR_PLAYERINAREA or type(ERROR_PLAYERINAREA) ~= "number"
or not ERROR_MISSINGINFO or type(ERROR_MISSINGINFO) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load variables for function 'getError'")
final = final .. " [Warning - Lib:DemonOak] Cannot load variables for function 'getError'\n"
r = r + 1
end
 
Last edited:
if not TYPE_PLAYER or type(TYPE_PLAYER) ~= "number" or not TYPE_MONSTER or type(TYPE_MONSTER) ~= "number"
or not TYPE_NPC or type(TYPE_NPC) ~= "number" or not TYPE_ALL or type(TYPE_ALL) ~= "number"
or not GET_COUNT or type(GET_COUNT) ~= "number" or not GET_UID or type(GET_UID) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load variables for function 'getCreaturesInQuestArea'")
final = final .. " [Warning - Lib:DemonOak] Cannot load variables for function 'getCreaturesInQuestArea'\n"
r = r + 1
end
if not STORAGE_LIB or not isInArray({"number", "string"}, type(STORAGE_LIB)) then
print("[!] --> [Warning - Lib:DemonOak] Cannot load storage lib, lib will be checked more than once.")
final = final .. " [Warning - Lib:DemonOak] Cannot storage lib, lib will be checked more than once.\n"
r = r + 1
end
if not STORAGE_OAKTHINK or not isInArray({"number", "string"}, type(STORAGE_OAKTHINK)) then
print("[!] --> [Warning - Lib:DemonOak] Cannot load storage oakthink, 'demon oak think' will be started more than once.")
final = final .. " [Warning - Lib:DemonOak] Cannot storage oakthink, 'demon oak think' will be started more than once.\n"
r = r + 1
end
if not OAKTHINK_TIME or type(OAKTHINK_TIME) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load oakthink time, 'demon oak think' cannot be started.")
final = final .. " [Warning - Lib:DemonOak] Cannot oakthink time, 'demon oak think' cannot be started.\n"
r = r + 1
end
if not OAKTHINK_CHANCE or type(OAKTHINK_CHANCE) ~= "number" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load oakthink chance, 'demon oak think' cannot be started.")
final = final .. " [Warning - Lib:DemonOak] Cannot oakthink chance, 'demon oak think' cannot be started.\n"
r = r + 1
end
if type(summons) == "table" then
for k, v in pairs(summons) do
if v and type(v) == "table" then
for _, s in ipairs(v) do
if not monsterExists(s) then
print("[!] --> [Warning - Lib:DemonOak] Table: summons, Id: " .. k .. ", Monster " .. s .. " does not exists. Check if it is well writen in monsters.xml and also check if the file really exists.")
final = final .. " [Warning - Lib:DemonOak] Table: summons, Id: " .. k .. ", Monster " .. s .. " does not exists. Check if it is well writen in monsters.xml and also check if the file really exists.\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Table: summons, Id: " .. k .. ", cannot load summons (table expected, got " .. (type(v) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Table: summons, Id: " .. k .. ", cannot load summons (table expected, got " .. (type(v) or "nil") .. ")\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load summons (table expected, got " .. (type(summons) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load summons (table expected, got " .. (type(summons) or "nil") .. ")\n"
r = r + 1
end
if type(positions) == "table" then
if type(positions.kick) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Invalid position for kick (table expected, got " .. (type(positions.kick) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Invalid position for kick (table expected, got " .. (type(positions.kick) or "nil") .. ")\n"
r = r + 1
elseif type(positions.rewardRoom) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Invalid position for reward room (table expected, got " .. (type(positions.rewardRoom) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Invalid position for reward room (table expected, got " .. (type(positions.rewardRoom) or "nil") .. ")\n"
r = r + 1
elseif type(positions.demonOak) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load demonOak position, scripts will use player position.")
final = final .. " [Warning - Lib:DemonOak] Cannot load demonOak position, scripts will use player position.\n"
r = r + 1
end
if type(positions.summon) == "table" then
for i = 1, #positions.summon do
if type(positions.summon) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Invalid summon position on index " .. i .. " (table expected, got " .. (type(positions.summon) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Invalid summon position on index " .. i .. " (table expected, got " .. (type(positions.summon) or "nil") .. ")\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load summons position (table expected, got " .. (type(positions.summon) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load summons position (table expected, got " .. (type(positions.summon) or "nil") .. ")\n"
r = r + 1
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load positions (table expected, got " .. (type(positions) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load positions (table expected, got " .. (type(positions) or "nil") .. ")\n"
r = r + 1
end
if not questAreaPosition or type(questAreaPosition[1]) ~= "table" or type(questAreaPosition[2]) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Invalid area positions!")
final = final .. " [Warning - Lib:DemonOak] Invalid area positions!\n"
r = r + 1
end
if type(demonOak) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load 'demonOak' ids (table expected, got " .. (type(demonOak) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load 'demonOak' ids (table expected, got " .. (type(demonOak) or "nil") .. ")\n"
demonOak = {8289, 8288, 8290, 8291}
r = r + 1
end
if storages and storages.done and storages.treeCut then
if storages.done == storages.treeCut then
print("[!] --> [Warning - Lib:DemonOak] Storage for dead tree (" .. storages.cutTree .. ") and storage to check if demonOak is finished (" .. storages.done .. ") are the same, change it or script will not work correctly.")
final = final .. " [Warning - Lib:DemonOak] Storage for dead tree (" .. storages.cutTree .. ") and storage to check if demonOak is finished (" .. storages.done .. ") are the same, change it or script will not work correctly.\n"
r = r + 1
end
else
print("[!] --> [Warning - Lib:Demon Oak] Cannot load storages (table expected, got " .. (type(storages) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load storages (table expected, got " .. (type(storages) or "nil") .. ")\n"
r = r + 1
end
if type(blockingTree) == "table" then
for k, v in pairs(blockingTree) do
if type(v) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load info about dead tree id: " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load info about dead tree id: " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load info about dead tree (table expected, got " .. (type(blockingTree) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load info about dead tree (table expected, got " .. (type(blockingTree) or "nil") .. ")\n"
r = r + 1
end
if type(rewards) == "table" then
for k, v in pairs(rewards) do
if type(v) ~= "table" or not v.done or not v.reward or not v.count then
print("[!] --> [Warning - Lib:DemonOak] Cannot load reward id " .. k .. "!")
final = final .. " [Warning - Lib:DemonOak] Cannot load reward id " .. k .. "!\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load rewards (table expected, got " .. (type(rewards) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load rewards (table expected, got " .. (type(rewards) or "nil") .. ")\n"
r = r + 1
end
if type(sounds) == "table" then
for k, v in pairs(sounds) do
if type(v) ~= "table" then
print("[!] --> [Warning - Lib:DemonOak] Cannot load sounds on index " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load sounds on index " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")\n"
r = r + 1
end
end
else
print("[!] --> [Warning - Lib:DemonOak] Cannot load sounds (table expected, got " .. (type(sounds) or "nil") .. ")")
final = final .. " [Warning - Lib:DemonOak] Cannot load sounds (table expected, got " .. (type(sounds) or "nil") .. ")\n"
r = r + 1
end

print("[!] -> " .. r .. " problems loaded in " .. os.clock() - start .. " seconds.\n")
local logFile = "data/logs/demonOak.txt"
local f = io.open(logFile, "a+")
if logEnabled then
if f ~= nil then
f:write((r > 0 and final .. "\n\n" or ""))
f:close()
end
end
end

function demonOakThink()

if getGameState() == GAMESTATE_NORMAL then
if math.random(100) <= OAKTHINK_CHANCE then
if positions and positions.demonOak and type(positions.demonOak) == "table" and questAreaPosition and questAreaPosition[1] and type(questAreaPosition[1]) == "table" and questAreaPosition[2] and type(questAreaPosition[2]) == "table" then
local rangeX, rangeY = getDistanceBetween(positions.demonOak, questAreaPosition[1]) + 3, getDistanceBetween(positions.demonOak, questAreaPosition[2]) + 3
local list = getSpectators(positions.demonOak, rangeX, rangeY)
if list and #list > 0 then
for _, uid in ipairs(list) do
if isPlayer(uid) and not isInArea(getCreaturePosition(uid), questAreaPosition[1], questAreaPosition[2]) and getCreaturesInQuestArea(TYPE_PLAYER, questAreaPosition[1], questAreaPosition[2], GET_COUNT) == 0 then
doCreatureSay(uid, sounds[1][math.random(#sounds[1])], TALKTYPE_MONSTER_YELL, false, uid, positions.demonOak)
end
end
end
end
end
end

addEvent(demonOakThink, OAKTHINK_TIME)
end

if getStorage(STORAGE_LIB) < 1 then
checkLib()
doSetStorage(STORAGE_LIB, 1)
end

if getStorage(STORAGE_OAKTHINK) < 1 and oakThink then
demonOakThink()
doSetStorage(STORAGE_OAKTHINK, 1)
end

if getStorage(0x65537) < 1 then
print("[!] -> Demon Oak Lib loaded in " .. os.clock() - getStorage(0x65536) .. " seconds.\n")
doSetStorage(0x65537, 1)
end
 
[02/10/2013 22:21:58] [Error - Action Interface]
[02/10/2013 22:21:58] data/actions/scripts/demonOak.lua:eek:nUse
[02/10/2013 22:21:58] Description:
[02/10/2013 22:21:58] data/lib/102-demonOak.lua:244: attempt to call method 'lower' (a nil value)
[02/10/2013 22:21:58] stack traceback:
[02/10/2013 22:21:58] data/lib/102-demonOak.lua:244: in function 'monsterExists'
[02/10/2013 22:21:58] data/actions/scripts/demonOak.lua:59: in function <data/actions/scripts/demonOak.lua:1>

What's wrong?

When I use the axe the plant appears and the text msg, but no monsters, after few tries thats the error I get.

Same problem with 0.3.7!
@EDIT: Nvm, I already fixed all the bugs... Thanks for the scripts! <3
 
Last edited:
[02/11/2013 12:37:55] [Error - Action Interface]
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:eek:nUse
[02/11/2013 12:37:55] Description:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: attempt to call method 'lower' (a nil value)
[02/11/2013 12:37:55] stack traceback:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: in function 'monsterExists'
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>
 
someone solved that error on tfs 0.4?


[02/11/2013 12:37:55] [Error - Action Interface]
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:eek:nUse
[02/11/2013 12:37:55] Description:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: attempt to call method 'lower' (a nil value)
[02/11/2013 12:37:55] stack traceback:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: in function 'monsterExists'
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>
 
someone solved that error on tfs 0.4?


[02/11/2013 12:37:55] [Error - Action Interface]
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:eek:nUse
[02/11/2013 12:37:55] Description:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: attempt to call method 'lower' (a nil value)
[02/11/2013 12:37:55] stack traceback:
[02/11/2013 12:37:55] data/lib/102-demonoak.lua:243: in function 'monsterExists'
[02/11/2013 12:37:55] data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>
read some posts above yours lol
http://otland.net/threads/demon-oak-bug.202774/#post-1948385
 
anyone can help me ?

Code:
[20/03/2014 15:45:43] [Error - Action Interface]
[20/03/2014 15:45:43] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:43] Description:
[20/03/2014 15:45:43] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:43] stack traceback:
[20/03/2014 15:45:43]    [C]: in function 'lower'
[20/03/2014 15:45:43]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:43]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

[20/03/2014 15:45:45] [Error - Action Interface]
[20/03/2014 15:45:45] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:45] Description:
[20/03/2014 15:45:45] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:45] stack traceback:
[20/03/2014 15:45:45]    [C]: in function 'lower'
[20/03/2014 15:45:45]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:45]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

[20/03/2014 15:45:46] [Error - Action Interface]
[20/03/2014 15:45:46] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:46] Description:
[20/03/2014 15:45:46] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:46] stack traceback:
[20/03/2014 15:45:46]    [C]: in function 'lower'
[20/03/2014 15:45:46]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:46]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

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

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

local tree = toPosition
if canEnter(cid, tree) ~= ERROR_NOERROR then
return doPlayerSendCancel(cid, getError(canEnter(cid, tree), tree)) and doSendMagicEffect(tree, CONST_ME_POFF)
end

doTransformItem(itemEx.uid, blockingTree[itemEx.itemid][2])
doSendMagicEffect(tree, CONST_ME_POFF)
doMoveCreature(cid, getDirectionTo(getCreaturePosition(cid), toPosition))
doCreatureSetStorage(cid, storages.treeCut, 1)
doCreatureSay(cid, "I AWAITED YOU! COME HERE AND GET YOUR REWARD!", TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
return true

elseif isInArray(demonOak, itemEx.itemid) then

local get = getCreatureStorage(cid, itemEx.itemid)
if get == -1 then doCreatureSetStorage(cid, itemEx.itemid, 1) end

local k = 0
for i = demonOak[1], demonOak[#demonOak] do
if(getCreatureStorage(cid, i) == (waves and waves > 0 and waves or #summons) + 1) then
k = k + 1
end
end

if killAllBeforeCut or k == #demonOak then
if getCreaturesInQuestArea(TYPE_MONSTER, questAreaPosition[1], questAreaPosition[2], GET_COUNT) > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to kill all monsters first.")
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
end

if(k == #demonOak) then
doTeleportThing(cid, positions.kick)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Tell Oldrak about your great victory against the demon oak.")
doCreatureSetStorage(cid, storages.done, 1)
return true
end

if getCreatureStorage(cid, itemEx.itemid) >= (waves and waves > 0 and waves or #summons) + 1 then
return doSendMagicEffect(toPosition, CONST_ME_POFF)
end

if math.random(10) > 3 then
doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
doCreatureSay(cid, "-krrrrak-", TALKTYPE_MONSTER_YELL, false, cid, getThingPos(itemEx.uid))
doTargetCombatHealth(0, cid, floorDamage.type, -floorDamage.min, -floorDamage.max, floorDamage.effect)
return true
end

local deny = false
local cbs = 0
if summons[get] then
for i = 1, #summons[get] do
if monsterExists(summons[get]) then
local sPos = positions.summon[math.random(#positions.summon)]
local thing = getTopCreature(sPos)
local area
if isMonster(thing.uid) then
area = getArea(sPos, 2, 2)
for _, pos in ipairs(area) do
if isCreature(getTopCreature(pos).uid) or not isInRange(pos, questAreaPosition[1], questAreaPosition[2]) then
deny = true
break
else
ret = doCreateMonster(summons[get], pos)
if tonumber(ret) == nil then
cbs = cbs + 1
end
break
end
end
else
ret = doCreateMonster(summons[get], sPos)
if tonumber(ret) == nil then
cbs = cbs + 1
end
end
end
end

if cbs > 0 then
return doPlayerSendCancel(cid, "There are " .. cbs .. " monster that could not be summoned. Wave has not been counted.")
end

if not deny then
doCreatureSetStorage(cid, itemEx.itemid, get + 1)
end
if isLastCut(cid) then
doCreatureSay(cid, "HOW IS THAT POSSIBLE?!? MY MASTER WILL CRUSH YOU!! AHRRGGG!", TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
else
doCreatureSay(cid, sounds[2][math.random(1, #sounds[2])], TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
end
doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
if math.random(100) >= 50 then
doTargetCombatHealth(0, cid, floorDamage.type, -floorDamage.min, -floorDamage.max, floorDamage.effect)
end
end
return false
end
end
 
anyone can help me ?

Code:
[20/03/2014 15:45:43] [Error - Action Interface]
[20/03/2014 15:45:43] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:43] Description:
[20/03/2014 15:45:43] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:43] stack traceback:
[20/03/2014 15:45:43]    [C]: in function 'lower'
[20/03/2014 15:45:43]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:43]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

[20/03/2014 15:45:45] [Error - Action Interface]
[20/03/2014 15:45:45] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:45] Description:
[20/03/2014 15:45:45] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:45] stack traceback:
[20/03/2014 15:45:45]    [C]: in function 'lower'
[20/03/2014 15:45:45]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:45]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

[20/03/2014 15:45:46] [Error - Action Interface]
[20/03/2014 15:45:46] data/actions/scripts/quests/demonoak/demonOak.lua:onUse
[20/03/2014 15:45:46] Description:
[20/03/2014 15:45:46] data/lib/102-demonoak.lua:243: bad argument #1 to 'lower' (string expected, got table)
[20/03/2014 15:45:46] stack traceback:
[20/03/2014 15:45:46]    [C]: in function 'lower'
[20/03/2014 15:45:46]    data/lib/102-demonoak.lua:243: in function 'monsterExists'
[20/03/2014 15:45:46]    data/actions/scripts/quests/demonoak/demonOak.lua:59: in function <data/actions/scripts/quests/demonoak/demonOak.lua:1>

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

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

local tree = toPosition
if canEnter(cid, tree) ~= ERROR_NOERROR then
return doPlayerSendCancel(cid, getError(canEnter(cid, tree), tree)) and doSendMagicEffect(tree, CONST_ME_POFF)
end

doTransformItem(itemEx.uid, blockingTree[itemEx.itemid][2])
doSendMagicEffect(tree, CONST_ME_POFF)
doMoveCreature(cid, getDirectionTo(getCreaturePosition(cid), toPosition))
doCreatureSetStorage(cid, storages.treeCut, 1)
doCreatureSay(cid, "I AWAITED YOU! COME HERE AND GET YOUR REWARD!", TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
return true

elseif isInArray(demonOak, itemEx.itemid) then

local get = getCreatureStorage(cid, itemEx.itemid)
if get == -1 then doCreatureSetStorage(cid, itemEx.itemid, 1) end

local k = 0
for i = demonOak[1], demonOak[#demonOak] do
if(getCreatureStorage(cid, i) == (waves and waves > 0 and waves or #summons) + 1) then
k = k + 1
end
end

if killAllBeforeCut or k == #demonOak then
if getCreaturesInQuestArea(TYPE_MONSTER, questAreaPosition[1], questAreaPosition[2], GET_COUNT) > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to kill all monsters first.")
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
end

if(k == #demonOak) then
doTeleportThing(cid, positions.kick)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Tell Oldrak about your great victory against the demon oak.")
doCreatureSetStorage(cid, storages.done, 1)
return true
end

if getCreatureStorage(cid, itemEx.itemid) >= (waves and waves > 0 and waves or #summons) + 1 then
return doSendMagicEffect(toPosition, CONST_ME_POFF)
end

if math.random(10) > 3 then
doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
doCreatureSay(cid, "-krrrrak-", TALKTYPE_MONSTER_YELL, false, cid, getThingPos(itemEx.uid))
doTargetCombatHealth(0, cid, floorDamage.type, -floorDamage.min, -floorDamage.max, floorDamage.effect)
return true
end

local deny = false
local cbs = 0
if summons[get] then
for i = 1, #summons[get] do
if monsterExists(summons[get]) then
local sPos = positions.summon[math.random(#positions.summon)]
local thing = getTopCreature(sPos)
local area
if isMonster(thing.uid) then
area = getArea(sPos, 2, 2)
for _, pos in ipairs(area) do
if isCreature(getTopCreature(pos).uid) or not isInRange(pos, questAreaPosition[1], questAreaPosition[2]) then
deny = true
break
else
ret = doCreateMonster(summons[get], pos)
if tonumber(ret) == nil then
cbs = cbs + 1
end
break
end
end
else
ret = doCreateMonster(summons[get], sPos)
if tonumber(ret) == nil then
cbs = cbs + 1
end
end
end
end

if cbs > 0 then
return doPlayerSendCancel(cid, "There are " .. cbs .. " monster that could not be summoned. Wave has not been counted.")
end

if not deny then
doCreatureSetStorage(cid, itemEx.itemid, get + 1)
end
if isLastCut(cid) then
doCreatureSay(cid, "HOW IS THAT POSSIBLE?!? MY MASTER WILL CRUSH YOU!! AHRRGGG!", TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
else
doCreatureSay(cid, sounds[2][math.random(1, #sounds[2])], TALKTYPE_MONSTER_YELL, false, cid, (positions.demonOak or getCreaturePosition(cid)))
end
doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
if math.random(100) >= 50 then
doTargetCombatHealth(0, cid, floorDamage.type, -floorDamage.min, -floorDamage.max, floorDamage.effect)
end
end
return false
end
end


Same problem, you fixed it?
 
Back
Top