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

[request] war script

arheon

Own3d PlAx.'?
Joined
Aug 31, 2009
Messages
92
Reaction score
3
hey guys i need a war script which every 3 hours broadcast 'Open Battle Event'
and it teleports ppl with town id 1 to north desert and ppl with town id 2 to south desert , after 20 minutes it teleports everyone back to their temple and it says 'Open Battle Event is Over'
im just too noob to make that my self ^,6
 
uff hard coding
I plan to do it later but in these days :(

nah... is so easy.. but NOT TESTED

Create a file in data/globalevents/scripts/ and paste this:
LUA:
function onThink(interval, lastExecution, thinkInterval)

local players = getPlayersOnline()
local temple = 0

local positions =
{
	{ x = 50, y = 50, z = 7 },
	{ x = 150, y = 150, z = 7}
}

	for _, cid in ipairs(players) do
		if getPlayerTownId(cid) == 1 then
			doTeleportThing(cid, positions[1])
			temple = 1
		elseif getPlayerTownId(cid) == 2 then
			doTeleportThing(cid, positions[2])
			temple = 2
		end
	addEvent(doTeleportThing, 1200 * 1000, cid, getTownTemplePosition(temple)) 
	end
	doBroadcastMessage("Open Battle Event.")
	return true
end

Paste this in data/globalevents/globalevents.xml
PHP:
	<globalevent name="OpenBattleEvent" interval="10800" event="script" value="SCRIPT_NAME.lua"/>
 
Last edited:
nah... is so easy.. but NOT TESTED

Create a file in data/globalevents/scripts/ and paste this:
LUA:
function onThink(interval, lastExecution, thinkInterval)

local players = getPlayersOnline()
local temple = 0

local positions =
{
	{ x = 50, y = 50, z = 7 },
	{ x = 150, y = 150, z = 7}
}

	for _, cid in ipairs(players) do
		if getPlayerTownId(cid) == 1 then
			doTeleportThing(cid, positions[1])
			temple = 1
		elseif getPlayerTownId(cid) == 2 then
			doTeleportThing(cid, positions[2])
			temple = 2
		end
	addEvent(doTeleportThing, 1200 * 1000, cid, getTownTemplePosition(temple)) 
	end
	doBroadcastMessage("Open Battle Event.")
	return true
end

Paste this in data/globalevents/globalevents.xml
PHP:
	<globalevent name="OpenBattleEvent" interval="10800" event="script" value="SCRIPT_NAME.lua"/>

Where is checking if player is still online when ending event? What if player die on battle event?
 
Back
Top