• 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!

Teleport position

Status
Not open for further replies.

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
I want edit that script, to change position every 30 minutes to the next position, if it possible change to town id every 30 minutes...

(I have 7 differents positions or town id) Like as change map but with one temple and only change the teleport position

This is possible?
Code:
<globalevent name="teleportime" interval="10800" event="script" value="teleportime.lua"/>
Code:
-- Script creado por Juanzi Spada, [email protected]
function onThink(interval, lastExecution, thinkInterval)
    local itemdid = 1387
    local seg = 600 -- 10 minutos, estara el teleport abierto --
    local createpos = {x=posx, y=posy, z=posz} -- posision donde se teletransportaran los players --
    local topos = {x=posx, y=posy, z=posz} -- posision donde aparecera el teleport --
    doCreateTeleport(itemid, topos, createpos)
    doSendMagicEffect (topos, (31))
    function removeTp(tp)
        local t = getTileItemById(topos, itemid)
        if t then
            doRemoveItem(t.uid, 1)
            doSendMagicEffect((topos, (1))
        end
    end
    addEvent(removeTp, seg * 1000, tp)
    return true
end
 
LUA:
local towns = {1, 2, 4, 5}
local tp = {
		id = 1387,
		position = {x = POS_X, y = POS_Y, z = POS_Z}
}

-- 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])
	
	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
 
AMAZING! Thank you (i dont test)
its possible combine some features of changemap?

I want that because i only want use one temple in my war ot...

I use that to login
function onLogin(cid)
local temple = { x = 1563, y = 525, z = 6 }
doTeleportThing(cid, temple)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
return true
end

I need when teleport change the position teleport all players to local temple = { x = 1563, y = 525, z = 6 }
remove PZ
add max mana, add max health and broadcast
"All players have been teleported to the temple and map will be changed again in 30 minutes."


script work fine, but I need edit with that feature. whats wrong with that?

Code:
local temple = { x = 986, y = 1116, z = 6 }
local towns = {1, 2, 3, 4, 5, 6}
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])
 
	currentTown = currentTown + 1
	if not(towns[currentTown]) then
		currentTown = 1
	end
 
	removeTp(tp.position, tp.id)
    doCreateTeleport(tp.id, toPos, tp.position)
	doTeleportThing(cid, temple)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)  
	doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
    doCreatureAddMana(pid, getCreatureMaxMana(pid))
	doRemoveConditions(pid, true)
	return true
end
 
Last edited:
Status
Not open for further replies.
Back
Top