xexam
New Member
- Joined
- Aug 3, 2010
- Messages
- 172
- Reaction score
- 2
Hello! It's my script
ancienthelmet.lua
its taken from this thread http://otland.net/f81/hota-diptrah-switches-37177/
actions.xml
but it isn't working, the teleport doesnt appear!
What's wrong?
ancienthelmet.lua
local config = {
timeLimit = 500, -- in seconds, limit to check all switches
teleport = {
time = 1000 * 60 * 10, -- time to auto remove teleport
pos = {x = 852, y = 1236, z = 7}, -- where teleport will be created
toPos = {x = 850, y = 1236, z = 7} -- where teleport will be teleporting
},
switches = { --UIDs of switches
6030,
6031,
6032,
6033,
},
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
its taken from this thread http://otland.net/f81/hota-diptrah-switches-37177/
actions.xml
<action fromuid="6030" touid="6033" event="script" value="ancienthelmet.lua"/>
but it isn't working, the teleport doesnt appear!
What's wrong?