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

Not really small raid example in the newest TFS 0.3 beta 1+!

Hermes

dziwki kola gramy w lola
Joined
Nov 17, 2007
Messages
1,867
Reaction score
14
Location
Poland
Hello!

As we all know that executeRaid() was not working in last two releases before beta 1. But now, it's fixed, but there is no raid example! WTF? So, I'm gonna teach you how to make simple raid and also with use of GlobalEvents.

First of all, make a raid file in /data/raids/raidname.xml, for example:
Code:
<raid>
<announce delay="0" type="event" message="First announce!" />

<singlespawn delay="2000" name="Demon" x="1008" y="1008" z="7" />

<announce delay="10000" type="event" message="Second announce!" />
<areaspawn delay="12000" fromx="980" fromy="960" fromz="7" tox="1048" toy="1024" toz="7">
<monster name="dragon lord" amount="10" />
<monster name="dragon lord hatchling" amount="10" />
</areaspawn>

</raid>

Now, look at delay. Delay it's the time FROM START OF RAID. So it isn't time from one event to second!

The announce lines should look like this:
Code:
<announce delay="0" type="event" message="First announce!" />

You can change message in message="MESSAGE"

NOTE! (for more advanced users!) There are several types of announcements, which causes text to appear in several message types:

warning (MSG_STATUS_WARNING)
event (MSG_EVENT_ADVANCE)
default (MSG_EVENT_DEFAULT)
description (MSG_INFO_DESCR)
status (MSG_STATUS_SMALL)
blue (MSG_STATUS_CONSOLE_BLUE)
red (MSG_STATUS_CONSOLE_RED)

for example,

Code:
<announce delay="0" type="blue" message="First announce!" />

will make message blue :p and etc.

Next lines are spawns. We have two types of spawns. Singlespawns, and areaspawns.

Singlespawn
makes one monster at one tile located by X= Y= Z=.

Code:
<singlespawn delay="2000" name="Demon" x="1008" y="1008" z="7" />

this line below should do the same as line up (macha do Elfa):

Code:
<singlespawn delay="2000" name="Demon" pos="1008;1008;7" />

So this line will spawn one demon, 2 seconds after launching raid on a tile with x=1008, y=1008 and z=7.


Areaspawn
makes amount="X" monsters of certain name in certain area located by fromX= fromY= fromZ= -> toX= toY= toZ=.

Code:
<areaspawn delay="12000" fromx="980" fromy="960" fromz="7" tox="1048" toy="1024" toz="7">
<monster name="dragon lord" amount="10" />
<monster name="dragon lord hatchling" amount="10" />
</areaspawn>

This will spawn 10 dragon lords and 10 dragon lord hatchlings in area on tiles from x=980 y=960 z=7 to x=1048 y=1024 and z=7 after reaching 12 seconds from raid's start.

NOTE! 1000 in delay means ONE SECOND!

NOTE! <areaspawn... must be closed with </areaspawn>! <singlespawn... mustn't!

Yea yea we pwnz roxor man etc... we have a raid file. What shall we make then? Let's add a line to /data/raids/raids.xml!

Code:
		<raid name="xx" file="xx.xml" interval2="120" margin="0"/>

Name it's the raid name used by executeRaid() command. File is the location of xml file that we've already made. I'm using xx.xml just for test purposes, so you should name previous file as xx.xml.

Interval2 and margin integers must be written, or server won't load raid.


Margin it's certain space of time after some other raid that stops raid that is being launched from launching. Yea, quite difficult.

So for example, there is Ferumbras raid. Okay, but after 10 minutes server is going to launch Orshabaal raid automatically. But Orshabaal raid has margin="3600" (1 hour) so it won't start. If server is going to launch raid that has margin="3600" after 1+hour after previous raid, the raid will be launched.

OMG, we have added raid in raids.xml! WOAH! Now we gonna make a little script which is using executeRaid() thingy to run our brand new shiny pwning raid :D!

Make a LUA file named xx_raid /data/actions/scripts/other/xx_raid.lua, and paste inside script:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doSendMagicEffect(fromPosition, CONST_ME_SOUND_GREEN)
	executeRaid("xx")
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Raid xx started.')
end

And ofc add a line to /data/actions/actions.xml:

Code:
	<action itemid="XXXX" script="other/xx_raid.lua"/>

NOTE! If some raid had launched, and you will try to start the same/other raid, it won't start, and it won't be any error. Just you can't start raid if other one is already started and not finished.

As XXXX put itemid of item which if used will launch our raid.

NOTE! this is just an example! you can put
Code:
	executeRaid("xx")
everywhere you want. In this way raids can be executed in every LUA script ingame. So you see, there is variety of possibilities.

Now log in, make item XXXX, and use it - VOILA! Raid XX started!

~~~~~~~~

Now something for more ambitious users. We will make raids launching automatically. Add a LUA script in /data/globalevents/scripts/xx_raid.lua and add inside:

Code:
function onThink(interval, lastExecution)
	executeRaid("xx")
	return TRUE
end

Then in /data/globalevents/globalevents.xml add a line:

Code:
	<globalevent name="xx_raid" interval="7200" script="xx_raid.lua"/>

interval="value" means that raid will be executed every value seconds. 7200 value means that this raid will be executed every 2 hours.

~~~~~~~~

There is also second way to run a raid from globalevents (macha do Elfa :D). Line below ofc you have to add to /data/globalevents/globalevents.xml:

Code:
<raid name="xx" file="xx.xml" interval2="120" margin="0" enabled="0"/>

NOTE! If you put 0 as value of interval2, server will crash. I've written in bug thread to make if value is zero, raid won't launch.


There is also some way to execute random raids for certain ammount of time with configurable chance (based on idea by Simonel).

Add this line to /globalevents/globalevents.xml
Code:
<globalevent name="raids" interval="7200" script="raids.lua"/>

Then in /globalevents/scripts/ make file raids.lua, and paste inside:
Code:
function onThink(interval, lastExecution)
local raids = {"Raid name1", "Raid name2", "Raid name3", "Raid name4", "Raid name5"}
local number = math.random(1, 4)
	if number == 1 then
		executeRaid(raids[math.random(1,#raids)])
	end
return TRUE
end

I have modified Simonel's script to make this more randomized. So every two hours there will be 25% chance that one of the raids in list will be executed.

And that's all! Thanks for reading!

Regards,
Hermes


PS. Sorry for all mistakes, I was writing it really fast cuz I have an important meeting in some minutes, but I wanted to teach you how to make simple raids.
PS2. Tested, works perfect with 0.3 beta 1.
PS3. Fixed 80% of grammar errors etc. (I'm polish and I'm learning english, so sorry for all those stupid mistakes. Nobody is perfect :D)

LOOK HERE IF YOU HAVE PROBLEMS WITH RAIDS
I am pasting here >working< raid that I am using with TFS 0.3.3:
Code:
<raid name="orshabaal" file="orshabaal.xml" interval2="600" margin="0" enabled="0"/>
Code:
<?xml version="1.0" encoding="utf-8"?>
<raid>
	<announce delay="1000" type="Event" message="Orshabaal's minions are working on his return to the World. LEAVE Edron at once, mortals." />
	<announce delay="600000" type="Event" message="Orshabaal is about to make his way into the mortal realm. Run for your lives!" />
	<announce delay="1200000" type="Event" message="Orshabaal has been summoned from hell to plague the lands of mortals again." />
	<singlespawn delay="1201000" name="Orshabaal" x="1228" y="1275" z="4" />
</raid>
And my raid lines have parameter enabled="0" because on my OT I am the one who is launching raids whenever I want :p
 
Last edited:
Code:
<singlespawn delay="2000" name="Demon" x="1008" y="1008" z="7" />
can be now:
Code:
<singlespawn delay="2000" name="Demon" pos="1008;1008;7" />

running a raid from globalevents require to add:
Code:
<raid name="xx" file="xx.xml" interval2="120" margin="0" enabled="0"/>
 
Message for all! executeRaid() command was fixed FROM BETA 1! It means that it doesn't work properly for previous versions of TFS.
 
Not at all.. It's quite simple. One raid takes me something like five minutes.
 
Okay, it could be. So I'm gonna fix 50% of mistakes :p
 
The difference is quite big. Old raid system just doesn't work :D
 
Code:
<raid>
<announce delay="0" type="event" message="" />

<singlespawn delay="2000" name="Necropharus" x="33044" y="32400" z="10" />
</raid>

Code:
	<raid name="necropharus" file="necropharus.xml" interval2="480" margin="0"/>

Code:
[21/12/2008 11:21:09] [Error Raid::loadFromXml]: Could not load data/raids/necropharus.xml!
[21/12/2008 11:21:09] [Error Raids::loadFromXml]: failed to load raid necropharus
 
Maybe try to put something in message? It won't load empty announcement. If you don't want to put announcements just remove <announcement....>
 
Then in /data/globalevents/globalevents.xml add a line:

Code:
	<globalevent name="xx_raid" interval="7200" script="xx_raid.lua"/>

interval="value" means that raid will be executed every value seconds. 7200 value means that this raid will be executed every 2 hours.

3600 (1 hour - 3600 seconds) * 10 = 36000

so set 36000 in interval to execute this raid every 10 hours from launching OT.
 

Similar threads

Back
Top