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

[MOD]Change Map [Help]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
Why does this script don't works? Can someone fix this script?
Is possible add this 2 minutes before change?
XML:
doBroadcastMessage('The map will change in 2 minutes.')

XML:
<?xml version="1.0" encoding="UTF-8"?>  
<mod name="ChangeMap" version="1.0" author="LucasOlzon" contact="otland.net" enabled="yes">  
<config name="map_func"><![CDATA[  
 
                      info = {   
                        [0] = {x=160,y=54,z=7},   
                        [1] = {x=205,y=30,z=6},   
                        [2] = {x=1102,y=1001,z=7}  
                        } 
                        storage = 34544  
 
]]></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="1500000" event="script"><![CDATA[  
        domodlib('map_func')  
        function onThink(interval, lastExecution)  
                doBroadcastMessage('The map will change again in 25 minutes.')
                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>
 
use this one
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Map Change" version="2.0" author="Syntax" contact="[email protected]" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals.
   </description>
	<config name="mapchange_config"><![CDATA[
		config = {
        	access = 3, -- 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="60" 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 2 minutes! have a nice fight!", MESSAGE_STATUS_WARNING)
						setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
		return true
		end
]]></globalevent>
	
</mod>
 
ERROR:
i37420_imagem.jpg


Is possible add this 2 minutes before change?
XML:
doBroadcastMessage('The map will change in 2 minutes.')
 
Last edited:
Back
Top