What's new

Demon Oak quest. Problem

Status
Not open for further replies.

Jogplayer

User
Joined
Mar 5, 2011
Messages
20
Reaction score
0
Mam problem gdy chce uzyc HALLOWED AXE na drzewie to nie znika i pojawia mi sie tkai komunikat w konsoli

[06/03/2011 17:39:37] [Error - Action Interface]
[06/03/2011 17:39:37] data/actions/scripts/quests/demonOak.lua:eek:nUse
[06/03/2011 17:39:37] Description:
[06/03/2011 17:39:37] data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
[06/03/2011 17:39:37] stack traceback:
[06/03/2011 17:39:37] data/lib/032-position.lua:2: in function 'isInRange'
[06/03/2011 17:39:37] data/actions/scripts/quests/demonOak.lua:70: in function <data/actions/scripts/quests/demonOak.lua:1>
 

rafixkka

Active User
Joined
Jul 11, 2010
Messages
93
Reaction score
7
Odp: Demon Oak quest. Problem

Jaki masz silnik?
 

Almero

Active User
Joined
Jun 12, 2009
Messages
108
Reaction score
18
Odp: Demon Oak quest. Problem

Pokaz skrypt lua :)
wtedy wiecej bedziemy co wstanie pom?c.
 
Last edited by a moderator:

Jogplayer

User
Joined
Mar 5, 2011
Messages
20
Reaction score
0
Odp: Demon Oak quest. Problem

demonOak.lua

function onUse(cid, item, fromPosition, itemEx, toPosition)
local onePerQuest = "yes"
local level = 120
local positions =
{
kick = { x = 32713, y = 32339, z = 7 },
summon =
{
{x=32713, y=32348, z=7},
{x=32720, y=32349, z=7},
{x=32720, y=32354, z=7},
{x=32711, y=32353, z=7}
}
}
local summons =
{
[1] = {"Demon", "Grim Reaper", "Elder Beholder", "Demon Skeleton"},
[2] = {"Dark Torturer", "Banshee", "Betrayed Wraith", "Blightwalker"},
[3] = {"Bonebeast", "Braindeath", "Diabolic Imp", "Giant Spider"},
[4] = {"Hand of Cursed Fate", "Lich", "Undead Dragon", "Vampire"},
[5] = {"braindeath", "Demon", "Bonebeast", "Diabolic Imp"},
[6] = {"Demon Skeleton", "Banshee", "Elder Beholder", "Bonebeast"},
[7] = {"Dark Torturer", "Undead Dragon", "Demon", "Demon"},
[8] = {"Elder Beholder", "Betrayed Wraith", "Demon Skeleton", "Giant Spider"},
[9] = {"Demon", "Banshee", "Blightwalker", "Demon Skeleton"},
[10] = {"Grim Reaper", "Demon", "Diabolic Imp", "Braindeath"},
[11] = {"Banshee", "Grim Reaper", "Hand of Cursed fate", "Demon"}
}
local areaPosition =
{
{x=32709, y=32345, z=7, stackpos = 255},
{x=32725, y=32355, z=7, stackpos = 255}
}
local demonOak = {8288, 8289, 8290, 8291}
local storages =
{
done = 35700,
cutTree = 36901
}
local blockingTree =
{
[2709] = {32193, 3669}
}
if blockingTree[itemEx.itemid] and itemEx.uid == blockingTree[itemEx.itemid][1] then
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "You need level " .. level .. " or more to enter this quest.")
return TRUE
end
if getPlayerStorageValue(cid, storages.done) > 0 then
doPlayerSendCancel(cid, "You already done this quest.")
return TRUE
end
if getPlayerStorageValue(cid, storages.cutTree) > 0 then
return FALSE
end
if onePerQuest == "yes" then
local players = getPlayersOnline()
for _, pid in ipairs(players) do
if isInRange(getCreaturePosition(pid), areaPosition[1], areaPosition[2]) then
doPlayerSendCancel(cid, "Wait until " .. getCreatureName(pid) .. " finish the quest.")
return TRUE
end
end
end
doTransformItem(itemEx.uid, blockingTree[itemEx.itemid][2])
doSendMagicEffect(toPosition, CONST_ME_POFF)
doMoveCreature(cid, SOUTH)
doPlayerSetStorageValue(cid, storages.cutTree, 1)
return TRUE
elseif isInArray(demonOak, itemEx.itemid) then
local get = getPlayerStorageValue(cid, itemEx.itemid)
if get == -1 then
get = 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) <= 10) then
doPlayerSetStorageValue(cid, itemEx.uid, 12)
return TRUE
end
if summons[get] then
for i = 1, #summons[get] do
doCreateMonster(summons[get], positions.summon)
end
doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
doPlayerSetStorageValue(cid, itemEx.itemid, get + 1)
if math.random(100) >= 50 then
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
end
return FALSE
end
end
 

Almero

Active User
Joined
Jun 12, 2009
Messages
108
Reaction score
18
Odp: Demon Oak quest. Problem

Jeszcze jakbys m?gl pokazac mi libsy 032-position.lua
 
Last edited by a moderator:

Jogplayer

User
Joined
Mar 5, 2011
Messages
20
Reaction score
0
Odp: Demon Oak quest. Problem

032-position.lua

function isInRange(pos, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

function getDistanceBetween(firstPosition, secondPosition)
local x, y = math.abs(firstPosition.x - secondPosition.x), math.abs(firstPosition.y - secondPosition.y)
local diff = math.max(x, y)
if(firstPosition.z ~= secondPosition.z) then
diff = diff + 9 + 6
end

return diff
end

function getDirectionTo(pos1, pos2)
local dir = NORTH
if(pos1.x > pos2.x) then
dir = WEST
if(pos1.y > pos2.y) then
dir = NORTHWEST
elseif(pos1.y < pos2.y) then
dir = SOUTHWEST
end
elseif(pos1.x < pos2.x) then
dir = EAST
if(pos1.y > pos2.y) then
dir = NORTHEAST
elseif(pos1.y < pos2.y) then
dir = SOUTHEAST
end
else
if(pos1.y > pos2.y) then
dir = NORTH
elseif(pos1.y < pos2.y) then
dir = SOUTH
end
end
return dir
end

function getCreatureLookPosition(cid)
return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end

function getPosByDir(fromPosition, direction, size)
local n = size or 1

local pos = fromPosition
if(direction == NORTH) then
pos.y = pos.y - n
elseif(direction == SOUTH) then
pos.y = pos.y + n
elseif(direction == WEST) then
pos.x = pos.x - n
elseif(direction == EAST) then
pos.x = pos.x + n
elseif(direction == NORTHWEST) then
pos.y = pos.y - n
pos.x = pos.x - n
elseif(direction == NORTHEAST) then
pos.y = pos.y - n
pos.x = pos.x + n
elseif(direction == SOUTHWEST) then
pos.y = pos.y + n
pos.x = pos.x - n
elseif(direction == SOUTHEAST) then
pos.y = pos.y + n
pos.x = pos.x + n
end

return pos
end

function doComparePositions(pos, posEx)
return pos.x == posEx.x and pos.y == posEx.y and pos.z == posEx.z
end

function getArea(pos, rangeX, rangeY)
local t = {}
for i = (pos.x - rangeX), (pos.x + rangeX) do
for j = (pos.y - rangeY), (pos.y + rangeY) do
table.insert(t, {x = i, y = j, z = pos.z})
end
end

return t
end
 

Almero

Active User
Joined
Jun 12, 2009
Messages
108
Reaction score
18
Odp: Demon Oak quest. Problem

Code:
function isInRange(position, fromPosition, toPosition)
	return position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z
end

function getDistanceBetween(fromPosition, toPosition)
	local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
	local diff = math.max(x, y)
	if(fromPosition.z ~= toPosition.z) then
		diff = diff + 9 + 6
	end

	return diff
end

function getDirectionTo(pos1, pos2)
	local dir = NORTH
	if(pos1.x > pos2.x) then
		dir = WEST
		if(pos1.y > pos2.y) then
			dir = NORTHWEST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHWEST
		end
	elseif(pos1.x < pos2.x) then
		dir = EAST
		if(pos1.y > pos2.y) then
			dir = NORTHEAST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHEAST
		end
	else
		if(pos1.y > pos2.y) then
			dir = NORTH
		elseif(pos1.y < pos2.y) then
			dir = SOUTH
		end
	end

	return dir
end

function getCreatureLookPosition(cid)
	return getPositionByDirection(getThingPosition(cid), getCreatureLookDirection(cid))
end

function getPositionByDirection(position, direction, size)
	local n = size or 1
	if(direction == NORTH) then
		position.y = position.y - n
	elseif(direction == SOUTH) then
		position.y = position.y + n
	elseif(direction == WEST) then
		position.x = position.x - n
	elseif(direction == EAST) then
		position.x = position.x + n
	elseif(direction == NORTHWEST) then
		position.y = position.y - n
		position.x = position.x - n
	elseif(direction == NORTHEAST) then
		position.y = position.y - n
		position.x = position.x + n
	elseif(direction == SOUTHWEST) then
		position.y = position.y + n
		position.x = position.x - n
	elseif(direction == SOUTHEAST) then
		position.y = position.y + n
		position.x = position.x + n
	end

	return position
end

function doComparePositions(position, positionEx)
	return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end

function getArea(position, x, y)
	local t = {}
	for i = (position.x - x), (position.x + x) do
		for j = (position.y - y), (position.y + y) do
			table.insert(t, {x = i, y = j, z = position.z})
		end
	end

	return t
end

function Position(x, y, z, stackpos)
	local position = {x = 0, y = 0, z = 0}
	if(isNumeric(x .. y .. z)) then
		position = {x = x, y = y, z = z}
		if(isNumeric(stackpos)) then
			position.stackpos = stackpos
		end
	end

	return position
end

podmien i deaj restart servera.

Notka moderatorska:
+1pkt OT Expert
 
Last edited by a moderator:
Status
Not open for further replies.
Top