kamilcioo
Veteran OT User
- Joined
- Jul 25, 2008
- Messages
- 979
- Solutions
- 1
- Reaction score
- 291
When i use hallowed axe on tree nothing happend
Log from cosole
Script
Log from cosole
[18/08/2010 18:36:40] [Error - Action Interface]
[18/08/2010 18:36:40] data/actions/scripts/demonoak/demonOak.luanUse
[18/08/2010 18:36:40] Description:
[18/08/2010 18:36:40] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[18/08/2010 18:36:40] stack traceback:
[18/08/2010 18:36:40] data/lib/032-position.lua:2: in function 'isInRange'
[18/08/2010 18:36:40] data/actions/scripts/demonoak/demonOak.lua:60: in function <data/actions/scripts/demonoak/demonOak.lua:55>
Script
Code:
local oneByQuest = true
local level = 120
local positions =
{
kick = { x = 2202, y = 2156, z = 7 },
summon =
{
{x=2198, y=2165, z=7},
{x=2209, y=2166, z=7},
{x=2210, y=2175, z=7},
{x=2196, y=2175, z=7}
}
}
local summons =
{
[1] = {"Demon", "Grim Reaper", "Hand of Cursed Fate", "Blightwalker"},
[2] = {"Dark Torturer", "demon", "Betrayed Wraith", "Juggernaut"},
[3] = {"Dark Torturer", "Juggernaut", "Diabolic Imp", "warlock"},
[4] = {"Hand of Cursed Fate", "Juggernaut", "Undead Dragon", "Dark Torturer"},
[5] = {"braindeath", "Demon", "warlock", "Diabolic Imp"},
[6] = {"warlock", "warlock", "infernalist", "Undead Dragon"},
[7] = {"Dark Torturer", "Undead Dragon", "Demon", "Demon"},
[8] = {"Juggernaut", "Betrayed Wraith", "Juggernaut", "warlock"},
[9] = {"Demon", "Juggernaut", "Blightwalker", "Juggernaut"},
[10] = {"Grim Reaper", "Demon", "Diabolic Imp", "Juggernaut"},
[11] = {"Juggernaut", "Juggernaut", "Juggernaut", "Juggernaut"}
}
local areaPosition =
{
{x=2189, y=2163, z=7, stackpos = 255},
{x=2217, y=2180, z=7, stackpos = 255}
}
local demonOak = {8288, 8289, 8290, 8291}
local storages =
{
done = 35700,
cutTree = 36901
}
local blockingTree =
{
[2709] = {32193, 3669}
}
local floorDamage =
{
min = 270,
max = 310
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
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 - Event::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.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Something is wrong, please contact a gamemaster.")
return true
end
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "You need level " .. level .. " or higher to enter in the quest area.")
return true
end
if getCreatureStorage(cid, storages.done) > 0 then
doPlayerSendCancel(cid, "You already done this quest.")
return true
end
if getCreatureStorage(cid, storages.cutTree) > 0 then return false end
if oneByQuest 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)
doCreatureSetStorage(cid, storages.cutTree, 1)
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 = 8288, 8291 do
if(getCreatureStorage(cid, i) == 12) then
k = k + 1
end
end
if(k == 4) then
doTeleportThing(cid, positions.kick)
doCreatureSetStorage(cid, storages.done, 1)
return true
end
if getCreatureStorage(cid, itemEx.itemid) > 11 then
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(math.random(100) == 1) then
doCreatureSetStorage(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)
doCreatureSetStorage(cid, itemEx.itemid, get + 1)
if math.random(100) >= 50 then
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -floorDamage.min, -floorDamage.max, CONST_ME_BIGPLANTS)
end
end
return false
end
end