• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action HOTA Diptrah switches

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,681
Solutions
126
Reaction score
1,119
Location
Germany
GitHub
slawkens
Its used in global tibia in HOTA Quest - Diptrah part.
It works that player must switch all switches and teleport will be opened(;D)

Screen from HOTA: (It not means that you must use same map! :p)
hotau.jpg


Create new file:
actions/scripts/hota_switches.lua
Code:
local config = {
	timeLimit = 500, -- in seconds, limit to check all switches
	teleport = {
		time = 1000 * 60 * 10, -- time to auto remove teleport
		pos = {x = 656, y = 311, z = 13}, -- where teleport will be created
		toPos = {x = 656, y = 310, z = 14} -- where teleport will be teleporting
	},

	switches = { --UIDs of switches
		6551,
		6552,
		6553,
		6554,
		6555,
		6556,
		6557,
		6558,
		6559,
		6560,
		6561
	},

	effect = {
		show = "no",
		text = "Gogogo!",
		magicEffect = 19
	}
}

config.effect.show = getBooleanFromString(config.effect.show)
local switchStates = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		doTransformItem(item.uid, 1945)
		table.remove(switchStates, item.uid)
		return TRUE
	end

	if(getTileItemById(config.teleport.pos, 1387).itemid ~= 0) then
		doPlayerSendCancel(cid, "Teleport is already open!")
		return TRUE
	end

	switchStates[item.uid] = 1
	if(table.maxn(switchStates) == #config.switches) then
		if(config.effect.show) then
			for _, uid in pairs(config.switches) do
				local pos = getThingPos(uid)
				doSendMagicEffect(pos, config.effect.magicEffect)
				doSendAnimatedText(pos, "Gogogo!", cid)
			end
		end

		switchStates = {}
		doCreateTeleport(1387, config.teleport.toPos, config.teleport.pos)
		addEvent(autoRemoveTeleport, config.teleport.time)
	end

	doTransformItem(item.uid, 1946)
	return TRUE
end

local function autoRemoveTeleport()
	local teleport = getTileItemById(config.teleport.pos, 1387).uid
	if(teleport ~= 0) then
		doRemoveItem(teleport)
	end
end

Add in:
actions/actions.xml

Code:
<action fromuid="6551" touid="6561" script="hota_switches.lua"/>

Now you must create 11 switches on map (You can change amount of course!) Set them uid in map editor from 6551 to 6561. Set proper teleport position, and test it! :)
 
Last edited:
I have this error
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/HOTA/hota_switches.lua)
data/actions/scripts/HOTA/hota_switches.lua:3: '}' expected (to close '{' at line 1) near 'teleport'
 
Slawkens, can you please upload this TUMBA, and please upload to the new place player after teleport? :D

thank rep++ :D
 
For me this script is not correctly typed in all of the levers as it should be changed or items such as should be, but when you move the lever to the right of all teleport to no shows. I have a 3884 rev, you know what could be wrong?
 

Similar threads

Back
Top