Ghazer
Member
- Joined
- Mar 13, 2009
- Messages
- 350
- Reaction score
- 6
This is change map of Summ (I think the best changemap) but have one problem when actionid of tile position temple (1,2,3,4) is changed causes problems and does not work good.
I think the problem is here but idk, its possible to fix?
LUA:
local towns = {7, 5, 4, 2, 6, 3, 1}
local tp = {
id = 1387,
position = {x = 986, y = 1118, z = 6}
}
-- Do not change
local currentTown = 1
local function removeTp(pos, id)
local thing = getTileItemById(pos, id)
if thing.uid > 0 then
doRemoveItem(thing.uid)
end
end
function onThink(interval, lastExecution, thinkInterval)
local toPos = getTownTemplePosition(towns[currentTown])
for _, pid in ipairs(getPlayersOnline()) do
local temple = { x = 986, y = 1116, z = 6 }
doTeleportThing(pid, temple)
doRemoveConditions(pid)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
doBroadcastMessage("The map has been changed and all players have been teleported to the temple. Next map change will be in: 30 minutes!", MESSAGE_STATUS_WARNING)
end
currentTown = currentTown + 1
if not(towns[currentTown]) then
currentTown = 1
end
removeTp(tp.position, tp.id)
doCreateTeleport(tp.id, toPos, tp.position)
return true
end
I think the problem is here but idk, its possible to fix?
LUA:
-- Do not change
local currentTown = 1
local function removeTp(pos, id)
local thing = getTileItemById(pos, id)
if thing.uid > 0 then
doRemoveItem(thing.uid)
end
end