• 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 1.2 TP to Waypoint.

Saper1995

Technologic
Joined
Jul 11, 2009
Messages
104
Reaction score
3
Location
Poland
Hi, i'm trying to make talkaction command /goto waypoint like in old tfs version and i have a problem couse nothing happend.


Code:
function onSay(player, words, param)
    local target = Creature(param)
    local waypoint = getWaypointPositionByName(param)
    
    if not player:getGroup():getAccess() then
        return true
    end
    
    if target == nil then
        player:sendCancelMessage("Creature not found.")
        return false
    else
    player:teleportTo(target:getPosition())
    return true
    end
    if waypoint == nil then
        player:sendCancelMessage("Waypoint not found.")
        return false
    else
    player:teleportTo(waypoint:getPosition())
    return true
    end
    end

Code:
<talkaction words="/goto" separator=" " script="tpto.lua" />
 
I know but this is what i got when i use it.
Code:
attempt to call global 'getWaypointPosition' (a nil value)
stack traceback:
        [C]: in function 'getWaypointPosition'
        data/talkactions/scripts/tpto.lua:3: in function <data/talkactions/scripts/tpto.lua:1>
 
Yeah i was trying this too. When i use that function instead getWaypointPositionByName(param) then i get cancel message ingame with "Creature not found.". Why not "Waypoint not found."?

Looks like script doesn't read line 'local waypoint'. There is a problem in the syntax?
 
Code:
function onSay(player, words, param)
    local target = Creature(param)
    local waypoint = getWaypointPositionByName(param)
  
    if not player:getGroup():getAccess() then
        return true
    end
  
    if target == nil then
        player:sendCancelMessage("Creature not found.")
        return false
    else
        player:teleportTo(target:getPosition())
    end
    if waypoint == nil then
        player:sendCancelMessage("Waypoint not found.")
        return false
    else
        player:teleportTo(waypoint)
    end
    return true
end
you were using :getPosition() which is a creature method
 
Still this same. Now when i try /goto "monster" i get this


Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/tpto.lua:onSay
attempt to index a boolean value
stack traceback:
        [C]: at 0x7ff6a01a6bf0
        [C]: in function 'teleportTo'
        data/talkactions/scripts/tpto.lua:19: in function <data/talkactions/scripts/tpto.lua:1>
 
Code:
function onSay(player, words, param)
   local target = Creature(param)
    local waypoint = getWaypointPositionByName(param)
 
    if not player:getGroup():getAccess() then
        return true
    end
 
    if not target then
        player:sendCancelMessage("Creature not found.")
        return false
    else
        player:teleportTo(target:getPosition())
    end
    if not waypoint then
        player:sendCancelMessage("Waypoint not found.")
        return false
    else
        player:teleportTo(waypoint)
    end
    return true
end
 
Now i don't have any errors in console but still doesn't work. And yes i have a "test" waypoint in my map editor :p

2j4wp4g_th.jpg
 
Code:
function onSay(player, words, param)
    local target = Creature(param)
    local waypoint = getWaypointPositionByName(param)

    if not player:getGroup():getAccess() then
        return true
    end

    if target then
        player:teleportTo(target:getPosition())
    elseif waypoint then
        player:teleportTo(waypoint)
    end
    return true
end
try this i guess
 
Back
Top