• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Working Demon Oak Quest

READ -.-!

[05/03/2010 19:07:15] [Warning - Error:emon Oak] Dead tree position is inside the quest area positions.
 
I try to fix position.lua, but it don't work.
[18/03/2010 23:22:45] [Error - Action Interface]
[18/03/2010 23:22:45] data/actions/scripts/demonOak.lua:eek:nUse
[18/03/2010 23:22:45] Description:
[18/03/2010 23:22:45] data/lib/position.lua:2: attempt to index global 'pos' (a nil value)
[18/03/2010 23:22:45] stack traceback:
[18/03/2010 23:22:45] data/lib/position.lua:2: in function 'isInRange'
[18/03/2010 23:22:45] data/actions/scripts/demonOak.lua:54: in function <data/actions/scripts/demonOak.lua:1>

Help me please!
 
go to data/lib/position.lua

and change "isInRange(pos, fromPosition, toPosition)" to "isInRange(position, fromPosition, toPosition)"

It doesn't work with tfs 0.3.6, tried it already, it came like this:

[23/03/2010 15:46:46] [Error - Action Interface]
[23/03/2010 15:46:46] data/actions/scripts/doq/demonOak.lua:eek:nUse
[23/03/2010 15:46:46] Description:
[23/03/2010 15:46:46] data/lib/position.lua:2: attempt to index global 'pos' (a nil value)
[23/03/2010 15:46:46] stack traceback:
[23/03/2010 15:46:46] data/lib/position.lua:2: in function 'isInRange'
[23/03/2010 15:46:46] data/actions/scripts/doq/demonOak.lua:54: in function <data/actions/scripts/doq/demonOak.lua:1>
 
Where i replace it?

PHP:
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
 
Where i replace it?

PHP:
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

Change
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

To
Lua:
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
 
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
local position = {x=xxxxx, y=xxxxx, z=x} -- reward room
        if getPlayerStorageValue(cid, 35700) == 1 then
                doTeleportThing(cid, position)
                doSendMagicEffect(position, CONST_ME_TELEPORT)
        else
                return false
        end
        return true
end

fixed grave stone.,.
 
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
local position = {x=xxxxx, y=xxxxx, z=x} -- reward room
        if getPlayerStorageValue(cid, 35700) == 1 then
                doTeleportThing(cid, position)
                doSendMagicEffect(position, CONST_ME_TELEPORT)
        else
                return false
        end
        return true
end
fixed grave stone.,.
:huh:huh? it was bugged? works fine for me the original one
 
When I use the axe on the tree, the tree dissapear :S

Of course, and when you pass, the tree appears again.

@Tayron

That wans't bugged, with your edited script, you can pass to the reward room after you exit from the quest area, with my script, you need go to Oldrak, say hi, mission, yes and then you can pass to the reward room

With my script you need a confirmation from Oldrak, with your script not.
 
Back
Top