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

TFS 0.X help (luaDoTeleportThing) Thing not found

miguelshta

Member
Joined
Mar 21, 2009
Messages
351
Solutions
1
Reaction score
13
Location
Toronto, Canada
im having this error on teleport script this is a mod script from team war ots
XML:
    -- Set Town & Position
                        doPlayerSetTown(cid, configTWH.mapStats[map.get()].templeIDs[playerTeam.get(cid)])
                        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
                        
                    -- // 2 = Quest Map (No-PvP?)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 2) then
                    
                    -- // 3 = Capture The Flag (Normal + Capture)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 3) then
                    
                    -- // 4 = Deathmatch (Player vs All)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 4) then       
                        --print("[Change-MapType] 4 = Deathmatch (Player vs All)")
                        
                        -- Set Town & Position
                        doPlayerSetTown(cid, math.random(configTWH.mapStats[map.get()].templeIDs[1], configTWH.mapStats[map.get()].templeIDs[2]))
                        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)



Code:
[Error - CreatureScript Interface]
buffer:onLogin
Description:
(luaDoTeleportThing) Thing not found
 
The "thing not found" errors says that the cid is not valid. Try to make some assertions before calling the doTeleportThing() and doPlayerSetTown(). Try to make some debug code to help you to track the error.

Something like this:
Lua:
if Player(cid) == nil then
    print('player is nil')
else
    doPlayerSetTown(cid, math.random(configTWH.mapStats[map.get()].templeIDs[1], configTWH.mapStats[map.get()].templeIDs[2]))
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
end

If the player is nil, it does not exists (yet). Your error gave the information that it is being called on player login (onLogin), maybe this script is running before it should. Check "cid" before the run of this script...
 
Player(cid) is for TFS 1.0+
for 0.X servers use isCreature(cid)
i need to change this?
XML:
                    -- Send Temple Atual
                    doPlayerSetTown(cid, configTWH.mapStats[map.get()].templeIDs[1])
                    
                    -- Teleport Templo
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
to what? i no understand because i dont have any line with player(cid) @Xikini sorry im very newbie at this still learning
 
i need to change this?
XML:
                    -- Send Temple Atual
                    doPlayerSetTown(cid, configTWH.mapStats[map.get()].templeIDs[1])
                   
                    -- Teleport Templo
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
to what? i no understand because i dont have any line with player(cid) @Xikini sorry im very newbie at this still learning
Hi! Great, you are learning so will write here some advices.

First of all, you need to understand what is happening. You must know what the functions that code are calling does. Do not simple copy-and-paste code from somewhere, things are not 100% compatible and is not why "it is working" that it will work on all conditions.

Given so, lets start by interpreting the error that you copied here:

[Error - CreatureScript Interface]
buffer: onLogin
Description:
(luaDoTeleportThing) Thing not found

The first lines are saying that it is on CreatureScript interface, maybe while player login (onLogin). The last lines are saying that the error is at function doTeleportThing(), and saying that the "Thing" was not found.
Go to the function declaration, you will se that it needs "cid" and it is the "Thing" that was not found.

My suggestion is to you write some code to understand what is wrong:

Lua:
                     -- Set Town & Position
                    
                        if isCreature(cid) == nil then
                            print('player is nil')
                        else
                            doPlayerSetTown(cid, configTWH.mapStats[map.get()].templeIDs[playerTeam.get(cid)])
                            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
                        end
                        
                    -- // 2 = Quest Map (No-PvP?)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 2) then
                    
                    -- // 3 = Capture The Flag (Normal + Capture)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 3) then
                    
                    -- // 4 = Deathmatch (Player vs All)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 4) then       
                        --print("[Change-MapType] 4 = Deathmatch (Player vs All)")
                        
                        -- Set Town & Position

                        if isCreature(cid) == nil then
                            print('player is nil')
                        else
                            doPlayerSetTown(cid, math.random(configTWH.mapStats[map.get()].templeIDs[1], configTWH.mapStats[map.get()].templeIDs[2]))
                            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
                        end

After running this, the problem will not be solved but you will have a clue on what should be wrong. Probably the creature does not exists. Go to the line of code that is calling your function and try to write some code on this to check.
 
Hi! Great, you are learning so will write here some advices.

First of all, you need to understand what is happening. You must know what the functions that code are calling does. Do not simple copy-and-paste code from somewhere, things are not 100% compatible and is not why "it is working" that it will work on all conditions.

Given so, lets start by interpreting the error that you copied here:



The first lines are saying that it is on CreatureScript interface, maybe while player login (onLogin). The last lines are saying that the error is at function doTeleportThing(), and saying that the "Thing" was not found.
Go to the function declaration, you will se that it needs "cid" and it is the "Thing" that was not found.

My suggestion is to you write some code to understand what is wrong:

Lua:
                     -- Set Town & Position
                   
                        if isCreature(cid) == nil then
                            print('player is nil')
                        else
                            doPlayerSetTown(cid, configTWH.mapStats[map.get()].templeIDs[playerTeam.get(cid)])
                            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
                        end
                       
                    -- // 2 = Quest Map (No-PvP?)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 2) then
                   
                    -- // 3 = Capture The Flag (Normal + Capture)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 3) then
                   
                    -- // 4 = Deathmatch (Player vs All)
                    elseif (configTWH.mapStats[map.get()].mapType[1] == 4) then      
                        --print("[Change-MapType] 4 = Deathmatch (Player vs All)")
                       
                        -- Set Town & Position

                        if isCreature(cid) == nil then
                            print('player is nil')
                        else
                            doPlayerSetTown(cid, math.random(configTWH.mapStats[map.get()].templeIDs[1], configTWH.mapStats[map.get()].templeIDs[2]))
                            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true, true)
                        end

After running this, the problem will not be solved but you will have a clue on what should be wrong. Probably the creature does not exists. Go to the line of code that is calling your function and try to write some code on this to check.
getting the same error without diference

C++:
[Error - CreatureScript Interface]
buffer:onLogin
Description:
(luaDoTeleportThing) Thing not found
> Broadcasted message: "Kshadowe: FEAR ME! I'm 150 LEVEL and I'm coming for you!".
Geeme has logged in.
 
Back
Top