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

How to add Actions

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
I have this script

Thanks to Summ
LUA:
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)
	return true
end

I want add that to script

when teleport change position:
Code:
function onThink(interval, lastExecution, thinkInterval)
      local temple = { x = 986, y = 1116, z = 6 }
	doTeleportThing(cid, temple)             [COLOR="#FF0000"]*TELEPORT TO LOCAL TEMPLE*[/COLOR]
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)         [COLOR="#FF0000"]*EFFECT TELEPORT*[/COLOR]
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the temple.") [COLOR="#FF0000"]*BROADCAST[/COLOR]*
        doRemoveConditions(pid, true)              [COLOR="#FF0000"]*Remove PZ*[/COLOR]
        doCreatureAddHealth(pid, getCreatureMaxHealth(pid))     [COLOR="#FF0000"] *ADD MAX HEALTH*[/COLOR]
        doCreatureAddMana(pid, getCreatureMaxMana(pid))      [COLOR="#FF0000"] *ADD MAX MANA*[/COLOR]

- - - Updated - - -

I creat that but teleport dont change position:

LUA:
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)
	return true
end

function onThink(interval, lastExecution)
        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("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
				end
				return true
end
 
Last edited:
LUA:
local towns = {1, 2, 3, 4, 5, 6}
local tp = {
local temple = { x = 986, y = 1116, z = 6 }
		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(pid, temple)
    doRemoveConditions(pid)
    doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
    doCreatureAddMana(pid, getCreatureMaxMana(pid))
    doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
	return true
end
 
LUA:
-- Change Map by Summ :P
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)
    for _, pid in pairs(getPlayersOnline()) do
        doTeleportThing(pid, temple)
        doSendMagicEffect(getThingPos(pid), CONST_ME_GIFT_WRAPS)
        doRemoveConditions(pid, true)
        doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
        doCreatureAddMana(pid, getCreatureMaxMana(pid)
    end

    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

@Loney
pid is not defined xD
 
Back
Top