• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

6 Errors wtf ? take a look

Wiw3K

New Member
Joined
Apr 16, 2008
Messages
371
Reaction score
3
these errors appear in console after i go to ghouls & die with AOL + BP ,

BTW MY AOL DOESNT DISSAPEAR , i dont know why :(

i am using TFS 0.3.2
LUA:
Test Char has logged out.

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaGetCreatureMaxMana(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaGetCreatureMaxHealth(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaDoCreatureAddHealth(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaDoCreatureAddMana(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaDoRemoveCondition(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaDoTeleportThing(). Thing not found
Test Char has logged in.
 
i bought aol in shop and died , same happen like before :(

what about the errors ? here is arena script:

LUA:
local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        addEvent(exitArena, 100, {cid=cid, exit=arena.exit})
    end
    return TRUE
end

function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return true
            end
        end
    end
    return FALSE
end


btw. when player die on ex. ghouls it is teleported to Arena.
 
Last edited:
The problem I can see with that script is the fact that it lets the player die, and then tries to execute the script which is meant to restore his HP and mana and shit, which of course does not work because he is already dead, and thus the server tries to alter the conditions of a player which doesnt exist, and thus errors.

Try the following script instead:

LUA:
  local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
	doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 100, {cid=cid, exit=arena.exit})
	return FALSE
    else
        return TRUE
    end
end

function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return TRUE
            end
        end
    end
    return FALSE
end
 
@up
ok ty but now char get teleported and it has 0 hp / 0 mana :O

---edit---
added return TRUE , and works but my player has 0 mana & there is a big delay between teleport then heal

---edit2---
ok i edited delay to 1 , should work all

---edit3---
now when i die on normal exp , player got healed + tped at arena :O!!

look script:
LUA:
  local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    return TRUE
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
                doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 1, {cid=cid, exit=arena.exit})
                return FALSE
    end
    return TRUE
end

function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return TRUE
            end
        end
    end
    return FALSE
end
 
Last edited:
Okay, lets try it again, this time with a little less local and a bit more global.

LUA:
arenacoords = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arenacoords.frompos, arenacoords.topos) then
        doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 100, {cid=cid, exit=arenacoords.exit})
        return FALSE
    else
        return TRUE
    end
end

function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return TRUE
            end
        end
    end
    return FALSE
end
 
look again my post, i edited it.
@up
ok ty but now char get teleported and it has 0 hp / 0 mana :O

---edit---
added return TRUE , and works but my player has 0 mana & there is a big delay between teleport then heal

---edit2---
ok i edited delay to 1 , should work all

---edit3---
now when i die on normal exp , player got healed + tped at arena :O!!

look script:
LUA:
  local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    return TRUE
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
                doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 1, {cid=cid, exit=arena.exit})
                return FALSE
    end
    return TRUE
end

function isInArea(pos, fromPos, toPos)
    if pos.x >= fromPos.x and pos.x <= toPos.x then
        if pos.y >= fromPos.y and pos.y <= toPos.y then
            if pos.z >= fromPos.z and pos.z <= toPos.z then
                return TRUE
            end
        end
    end
    return FALSE
end
 
Last edited:
Well I assume that the function for "Is player in this area?" always returns true for some reason... try this instead:

LUA:
local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    return TRUE
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 1, {cid=cid, exit=arena.exit})
        return FALSE
    else
        return TRUE
	end
end


It uses the servers native check-position function. See if it helps against the problem with getting teleported even when not in arena.
 
Well I assume that the function for "Is player in this area?" always returns true for some reason... try this instead:

LUA:
local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)

    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    return TRUE
end

function onPrepareDeath(cid, killer)
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 1, {cid=cid, exit=arena.exit})
        return FALSE
    else
        return TRUE
	end
end


It uses the servers native check-position function. See if it helps against the problem with getting teleported even when not in arena.
still teleport to pvp arena exit.
 
i know , you mean this so if is in arena , return FALSE so it doesn't cancel , return TRUE is because if isn't in arena so it mean DO NOTHING or something xP
LUA:
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        return FALSE
    else
        return TRUE
 
i know , you mean this so if is in arena , return FALSE so it doesn't cancel , return TRUE is because if isn't in arena so it mean DO NOTHING or something xP
LUA:
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        return FALSE
    else
        return TRUE

Well basically it means "If player is not in arena, he shall die normally. If he is in arena then he shall not die but rather get teleported to the arena exit."

But in this case it seems to always return "Player is in arena" even when he is not in the arena, which is weird.
 
we can add another check , take a look at this
LUA:
local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)
    if isInArea(getPlayerPosition(p.cid), arena.frompos, arena.topos) then
    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    return TRUE
    else
    return FALSE
   end
end
 
Well uh... using return in exitArena wont matter since its not returning the value to anything.

But yeah you could try that, see if it changes anything.
 
tried and got this
LUA:
Lua Script Error: [CreatureScript Interface] 
in a timer event called from: 
data/creaturescripts/scripts/arena.lua:onPrepareDeath

data/lib/function.lua:262: attempt to index local 'pos' (a number value)
stack traceback:
	data/lib/function.lua:262: in function 'isInArea'
	data/creaturescripts/scripts/arena.lua:9: in function <data/creaturescripts/scripts/arena.lua:7>

Lua Script Error: [CreatureScript Interface] 
in a timer event called from: 
data/creaturescripts/scripts/arena.lua:onPrepareDeath

luaGetCreaturePosition(). Creature not found

-edit-
wait i forgot to change cid to p.cid let me try again

-edit2-
ok no error but same as without this check DAM

anyone help , no one can play server until i fix it :(
 
Last edited:
You must make when entering arena - storage add, when leaving, remove storage..
woooow i forgot about this xD thanks , look what i did:

- Made script for Enter arena tp that adds a storage value.
- Made script for Exit from arena that removes the storage value.
- Add check into function onPrepareDeath to check if there is storage value.
- removing storage after teleport :P

can you check my scripts, i dont know where these "end" 's should be xD

btw. i am 99% sure TP's are working correctly ;) if you dont want , check just arena.lua

Arena Exit TP:
LUA:
local exit = { x = 169, y = 668, z = 6 }

function onStepIn(cid, item, pos)
	ACTION_ID = 11337

	if (item.actionid == 11337) then
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'You have left Arena!')
    		doRemoveCondition(cid, CONDITION_INFIGHT)
		doTeleportThing(cid, {x=169, y=668, z=6})
    		doSendMagicEffect(exit, 10)
		setPlayerStorageValue(cid, 74859, 0)
	        else
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'You have left Arena!')
    		doRemoveCondition(cid, CONDITION_INFIGHT)
		doTeleportThing(cid, {x=169, y=668, z=6})
    		doSendMagicEffect(cid.exit, 10)
		setPlayerStorageValue(cid, 74859, 0)
	end
end

Arena Enter TP:
LUA:
function onStepIn(cid, item, pos)
	if (item.actionid == 11387) then
		doTeleportThing(cid, {x=172, y=661, z=7})
		setPlayerStorageValue(cid, 74859, 1)
	        else
		doTeleportThing(cid, {x=172, y=661, z=7})
		setPlayerStorageValue(cid, 74859, 1)
	end
end

Arena.lua in Creaturescripts:
LUA:
  local arena = {
  frompos = { x = 168, y = 657, z = 7 },
  topos = { x = 177, y = 666, z = 7 },
  exit = { x = 169, y = 668, z = 6 }
}

local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid)  * 0.8)
  if isInArea(getPlayerPosition(p.cid), arena.frompos, arena.topos) then
    doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
    doCreatureAddMana(p.cid, -mana)
    doRemoveCondition(p.cid, CONDITION_INFIGHT)
    doSendMagicEffect(p.exit, 10)
    doTeleportThing(p.cid, p.exit, FALSE)
    setPlayerStorageValue(cid, 74859, 0)
     return TRUE
   else
   return FALSE
  end
end

function onPrepareDeath(cid, killer)
arenastatus = getPlayerStorageValue(cid,74859)
if arenastatus == -1 then
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
        doCreatureAddHealth(cid, 1)
        addEvent(exitArena, 1, {cid=cid, exit=arena.exit})
        return FALSE
    else
        return TRUE
        end
   end 
end
 
Back
Top