DESCRIPTION
Teleports all players that meet requirements to new temple, great for a pvpe server.
Tested on 0.4dev Private SVN (should work for latest public release)
Easy configuration
Uses new mod system for easy installation
Code:
[COLOR="Red"]<?[/COLOR][COLOR="Blue"]xml[/COLOR] [COLOR="red"]version[/COLOR]=[COLOR="DarkOrchid"]"1.0"[/COLOR] [COLOR="red"]encoding[/COLOR]=[COLOR="DarkOrchid"]"UTF-8"[/COLOR][COLOR="red"]?>[/COLOR]
[COLOR="blue"]<mod[/COLOR] [COLOR="red"]name[/COLOR]=[COLOR="DarkOrchid"]"Map Change"[/COLOR] [COLOR="red"]version[/COLOR]=[COLOR="DarkOrchid"]"2.0" [/COLOR][COLOR="red"]author[/COLOR]=[COLOR="DarkOrchid"]"Syntax"[/COLOR] [COLOR="red"]contact[/COLOR]=[COLOR="DarkOrchid"]"[email protected]"[/COLOR] [COLOR="red"]enabled[/COLOR]=[COLOR="DarkOrchid"]"yes"[/COLOR]>
[COLOR="blue"]<description>[/COLOR]
[B]This should teleport all players to a new random town in intervals.[/B]
[COLOR="blue"]</description>[/COLOR]
[COLOR="blue"]<config[/COLOR] [COLOR="Red"]name[/COLOR]=[COLOR="DarkOrchid"]"mapchange_config"[/COLOR][COLOR="blue"]>[/COLOR][COLOR="Orange"]<![CDATA[
config = {
access = 3, -- minimum access to bypass teleportation.
temples = {1,2,5,3}, -- townids to teleport to.
storage = 3454, -- number to store map status in.
changetime = 900 -- time to change in seconds (change in globalevents too)
}
]]>[/COLOR][COLOR="Blue"]</config>[/COLOR]
[COLOR="blue"] <event[/COLOR] [COLOR="Red"]type[/COLOR]=[COLOR="DarkOrchid"]"login"[/COLOR] [COLOR="red"]name[/COLOR]=[COLOR="DarkOrchid"]"Map Login" [/COLOR][COLOR="red"]event[/COLOR]=[COLOR="DarkOrchid"]"script"[/COLOR][COLOR="blue"]>[/COLOR][COLOR="Orange"]<![CDATA[
loadmodlib('mapchange_config')
function onLogin(cid)
doPlayerSetTown(cid, getGlobalStorageValue(config.storage))
doTeleportThing(cid, getPlayerMasterPos(cid))
return true
end
]]>[/COLOR][COLOR="blue"]</event>[/COLOR]
[COLOR="blue"]<globalevent[/COLOR] [COLOR="Red"]name[/COLOR]=[COLOR="DarkOrchid"]"Map Change" [/COLOR][COLOR="red"]interval[/COLOR]=[COLOR="DarkOrchid"]"900" [/COLOR][COLOR="red"]event[/COLOR]=[COLOR="DarkOrchid"]"script"[/COLOR][COLOR="blue"]>[/COLOR][COLOR="Orange"]<![CDATA[
domodlib('mapchange_config')
function onThink(interval, lastExecution, thinkInterval)
repeat
RDM = math.random(1,#config.temples)
until RDM ~= getGlobalStorageValue(config.storage) and isInArray(config.temples, RDM)
if getWorldCreatures(0) > 0 then
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) < config.access and getPlayerAccountManager(pid) == MANAGER_NONE then
doPlayerSetTown(pid, config.temples[RDM])
doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
doSendMagicEffect(getCreaturePosition(pid), 37)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
doRemoveConditions(pid, FALSE)
end
doBroadcastMessage("Round over. Map switched to " ..getTownName(config.temples[RDM]).. ".", MESSAGE_EVENT_ADVANCE)
setGlobalStorageValue(config.storage, config.temples[RDM])
end
else
print ("[MAP] No players online, aborting map change!")
end
return true
end
]]>[/COLOR][COLOR="Blue"]</globalevent>
</mod>[/COLOR]
Last edited: