Darkhaos
(:
I have that monster lol,
the scripts are kinda bugged.
More people can go into the demon oak while some1 is doing the quest,
I am using rev 3858 0,4
Kinda bugged for you only, this script was tested on TFS 0.3.6 not in 0.4
I have that monster lol,
the scripts are kinda bugged.
More people can go into the demon oak while some1 is doing the quest,
I am using rev 3858 0,4
[19:40:35.373] [Error - Action Interface]
[19:40:35.373] data/actions/scripts/demonOak.luanUse
[19:40:35.373] Description:
[19:40:35.373] (luaDoCreateMonster) Cannot create monster: Braindeath
I have that monster lol,
the scripts are kinda bugged.
More people can go into the demon oak while some1 is doing the quest,
I am using rev 3858 0,4
ITEM_DEADTREE = 2709
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
STORAGE_LIB = 11257
STORAGE_THINK = 11258
oneByQuest = true
killAllBeforeCut = true
enableOakThink = true
level = 120
positions =
{
kick = {x = 32716, y = 32340, z = 7},
summon =
{
{x = 32707, y = 32341, z = 7},
{x = 32704, y = 32355, z = 7},
{x = 32712, y = 32360, z = 7},
{x = 32725, y = 32358, z = 7},
{x = 32370, y = 32349, z = 7},
{x = 102, y = 82, z = 7},
{x = 103, y = 79, z = 7},
{x = 100, y = 78, z = 7}
},
rewardRoom = {x = 32786, y = 32412, z = 8},
demonOak = {x = 32716, y = 32347, 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 = 32710, y = 32347, z = 7, stackpos = 255},
{x = 32722, y = 32355, z = 7, stackpos = 255}
}
demonOak = {8288, 8289, 8290, 8291}
storages =
{
done = 35711,
treeCut = 35719
}
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 = 2495, count = 1},
[12904] = {done = 12900, reward = 8905, count = 1}
}
sounds =
{
[1] =
{
"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] =
{
"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 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()
if getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) > 0 then
return ERROR_WAITFOR
end
else
return ERROR_UNKNOWN
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: " .. 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 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_WAITFOR then
return "Wait until the player inside the quest area finish the quest."
elseif data == ERROR_UNKNOWN then
return "Sorry, not possible."
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
function isLastCut(cid)
local k, s = 0, 0
for i = demonOak[1], demonOak[table.maxn(demonOak)] do
if getCreatureStorage(cid, i) == table.maxn(summons) + 1 then
k = k + 1
end
if getCreatureStorage(cid, i) == table.maxn(summons) then
s = s + 1
end
end
return (k == 3 and s == 1 and true or false)
end
function checkLib()
if summons and 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.")
end
end
else
print("[Warning - Lib::DemonOak] Table: summons, Id: " .. k .. ", cannot load summons (table expected, got " .. (type(v) or "nil") .. ")")
end
end
else
print("[Warning - Lib::DemonOak] Cannot load summons (table expected, got " .. (type(summons) or "nil") .. ")")
end
if not type(positions.kick) or type(positions.kick) ~= "table" then
print("[Warning - Lib::DemonOak] Invalid position for kick (table expected, got " .. (type(positions.kick) or "nil") .. ")")
end
if positions.summon and type(positions.summon) == "table" then
for i = 1, table.maxn(positions.summon) do
if type(positions.summon[i]) ~= "table" then
print("[Warning - Lib::DemonOak] Invalid summon position on index " .. i .. " (table expected, got " .. (type(positions.summon[i]) or "nil") .. ")")
end
end
else
print("[Warning - Lib::DemonOak] Cannot load summons position (table expected, got " .. (type(positions.summon) or "nil") .. ")")
end
if not type(positions.rewardRoom) or type(positions.rewardRoom) ~= "table" then
print("[Warning - Lib::DemonOak] Invalid position for reward room (table expected, got " .. (type(positions.rewardRoom) or "nil") .. ")")
end
if not type(positions.demonOak) or type(positions.demonOak) ~= "table" then
print("[Warning - Lib::DemonOak] Cannot load demonOak position, scripts will use player position.")
end
if not type(areaPosition[1]) or type(areaPosition[1]) ~= "table" or not type(areaPosition[2]) or type(areaPosition[2]) ~= "table" then
print("[Warning - Lib::DemonOak] Invalid area positions!")
end
if not type(demonOak) or type(demonOak) ~= "table" then
print("[Warning - Lib::DemonOak] Variable 'demonOak' (table expected, got " .. (type(demonOak) or "nil") .. ")")
demonOak = {8288, 8289, 8290, 8291}
end
if storages.done == storages.treeCut then
print("[Warning - Lib::Demon Oak] 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.")
end
if blockingTree and 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") .. ")")
end
end
else
print("[Warning - Lib::DemonOak] Cannot load info about dead tree (table expected, got " .. (type(blockingTree) or "nil") .. ")")
end
if rewards and 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 .. "!")
end
end
else
print("[Warning - Lib::DemonOak] Cannot load rewards (table expected, got " .. (type(rewards) or "nil") .. ")")
end
if sounds and 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") .. ")")
end
end
else
print("[Warning - Lib::DemonOak] Cannot load sounds (table expected, got " .. (type(sounds) or "nil") .. ")")
end
end
if getStorage(STORAGE_LIB) < 1 then
checkLib()
doSetStorage(STORAGE_LIB, 1)
end
function demonOakThink()
local thinkTime = 10000
if math.random(10) <= 3 then
if positions.demonOak and type(positions.demonOak) == "table" and areaPosition[1] and type(areaPosition[1]) == "table" and areaPosition[2] and type(areaPosition[2]) == "table" then
local rangeX, rangeY = getDistanceBetween(positions.demonOak, areaPosition[1]) + 3, getDistanceBetween(positions.demonOak, areaPosition[2]) + 3
local list = getSpectators(positions.demonOak, rangeX, rangeY)
for _, uid in ipairs(list) do
if isPlayer(uid) and not isInArea(getCreaturePosition(uid), areaPosition[1], areaPosition[2]) and getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) == 0 then
doCreatureSay(uid, sounds[1][math.random(table.maxn(sounds[1]))], TALKTYPE_MONSTER_YELL, false, uid, positions.demonOak)
end
end
end
end
addEvent(demonOakThink, thinkTime)
end
if getStorage(STORAGE_THINK) < 1 and enableOakThink then
demonOakThink()
doSetStorage(STORAGE_THINK, 1)
end
summon =
{
{x = 32707, y = 32341, z = 7},
{x = 32704, y = 32355, z = 7},
{x = 32712, y = 32360, z = 7},
{x = 32725, y = 32358, z = 7},
{x = 32370, y = 32349, z = 7},
{x = 102, y = 82, z = 7},
{x = 103, y = 79, z = 7},
{x = 100, y = 78, z = 7}
what could be due to?
PHP:ITEM_DEADTREE = 2709 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 STORAGE_LIB = 11257 STORAGE_THINK = 11258 oneByQuest = true killAllBeforeCut = true enableOakThink = true level = 120 positions = { kick = {x = 32716, y = 32340, z = 7}, summon = { {x = 32707, y = 32341, z = 7}, {x = 32704, y = 32355, z = 7}, {x = 32712, y = 32360, z = 7}, {x = 32725, y = 32358, z = 7}, {x = 32370, y = 32349, z = 7}, {x = 102, y = 82, z = 7}, {x = 103, y = 79, z = 7}, {x = 100, y = 78, z = 7} }, rewardRoom = {x = 32786, y = 32412, z = 8}, demonOak = {x = 32716, y = 32347, 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 = 32710, y = 32347, z = 7, stackpos = 255}, {x = 32722, y = 32355, z = 7, stackpos = 255} } demonOak = {8288, 8289, 8290, 8291} storages = { done = 35711, treeCut = 35719 } 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 = 2495, count = 1}, [12904] = {done = 12900, reward = 8905, count = 1} } sounds = { [1] = { "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] = { "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 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() if getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) > 0 then return ERROR_WAITFOR end else return ERROR_UNKNOWN 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: " .. 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 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_WAITFOR then return "Wait until the player inside the quest area finish the quest." elseif data == ERROR_UNKNOWN then return "Sorry, not possible." 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 function isLastCut(cid) local k, s = 0, 0 for i = demonOak[1], demonOak[table.maxn(demonOak)] do if getCreatureStorage(cid, i) == table.maxn(summons) + 1 then k = k + 1 end if getCreatureStorage(cid, i) == table.maxn(summons) then s = s + 1 end end return (k == 3 and s == 1 and true or false) end function checkLib() if summons and 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.") end end else print("[Warning - Lib::DemonOak] Table: summons, Id: " .. k .. ", cannot load summons (table expected, got " .. (type(v) or "nil") .. ")") end end else print("[Warning - Lib::DemonOak] Cannot load summons (table expected, got " .. (type(summons) or "nil") .. ")") end if not type(positions.kick) or type(positions.kick) ~= "table" then print("[Warning - Lib::DemonOak] Invalid position for kick (table expected, got " .. (type(positions.kick) or "nil") .. ")") end if positions.summon and type(positions.summon) == "table" then for i = 1, table.maxn(positions.summon) do if type(positions.summon[i]) ~= "table" then print("[Warning - Lib::DemonOak] Invalid summon position on index " .. i .. " (table expected, got " .. (type(positions.summon[i]) or "nil") .. ")") end end else print("[Warning - Lib::DemonOak] Cannot load summons position (table expected, got " .. (type(positions.summon) or "nil") .. ")") end if not type(positions.rewardRoom) or type(positions.rewardRoom) ~= "table" then print("[Warning - Lib::DemonOak] Invalid position for reward room (table expected, got " .. (type(positions.rewardRoom) or "nil") .. ")") end if not type(positions.demonOak) or type(positions.demonOak) ~= "table" then print("[Warning - Lib::DemonOak] Cannot load demonOak position, scripts will use player position.") end if not type(areaPosition[1]) or type(areaPosition[1]) ~= "table" or not type(areaPosition[2]) or type(areaPosition[2]) ~= "table" then print("[Warning - Lib::DemonOak] Invalid area positions!") end if not type(demonOak) or type(demonOak) ~= "table" then print("[Warning - Lib::DemonOak] Variable 'demonOak' (table expected, got " .. (type(demonOak) or "nil") .. ")") demonOak = {8288, 8289, 8290, 8291} end if storages.done == storages.treeCut then print("[Warning - Lib::Demon Oak] 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.") end if blockingTree and 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") .. ")") end end else print("[Warning - Lib::DemonOak] Cannot load info about dead tree (table expected, got " .. (type(blockingTree) or "nil") .. ")") end if rewards and 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 .. "!") end end else print("[Warning - Lib::DemonOak] Cannot load rewards (table expected, got " .. (type(rewards) or "nil") .. ")") end if sounds and 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") .. ")") end end else print("[Warning - Lib::DemonOak] Cannot load sounds (table expected, got " .. (type(sounds) or "nil") .. ")") end end if getStorage(STORAGE_LIB) < 1 then checkLib() doSetStorage(STORAGE_LIB, 1) end function demonOakThink() local thinkTime = 10000 if math.random(10) <= 3 then if positions.demonOak and type(positions.demonOak) == "table" and areaPosition[1] and type(areaPosition[1]) == "table" and areaPosition[2] and type(areaPosition[2]) == "table" then local rangeX, rangeY = getDistanceBetween(positions.demonOak, areaPosition[1]) + 3, getDistanceBetween(positions.demonOak, areaPosition[2]) + 3 local list = getSpectators(positions.demonOak, rangeX, rangeY) for _, uid in ipairs(list) do if isPlayer(uid) and not isInArea(getCreaturePosition(uid), areaPosition[1], areaPosition[2]) and getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) == 0 then doCreatureSay(uid, sounds[1][math.random(table.maxn(sounds[1]))], TALKTYPE_MONSTER_YELL, false, uid, positions.demonOak) end end end end addEvent(demonOakThink, thinkTime) end if getStorage(STORAGE_THINK) < 1 and enableOakThink then demonOakThink() doSetStorage(STORAGE_THINK, 1) end
what are these coordinates?
So what is my problem?
ITEM_DEADTREE = 2709
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
STORAGE_LIB = 11257
STORAGE_THINK = 11258
oneByQuest = true
killAllBeforeCut = true
enableOakThink = true
level = 120
positions =
{
kick = {x = 110, y = 75, z = 7},
summon =
{
{x = 104, y = 83, z = 7},
{x = 101, y = 82, z = 7},
{x = 105, y = 81, z = 7},
{x = 102, y = 78, z = 7},
{x = 103, y = 80, z = 7},
{x = 102, y = 82, z = 7},
{x = 103, y = 79, z = 7},
{x = 100, y = 78, z = 7}
},
rewardRoom = {x = 586, y = 630, z = 8},
demonOak = {x = 105, y = 82, 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 = 94, y = 75, z = 7, stackpos = 255},
{x = 112, y = 86, z = 7, stackpos = 255}
}
demonOak = {8288, 8289, 8290, 8291}
storages =
{
done = 35711,
treeCut = 35719
}
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 = 2495, count = 1},
[12904] = {done = 12900, reward = 8905, count = 1}
}
sounds =
{
[1] =
{
"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] =
{
"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 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()
if getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) > 0 then
return ERROR_WAITFOR
end
else
return ERROR_UNKNOWN
end
return ERROR_NOERROR
end
function getError(data, tree)
if data == ERROR_TREEPOSITION then
return print("[Warning - Action:emon 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 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_WAITFOR then
return "Wait until the player inside the quest area finish the quest."
elseif data == ERROR_UNKNOWN then
return "Sorry, not possible."
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
function isLastCut(cid)
local k, s = 0, 0
for i = demonOak[1], demonOak[table.maxn(demonOak)] do
if getCreatureStorage(cid, i) == table.maxn(summons) + 1 then
k = k + 1
end
if getCreatureStorage(cid, i) == table.maxn(summons) then
s = s + 1
end
end
return (k == 3 and s == 1 and true or false)
end
function checkLib()
if summons and 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:emonOak] Table: summons, Id: " .. k .. ", Monster " .. s .. " does not exists.")
end
end
else
print("[Warning - Lib:emonOak] Table: summons, Id: " .. k .. ", cannot load summons (table expected, got " .. (type(v) or "nil") .. ")")
end
end
else
print("[Warning - Lib:emonOak] Cannot load summons (table expected, got " .. (type(summons) or "nil") .. ")")
end
if not type(positions.kick) or type(positions.kick) ~= "table" then
print("[Warning - Lib:emonOak] Invalid position for kick (table expected, got " .. (type(positions.kick) or "nil") .. ")")
end
if positions.summon and type(positions.summon) == "table" then
for i = 1, table.maxn(positions.summon) do
if type(positions.summon) ~= "table" then
print("[Warning - Lib:emonOak] Invalid summon position on index " .. i .. " (table expected, got " .. (type(positions.summon) or "nil") .. ")")
end
end
else
print("[Warning - Lib:emonOak] Cannot load summons position (table expected, got " .. (type(positions.summon) or "nil") .. ")")
end
if not type(positions.rewardRoom) or type(positions.rewardRoom) ~= "table" then
print("[Warning - Lib:emonOak] Invalid position for reward room (table expected, got " .. (type(positions.rewardRoom) or "nil") .. ")")
end
if not type(positions.demonOak) or type(positions.demonOak) ~= "table" then
print("[Warning - Lib:emonOak] Cannot load demonOak position, scripts will use player position.")
end
if not type(areaPosition[1]) or type(areaPosition[1]) ~= "table" or not type(areaPosition[2]) or type(areaPosition[2]) ~= "table" then
print("[Warning - Lib:emonOak] Invalid area positions!")
end
if not type(demonOak) or type(demonOak) ~= "table" then
print("[Warning - Lib:emonOak] Variable 'demonOak' (table expected, got " .. (type(demonOak) or "nil") .. ")")
demonOak = {8288, 8289, 8290, 8291}
end
if storages.done == storages.treeCut then
print("[Warning - Lib:emon Oak] 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.")
end
if blockingTree and type(blockingTree) == "table" then
for k, v in pairs(blockingTree) do
if type(v) ~= "table" then
print("[Warning - Lib:emonOak] Cannot load info about dead tree id: " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")")
end
end
else
print("[Warning - Lib:emonOak] Cannot load info about dead tree (table expected, got " .. (type(blockingTree) or "nil") .. ")")
end
if rewards and 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:emonOak] Cannot load reward id " .. k .. "!")
end
end
else
print("[Warning - Lib:emonOak] Cannot load rewards (table expected, got " .. (type(rewards) or "nil") .. ")")
end
if sounds and type(sounds) == "table" then
for k, v in pairs(sounds) do
if type(v) ~= "table" then
print("[Warning - Lib:emonOak] Cannot load sounds on index " .. k .. " (table expected, got " .. (type(v) or "nil") .. ")")
end
end
else
print("[Warning - Lib:emonOak] Cannot load sounds (table expected, got " .. (type(sounds) or "nil") .. ")")
end
end
if getStorage(STORAGE_LIB) < 1 then
checkLib()
doSetStorage(STORAGE_LIB, 1)
end
function demonOakThink()
local thinkTime = 10000
if math.random(10) <= 3 then
if positions.demonOak and type(positions.demonOak) == "table" and areaPosition[1] and type(areaPosition[1]) == "table" and areaPosition[2] and type(areaPosition[2]) == "table" then
local rangeX, rangeY = getDistanceBetween(positions.demonOak, areaPosition[1]) + 3, getDistanceBetween(positions.demonOak, areaPosition[2]) + 3
local list = getSpectators(positions.demonOak, rangeX, rangeY)
for _, uid in ipairs(list) do
if isPlayer(uid) and not isInArea(getCreaturePosition(uid), areaPosition[1], areaPosition[2]) and getCreaturesInRange(TYPE_PLAYER, areaPosition[1], areaPosition[2], GET_COUNT, false) == 0 then
doCreatureSay(uid, sounds[1][math.random(table.maxn(sounds[1]))], TALKTYPE_MONSTER_YELL, false, uid, positions.demonOak)
end
end
end
end
addEvent(demonOakThink, thinkTime)
end
if getStorage(STORAGE_THINK) < 1 and enableOakThink then
demonOakThink()
doSetStorage(STORAGE_THINK, 1)
end
[5] = {"braindeath", "Demon", "Bonebeast", "Diabolic Imp"},
[5] = {"Braindeath", "Demon", "Bonebeast", "Diabolic Imp"},
Not my error =)
You need replace
For
You need thx me for me eyes =)
[Warning - Action::Demon Oak Script] Dead tree position is inside the quest area
positions.
Dead tree position: (x: 32716, y: 32345, z: 7)
North-West area position (x: 32702, y: 32340, z: 7)
South-West area position (x: 32729, y: 32360, z: 7)
Script will not work correctly, please fix it.
Lua:local areaPosition = { {x=923, y=1138, z=7, stackpos = 255}, --nort-west of the demon oak area {x=923, y=1139, z=7, stackpos = 255} --south-east of the demon oak area }
Example:
(Image by Mazen, edited by me [ignore the red circles and the text])
The area inside the square is the area checked. If the script found a player in that area, then other player can't enter to the quest.
look you screen and look where its red square and where its dead tree
demonOak = where i need make it position ??
areaPosition =
{
{x = 32710, y = 32346, z = 7, stackpos = 255},
{x = 32725, y = 32357, z = 7, stackpos = 255}
and where it ?
ok i next problem:
Code:[4:35:30.515] [Error - TalkAction Interface] [4:35:30.515] data/talkactions/scripts/creature.lua:onSay [4:35:30.515] Description: [4:35:30.515] (luaDoCreateMonster) Cannot create monster: demon