• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

How to make special tp?

Figaro

Banned User
Joined
Jun 25, 2008
Messages
275
Reaction score
0
Location
696E 2079 6F75 7220 6265 64
How to make this? Every 1 hour tp comes to pos 100 100 7 as example, it stays there 5min and then it goes away. And again in next hour it comes there. Hope soembody can help.
 
in globalevents.xml:
PHP:
<globalevent name="specialTP" interval="3600" event="script" value="specialTP.lua"/>
in specialTP.lua:
PHP:
tpPos = {x=100, y=100, z=7}
tpToPos = {x=200, y=200, z=7}
tpItemID = 1387
tpDisappearTime = 5 * 60 -- 5 * 60 = 5 minutes

function onThink(interval, lastExecution)
	local tp_uid = doCreateTeleport(tpItemID, tpToPos, tpPos)
	addEvent(doRemoveItem, tpDisappearTime * 1000, tp_uid)
	return TRUE
end
First try it with lower values (like 1 min/10 seconds). If TP doesn't disappear after time try this script:
PHP:
tpPos = {x=100, y=100, z=7}
tpToPos = {x=200, y=200, z=7}
tpItemID = 1387
tpDisappearTime = 5 * 60 -- 5 * 60 = 5 minutes

function doRemoveSpecialTP()
	local tp_item = getTileItemByType(tpPos, ITEM_TYPE_TELEPORT)
	if tp_item.uid > 0 then
		doRemoveItem(tp_item.uid)
	end
end

function onThink(interval, lastExecution)
	local tp_uid = doCreateTeleport(tpItemID, tpToPos, tpPos)
	addEvent(doRemoveSpecialTP, tpDisappearTime * 1000)
	return TRUE
end
 
Everything is working exept this when teleport should go away :S
Code:
[07/06/2009 19:15:33] Lua Script Error: [GlobalEvent Interface] 
[07/06/2009 19:15:33] in a timer event called from: 
[07/06/2009 19:15:33] data/globalevents/scripts/openbattletp.lua:onThink

[07/06/2009 19:15:33] luaDoRemoveItem(). Item not found
 
Last edited:
Back
Top