• 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!

Linux Debian TFS (0.3.4) scripts errors

hugol

Member
Joined
Apr 30, 2009
Messages
176
Reaction score
11
Hello,
when im launching my TFS 0.3.4 Linux version, I got these errors:

cityguard copied from orginal version 0.3.4
PHP:
luaGetCreatureSkullType(). Creature not found

Lua Script Error: [Npc interface] 
data/npc/scripts/cityguard.lua:onThink

data/npc/scripts/cityguard.lua:9: attempt to compare number with boolean
stack traceback:
	data/npc/scripts/cityguard.lua:9: in function 'isSkulled'
	data/npc/scripts/cityguard.lua:26: in function 'updateTarget'
	data/npc/scripts/cityguard.lua:71: in function <data/npc/scripts/cityguard.lua:70>

next error:
PHP:
Lua Script Error: [TalkAction Interface] 
data/talkactions/scripts/creature.lua:onSay

data/talkactions/scripts/creature.lua:10: attempt to compare boolean with number
stack traceback:
	data/talkactions/scripts/creature.lua:10: in function <data/talkactions/scripts/creature.lua:1>

also I have got errors in login.lua:
Result not found. ~

I have got all data files from TFS 0.3.3 Windows version, all was working on windows (including acc maker( gesior for 0.3 edited to 0.3.3 ), mysql database (edited to work with gesior acc maker)). Now I have got a lot of errors. I have edited files that they work on Unix system.
 
Show me cityguard.lua and creature.lua files. You have to know that every update many things are fixed so you should look into revision changed files to update your server properly.
 
I have used orginal cityguard from 0.3.4 source. Here is script

PHP:
local target = 0
local prevTarget = 0
local maxChaseDistance = 20
local origPos = 0
local lastAttack = 0
local followTimeout = 10

local function isSkulled(cid)
	if(getCreatureSkullType(cid) >= 3 and isPlayerPzLocked(cid) == TRUE) then
		return true
	end

	return false
end

local function goToOrigPos()
	target = 0
	lastAttack  = 0
	selfFollow(0)
	doTeleportThing(getNpcCid(), origPos)
end

local function updateTarget()
	if(isPlayer(target) == FALSE) then
		goToOrigPos()
	elseif(not isSkulled(target)) then
		selfSay("Now, behave in the future.")
		goToOrigPos()
	end

	if(target == 0) then
		local list = getSpectators(getNpcPos(), 9, 9, false)
		for i = 1, table.getn(list) do
			local _target = list[i]
			if(_target ~= 0) then
				if(isPlayer(_target) == TRUE and isSkulled(_target)) then
					if(getTilePzInfo(getCreaturePosition(_target)) == FALSE) then
						if(selfFollow(_target)) then
							target = _target
							if(target ~= prevTarget) then
								selfSay("We do not tolerate people like you here!")
							end

							prevTarget = target
							break
						end
					end
				end
			end
		end
	end
end

function onCreatureAppear(cid)
	if(cid == getNpcCid()) then
		origPos = getNpcPos()
	end
end

function onCreatureDisappear(cid)
	if(cid == target) then
		goToOrigPos()
	end
end

function onCreatureMove(creature, oldPos, newPos)
	--
end

function onThink()
	updateTarget()

	if(target == 0) then
		return
	end

	local playerPos = getCreaturePosition(target)
	local myPos = getNpcPos()

	if(myPos.z ~= playerPos.z) then
		goToOrigPos()
		return
	end

	if(math.abs(myPos.x - origPos.x) > maxChaseDistance or math.abs(myPos.y - origPos.y) > maxChaseDistance) then
		selfSay("I'll catch you next time.")
		goToOrigPos()
		return
	end

	if(lastAttack == 0) then
		lastAttack = os.clock()
	end

	if(os.clock() - lastAttack > followTimeout) then
		selfSay("You got me this time, but just wait.")
		goToOrigPos()
		return
	end

	if((math.abs(playerPos.x - myPos.x) <= 1) and (math.abs(playerPos.y - myPos.y) <= 1)) then
		doTargetCombatHealth(getNpcCid(), target, COMBAT_LIFEDRAIN, -200, -300, CONST_ME_BLOCKHIT)
		lastAttack = os.clock()
	end
end

creatures.lua

PHP:
function onSay(cid, words, param)
	local func = doCreateMonster
	if(words:sub(2, 2) == "n") then
		func = doCreateNpc
	end

	local position = getCreaturePosition(cid)
	local effect = CONST_ME_MAGIC_RED
	local ret = func(param, position, FALSE)
	if(ret <= LUA_NO_ERROR) then
		effect = CONST_ME_POFF
		doPlayerSendDefaultCancel(cid, (ret == LUA_ERROR and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
	end

	doSendMagicEffect(position, effect)
	return TRUE
end
 
also ladder is telporting to -1.
here is script
PHP:
local upFloorIds = {1386, 3678, 5543, 8599}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray(upFloorIds, item.itemid) == TRUE) then
		fromPosition.y = fromPosition.y + 1
		fromPosition.z = fromPosition.z - 1
	else
		fromPosition.z = fromPosition.z + 1
	end

	doTeleportThing(cid, fromPosition, FALSE)
	return TRUE
end


and moore moore actions doesnt work. Maybe it is something with compilation or ?
 
Last edited:
Back
Top