• 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.X+ Teleport on use object

czerwian

New Member
Joined
Oct 28, 2019
Messages
17
Reaction score
2
Hello guys. I want to make something like when player use stone coffin he will be teleported to x,y,z.
stonecoffin.png
How should I do it? Please help.
 
Last edited:
Solution
Hello guys. I want to make something like when player use stone coffin he will be teleported to x,y,z.
View attachment 47706
How should I do it? Please help.

Add 45001 as an actionid onto the coffin. (or whatever number you don't have in use)

data/actions/actions.xml
XML:
<action actionid="45001" script="custom_actions/teleport_coffin.lua" />
data/actions/scripts/custom_actions/teleport_coffin.lua
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:teleportTo(Position(xxxxx, yyyyy, zzz))
    return true
end
Hello guys. I want to make something like when player use stone coffin he will be teleported to x,y,z.
View attachment 47706
How should I do it? Please help.

Add 45001 as an actionid onto the coffin. (or whatever number you don't have in use)

data/actions/actions.xml
XML:
<action actionid="45001" script="custom_actions/teleport_coffin.lua" />
data/actions/scripts/custom_actions/teleport_coffin.lua
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:teleportTo(Position(xxxxx, yyyyy, zzz))
    return true
end
 
Last edited:
Solution
Add 45001 as an actionid onto the coffin. (or whatever number you don't have in use)

data/actions/actions.xml
XML:
<action actionid="45001" script="custom_actions/teleport_coffin.lua" />
data/actions/scripts/custom_actions/teleport_coffin.lua
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    creature:teleportTo(Position(xxxxx, yyyyy, zzz))
    return true
end
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:teleportTo(Position(xxxxx, yyyyy, zzz))
    return true
end
creature don't exist in scope rs
 
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:teleportTo(Position(xxxxx, yyyyy, zzz))
    return true
end
creature don't exist in scope rs
Ah oops. Lol
Copied it from source and forgot to change.
 
Back
Top