Ok on request I made this, its in mod form and it has been tested with two different temples. Basically it picks a random Town ID from the config list and changes everyone above the access in config to that position and town. Great for war servers, but probably needs to be modified to fit two teams. Only supports all players atm.
Checks if random number is in array (so towns dont have to be in order and there can be gaps between towns...EX: 1,4,5)
Checks if the random number was the same as last time, and tries again if it is. So you never play the same town twice.
Enjoy, I tested and it works with 2 maps set, so it should work with all. This is just basic map switching, you need to put the messages and other stuff in yourself, or ill post a better version later. Enjoy, oh and btw it took alot to make syntax coloring in that code box, so better rep++ me ;p
\
Checks if random number is in array (so towns dont have to be in order and there can be gaps between towns...EX: 1,4,5)
Checks if the random number was the same as last time, and tries again if it is. So you never play the same town twice.
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} --townids to teleport to.
}
]]>[/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[
function onLogin(cid)
doPlayerSetTown(cid, getGlobalStorageValue(3454))
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"]"10" [/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(3454) and isInArray(config.temples, RDM)
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) < config.access 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) - getCreatureMana(pid)))
doRemoveConditions(pid, FALSE)
setGlobalStorageValue(3454, config.temples[RDM])
end
end
return true
end
]]>[/COLOR][COLOR="Blue"]</globalevent>
</mod>[/COLOR]
Enjoy, I tested and it works with 2 maps set, so it should work with all. This is just basic map switching, you need to put the messages and other stuff in yourself, or ill post a better version later. Enjoy, oh and btw it took alot to make syntax coloring in that code box, so better rep++ me ;p
\
Last edited: