Hello i am requesting a script that if you have 10 X items you can activate the lever to create a teleport that will send you to a location. after 60 seconds the teleport will disappear thanks!!!!
TFS 1.3
local config = {
req_item = {2148, 10}, -- Required item and count
portal_from = {x = 1000, y = 1000, z = 7}, -- Where portal will spawn
portal_to = {x = 1000, y = 1000, z = 7}, -- Where portals destination is
duration = 60 -- How long portal will exist in seconds
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1946 then
return false
end
if player:getItemCount(config.req_item[1]) < config.req_item[2] then
return player:sendCancelMessage("You do not have enough of the required item.")
end
local portal_uid = doCreateTeleport(1387, config.portal_to, config.portal_from)
if not portal_uid then
print("ERROR: Portal cannot be created on position.")
return false
end
-- player:removeItem(config.req_item[1], config.req_item[2])
item:transform(1946)
addEvent(function()
local portal, lever = Tile(config.portal_from):getItemById(1387), Item(item.uid)
if portal and lever then
portal:remove()
lever:transform(1945)
end
end, config.duration * 1000)
return true
end
Hello my friend, i'm not the author but i'm using your code and i get this error, can u help me?If you want to have the required item removed when you pull the lever just remove the -- on line 23.
I also replied to another one of your threads in request board a few days ago and I'm curious if it worked or not. Let me know.
LUA:local config = { req_item = {2148, 10}, -- Required item and count portal_from = {x = 1000, y = 1000, z = 7}, -- Where portal will spawn portal_to = {x = 1000, y = 1000, z = 7}, -- Where portals destination is duration = 60 -- How long portal will exist in seconds } function onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 1946 then return false end if player:getItemCount(config.req_item[1]) < config.req_item[2] then return player:sendCancelMessage("You do not have enough of the required item.") end local portal_uid = doCreateTeleport(1387, config.portal_to, config.portal_from) if not portal_uid then print("ERROR: Portal cannot be created on position.") return false end -- player:removeItem(config.req_item[1], config.req_item[2]) item:transform(1946) addEvent(function() local portal, lever = Tile(config.portal_from):getItemById(1387), Item(item.uid) if portal and lever then portal:remove() lever:transform(1945) end end, config.duration * 1000) return true end
[19/03/2022 22:32:20] [Error - Action Interface]
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.luanUse
[19/03/2022 22:32:20] Description:
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.lua:13: attempt to index local 'player' (a number value)
[19/03/2022 22:32:20] stack traceback:
[19/03/2022 22:32:20] data/actions/scripts/levers/genios1.lua:13: in function <data/actions/scripts/levers/genios1.lua:8>
You're using 0.3.6, but this script is for 1.0+, so there's no way for you to use it.Hello my friend, i'm not the author but i'm using your code and i get this error, can u help me?