• 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]Team VS Team + Map Changer.

Bogart

...has super panda powers
Senator
Joined
Jun 21, 2009
Messages
8,007
Solutions
27
Reaction score
564
Location
Panda Land!
Hello and welcome to my thread.
First of all I'd like to give Syntax the credits for the Map changer.
Also, my script is based on Gatupojk's script.

Okay, questions:
Q:why this scripts sucks? you suck panda!
A:no, u.
Q:Why do you use isInRange?
A:Because maybe people would like to have events/games/hunt zones.
REMEMBER TO CHANGE THE INTERVAL @ LINE 93!
Since I am using 0.4, 1200000 = 1200 SECONDS = 20 MINUTES = 1/3 HOUR = lol.

how to install?

  • 1: Go to your_ot_folder
  • 2: open the folder called "mods"
  • 3: Paste the script below inside it.
  • 4: ??
  • 5: profit


Event by Login
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Team War" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals and add them into a team.
   </description>
	<config name="t"><![CDATA[
		t = {
			a = {
				[-1] = {
					a = "fagarians",
					b = 1000,
					c = "conditionRed"
				},
				[1] = {
					a = "homosexualsins",
					b = 1001,
					c = "conditionBlue"	
				},
			},
			b = 1000,
			c = 3,
			d = {1,2,3}
		}
		fromPosition = {x = 32000, y = 31600, z = 0} -- north west corner (remember using z= 0 coz players might be on a higher floor)
		toPosition = {x = 32600, y = 32700, z = 15} -- south east corner (remember using z= 15 coz players might be on a lower floor)
 ]]></config>
   <event type="login" name="tlog" event="script"><![CDATA[
domodlib('t')
local conditionBlue = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
function onLogin(cid)
registerCreatureEvent(cid, "tded")
registerCreatureEvent(cid, "tout")	
registerCreatureEvent(cid, "tcom")
local a = t.a[getGlobalStorageValue(3454)]
if getPlayerGroupId(cid) < 3 then
	if getGlobalStorageValue(t.b) == 1 then
		setGlobalStorageValue(t.b, -1)
		else
			setGlobalStorageValue(t.b, 1)
	end
	doPlayerSetTown(cid, getGlobalStorageValue(3454))
	doTeleportThing(cid, getGlobalStorageValue(3454))
	setPlayerStorageValue(cid, a.b, 1)
	doAddCondition(cid, a.c)
	doPlayerSendTextMessage(cid, 21, "You've joined the "..a.a)
end
return TRUE
end
]]></event>
<event type="logout" name="tout" event="script"><![CDATA[
domodlib('t')
function onLogout(cid)
    if getPlayerStorageValue(cid, t.a[-1].b) == 1 then
		setPlayerStorageValue(cid, t.a[-1].b, -1)
    	setGlobalStorageValue(t.b, 1)
             elseif getPlayerStorageValue(cid, t.a[1].b) == 1 then
		setPlayerStorageValue(cid, t.a[1].b, -1)
    	setGlobalStorageValue(t.b, -1)
    end
return true
end
]]></event>
   <event type="prepareDeath" name="tded" event="script"><![CDATA[
domodlib('t')
function onPrepareDeath(cid)
    if getPlayerStorageValue(cid, t.a[-1].b) == 1 then
		setPlayerStorageValue(cid, t.a[-1].b, -1)
    	setGlobalStorageValue(t.b, 1)
             elseif getPlayerStorageValue(cid, t.a[1].b) == 1 then
		setPlayerStorageValue(cid, t.a[1].b, -1)
    	setGlobalStorageValue(t.b, -1)
    end
return true
end
 
]]></event>
   <event type="combat" name="tcom" event="script"><![CDATA[
domodlib('t')
function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
	if getPlayerStorageValue(cid, t.a[-1].b) == 1 or getPlayerStorageValue(cid, t.a[1].b) == 1 then
		return doPlayerSendCancel(cid, "Sorry, you can not attack your own team") and false
	end
end
return TRUE
end
]]>></event>
<globalevent name="Map Change" interval="1200000" event="script"><![CDATA[
domodlib('t')
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 isInRange(getThingPosition(pid), fromPosition, toPosition) then
			doPlayerSetTown(pid, config.temples[RDM])
			doTeleportThing(pid, (getTownTemplePosition(config.temples[RDM])), false)				doRemoveCondition(pid, CONDITION_INFIGHT)
			doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
			doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
    			doBroadcastMessage("Map has been changed to "..getTownName(config.temples[RDM]).."! next map change will be in 20 minutes! have a nice fight!", MESSAGE_STATUS_WARNING)
			setGlobalStorageValue(3454, config.temples[RDM])
		end
	end
	return true	
end
]]></globalevent>	
</mod>

Event by "tile"
You must set a tile with an actionid of 8271 to get in the event, and one(inside the event map) with an actionid of 8272 to get out of the event
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Team War" version="1.0" author="Bogart" contact="otland.net" enabled="no">
   <description>
        This should teleport all players to a new random town in intervals and add them into a team.
   </description>
	<config name="config"><![CDATA[
	config = { 		
		t1 = "fagarians", -- red team(1) name
     		t2 = "homosexualsins", -- blue team(2) name
     		gstg = 7000, -- global storage
		tstg1 = 6666, --team 1 storage
		tstg2 = 6667, --team 2 storage
        	access = 3, -- minimum access to bypass teleportation.
		temples = {1,2,3} --townids to teleport to.
		}
		fromPosition = {x = 32000, y = 31600, z = 0} -- north west corner (remember using z= 0 coz players might be on a higher floor)
		toPosition = {x = 32600, y = 32700, z = 15} -- south east corner (remember using z= 15 coz players might be on a lower floor)
 ]]></config>
   <movevent type="StepIn" actionId ="8271" event="script"><![CDATA[
domodlib('config')
local conditionBlue = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
        setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
        addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
function onStepIn(cid, item, pos)
    if getPlayerGroupId(cid) < 3 then
       if getGlobalStorageValue(config.gstg) == 1 then
			doPlayerSetTown(cid, getGlobalStorageValue(3454))
			doTeleportThing(cid, getPlayerMasterPos(cid))
			setPlayerStorageValue(cid, config.tstg1, 1)
			doAddCondition(cid, conditionRed)
			doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t1.." so pew the shit out of the "..config.t2.."")
			setGlobalStorageValue(config.gstg, -1)
          			else
					doPlayerSetTown(cid, getGlobalStorageValue(3454)+2)
					doTeleportThing(cid, getPlayerMasterPos(cid))
					setPlayerStorageValue(cid, config.tstg2, 1)
					doAddCondition(cid, conditionBlue)
					doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t2.." so pew the shit out of the "..config.t1.."")
					setGlobalStorageValue(config.gstg, 1)
				end
			end
	return TRUE
end
]]></movevent>
   <event type="logout" name="tout" event="script"><![CDATA[
domodlib('config')
function onLogout(cid)
    if getPlayerStorageValue(cid, config.tstg1) == 1 then
	setPlayerStorageValue(cid, config.tstg1, 0)
    	setGlobalStorageValue(config.gstg, 1)
            	 elseif getPlayerStorageValue(cid, config.tstg2) == 1 then
				setPlayerStorageValue(cid, config.tstg1, 0)
				setGlobalStorageValue(config.gstg, -1)
			end
	return true
end
]]></event>
   <event type="login" name="register" event="script"><![CDATA[
domodlib('config')
function onLogin(cid)
	registerCreatureEvent(cid, "tded")
	registerCreatureEvent(cid, "tout")	
	registerCreatureEvent(cid, "tcom")
return true
end
]]></event>
<movevent type="StepIn" Actionid ="8272" event="script"><![CDATA[
domodlib('config')
function onStepIn(cid, item, pos)
    if getPlayerStorageValue(cid, config.tstg1) == 1 then
	setPlayerStorageValue(cid, config.tstg1, 0)
    	setGlobalStorageValue(config.gstg, 1)
             elseif getPlayerStorageValue(cid, config.tstg2) == 1 then
			setPlayerStorageValue(cid, config.tstg1, 0)
			setGlobalStorageValue(config.gstg, -1)
		end
	return true
end
]]></movevent>
<event type="prepareDeath" name="tded" event="script"><![CDATA[
domodlib('t')
function onPrepareDeath(cid)
    if getPlayerStorageValue(cid, t.a[-1].b) == 1 then
		setPlayerStorageValue(cid, t.a[-1].b, -1)
    	setGlobalStorageValue(t.b, 1)
             elseif getPlayerStorageValue(cid, t.a[1].b) == 1 then
		setPlayerStorageValue(cid, t.a[1].b, -1)
    	setGlobalStorageValue(t.b, -1)
    end
return true
end
]]></event>
   <event type="combat" name="tcom" event="script"><![CDATA[
domodlib('config')
function onCombat(cid, target)
local t = {
      		a = getPlayerStorageValue(cid, config.tstg1),
      		b = getPlayerStorageValue(cid, config.tstg2),
      		d = getPlayerStorageValue(target, config.tstg2),
      		f = getPlayerStorageValue(target, config.tstg1)
		}
    if isPlayer(cid) and isPlayer(target) then
        if t.a == 1 and t.f == 1 then
            return doPlayerSendCancel(cid, "You cant attack your team.") and false
				elseif t.b == 1 and t.d == 1 then
					return doPlayerSendCancel(cid, "You cant attack your team.") and false
				end
		end
    return true
end
]]>></event>
	<globalevent name="Map Change" interval="1200000" event="script"><![CDATA[
	domodlib('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 isInRange(getThingPosition(pid), fromPosition, toPosition) then
					doPlayerSetTown(pid, config.temples[RDM])
					doTeleportThing(pid, (getTownTemplePosition(config.temples[RDM])), false)
					doRemoveCondition(pid, CONDITION_INFIGHT)
					doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
					doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
    				doBroadcastMessage("Map has been changed to "..getTownName(config.temples[RDM]).."! next map change will be in 20 minutes! have a nice fight!", MESSAGE_STATUS_WARNING)
					setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
	return true
end
]]></globalevent>	
</mod>
 
Last edited:
This thread deserves a triforce!
1315335287230s.jpg

*▲
▲ ▲
amidoinitrite?
 
Good! You got it workiing, gj Panda, Hail Bambooo
 
Added event by stepping a tile :p
Not tested, but must work.
 
[1/10/2011 1:6:7] [Error - CreatureScript Interface]
[1/10/2011 1:6:7] domodlib('config')
[1/10/2011 1:6:7] local conditionBlue = createConditionObject(CONDITION_OUTFIT)
[1/10/2011 1:6:7] setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
[1/10/2011 1:6:7] addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
[1/10/2011 1:6:7] local conditionRed = createConditionObject(CONDITION_OUTFIT)
[1/10/2011 1:6:7] setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
[1/10/2011 1:6:7] addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
[1/10/2011 1:6:7] function onLogin(cid)
[1/10/2011 1:6:7] if getPlayerGroupId(cid) < 3 then
[1/10/2011 1:6:7] if getGlobalStorageValue(config.gstg) == 1 then
[1/10/2011 1:6:7] doPlayerSetTown(cid, getGlobalStorageValue(3454))
[1/10/2011 1:6:7] doTeleportThing(cid, getPlayerMasterPos(cid))
[1/10/2011 1:6:7] setPlayerStorageValue(cid, config.tstg1, 1)
[1/10/2011 1:6:7] doAddCondition(cid, conditionRed)
[1/10/2011 1:6:7] doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t1.." so pew the shit out of the "..config.t2.."")
[1/10/2011 1:6:7] setGlobalStorageValue(config.gstg, -1)
[1/10/2011 1:6:7] else
[1/10/2011 1:6:7] doPlayerSetTown(cid, getGlobalStorageValue(3454)+2)
[1/10/2011 1:6:7] doTeleportThing(cid, getPlayerMasterPos(cid))
[1/10/2011 1:6:7] setPlayerStorageValue(cid, config.tstg2, 1)
[1/10/2011 1:6:7] doAddCondition(cid, conditionBlue)
[1/10/2011 1:6:8] doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t2.." so pew the shit out of the "..config.t1.."")
[1/10/2011 1:6:8] setGlobalStorageValue(config.gstg, 1)
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] return TRUE
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] :eek:nLogin
[1/10/2011 1:6:8] Description:
[1/10/2011 1:6:8] [string "LuaInterface::loadBuffer"]:15: attempt to concatenate field 't2' (a nil value)
[1/10/2011 1:6:8] stack traceback:
[1/10/2011 1:6:8] [string "LuaInterface::loadBuffer"]:15: in function <[string "LuaInterface::loadBuffer"]:8>
 
[1/10/2011 1:6:7] [Error - CreatureScript Interface]
[1/10/2011 1:6:7] domodlib('config')
[1/10/2011 1:6:7] local conditionBlue = createConditionObject(CONDITION_OUTFIT)
[1/10/2011 1:6:7] setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
[1/10/2011 1:6:7] addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
[1/10/2011 1:6:7] local conditionRed = createConditionObject(CONDITION_OUTFIT)
[1/10/2011 1:6:7] setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
[1/10/2011 1:6:7] addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
[1/10/2011 1:6:7] function onLogin(cid)
[1/10/2011 1:6:7] if getPlayerGroupId(cid) < 3 then
[1/10/2011 1:6:7] if getGlobalStorageValue(config.gstg) == 1 then
[1/10/2011 1:6:7] doPlayerSetTown(cid, getGlobalStorageValue(3454))
[1/10/2011 1:6:7] doTeleportThing(cid, getPlayerMasterPos(cid))
[1/10/2011 1:6:7] setPlayerStorageValue(cid, config.tstg1, 1)
[1/10/2011 1:6:7] doAddCondition(cid, conditionRed)
[1/10/2011 1:6:7] doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t1.." so pew the shit out of the "..config.t2.."")
[1/10/2011 1:6:7] setGlobalStorageValue(config.gstg, -1)
[1/10/2011 1:6:7] else
[1/10/2011 1:6:7] doPlayerSetTown(cid, getGlobalStorageValue(3454)+2)
[1/10/2011 1:6:7] doTeleportThing(cid, getPlayerMasterPos(cid))
[1/10/2011 1:6:7] setPlayerStorageValue(cid, config.tstg2, 1)
[1/10/2011 1:6:7] doAddCondition(cid, conditionBlue)
[1/10/2011 1:6:8] doPlayerSendTextMessage(cid, 21, "You're going to fight for the "..config.t2.." so pew the shit out of the "..config.t1.."")
[1/10/2011 1:6:8] setGlobalStorageValue(config.gstg, 1)
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] return TRUE
[1/10/2011 1:6:8] end
[1/10/2011 1:6:8] :eek:nLogin
[1/10/2011 1:6:8] Description:
[1/10/2011 1:6:8] [string "LuaInterface::loadBuffer"]:15: attempt to concatenate field 't2' (a nil value)
[1/10/2011 1:6:8] stack traceback:
[1/10/2011 1:6:8] [string "LuaInterface::loadBuffer"]:15: in function <[string "LuaInterface::loadBuffer"]:8>
Try to copy it again.
It's weird since I do not get any error at all.
 
So, Bogart is this what Eldin was looking for? It's just a script that changes map and teleports you to a general temple?
 
So, Bogart is this what Eldin was looking for? It's just a script that changes map and teleports you to a general temple?

Eldin?
Yes, it changes map and telports you to a general temple.
It also adds you into a team.
 
Back
Top