Hello, I need to create a very simple teleport when using this mechanism it should take me in a marked square, I have tried to do it by myself many times, but it doesn't work.
useful information:
I have script like this:
useful information:
- mechanism id - 8616
- action id - 60000
- target position - x = 423, y = 198, z = 5
I have script like this:
Lua:
local gatemechanism = {
[60000] = {pos = {x = 423, y = 198, z = 5}}
}
local gatemechanism = Action()
function gatemechanism.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if(gatemechanism[item.uid]) then
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:teleportTo(gatemechanism[item.uid].pos)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
return true
end
gatemechanism:id(8616)
gatemechanism:register()