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

MapChange

xLosT

Member
Joined
Jan 11, 2010
Messages
1,021
Reaction score
13
Location
Brasil, Rio Grande do Sul
while too much on player, and will change the map server
therefore falls can not play on many players sqm, wanted
that x seconds before switching desired for a warning and Kikas
change the map




<mod name="ChangeMap" version="1.0" author="Vodkart" contact="otserv.com" enabled="yes">
<config name="map_func"><![CDATA[

info = {
[0] = {x=692,y=848,z=7},
[1] = {x=413,y=804,z=7},
[2] = {x=517,y=603,z=7},
[3] = {x=552,y=226,z=7},
[3] = {x=197,y=731,z=7}
}
storage = 50555

]]></config>
<event type="login" name="Check Map" event="script"><![CDATA[
domodlib('map_func')
function onLogin(cid)
if getGlobalStorageValue(storage) == -1 then
setGlobalStorageValue(storage,getGlobalStorageValue(storage)+1)
end
doTeleportThing(cid,info[getGlobalStorageValue(storage)])
return true
end
]]></event>
<globalevent name="ChangeMap" interval="3200" event="script"><![CDATA[
domodlib('map_func')
function onThink(interval, lastExecution)
doBroadcastMessage('Proximo Mapa em 1h.')
if getGlobalStorageValue(storage) < #info then
setGlobalStorageValue(storage,getGlobalStorageValue(storage)+1)
else
setGlobalStorageValue(storage,getGlobalStorageValue(storage)-#info)
end
for _, pid in ipairs(getPlayersOnline()) do
doRemoveConditions(pid, true)
doTeleportThing(pid,info[getGlobalStorageValue(storage)])
end
return TRUE
end]]></globalevent>
</mod>
 
Last edited:
It's what he wants:
Warning: Map will change in 2min
2min after the warning everybody get kicked and positions updates to new city

This code is better
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Map Change" version="2.0" author="Sintax" contact="otland.net" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals.
   </description>
	<config name="mapchange_config"><![CDATA[
		config = {
        	access = 10, -- minimum access to bypass teleportation.
		temples = {1,2,3} --townids to teleport to.
		}
 ]]></config>
   <event type="login" name="Map Login" event="script"><![CDATA[
	function onLogin(cid)
		doPlayerSetTown(cid, getGlobalStorageValue(3454))
		doTeleportThing(cid, getPlayerMasterPos(cid))
	return true
	end
]]></event>
	<globalevent name="Map Change" interval="1500000" event="script"><![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 and
						doPlayerSetTown(pid, config.temples[RDM])
						doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
						doSendMagicEffect(getCreaturePosition(pid), 37)
						doRemoveCondition(pid, CONDITION_INFIGHT)
						doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
						doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
    						doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
						setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
		return true
		end
]]></globalevent>
 
</mod>
 
Back
Top