Sacred 2:Spawn.txt Explained

From SacredWiki
Jump to navigation Jump to search

The following gives a discussion of the content of the spawn.txt file located in the scripts/server directory in the Sacred 2 installation directory.

The spawn.txt file contains a (large) number of spawn instances each taking a form that looks something like this [code]mgr.addSpawn (1,52,0,{ -- Kristallregion V total_density = 35, layermap_id = 3, {2036,4,"",0,0,0,0}, {2050,5,"",0,0,1,0}, {2041,2,"",0,0,2,0}, {2042,1,"",0,0,3,0}, } )[/code] In most cases there is a comment at the end of the first line giving you a very basic disciption of what this instance does. From the comment in the mentioned code we know this has something to do with the crystal region, but not much more. It is just good to note that some of the comments are in german and that there are typos (deser instead of desert).

The order in which the spawn instances are given at first appear to be random, as there are some from the crystal region then from the wastelands, then crystal region, then wasteland again then dryad island, and so on (with parts of human and elf regions also mixed in). If you take a map of ancaria and start from the top left and go down to the bottom, then up again (and a bit right) you will notice that you cross the crystal region then the wastelands, then crystal region and so on in the order that the instances are given in the spawn file.


(Map adapted from the Ice & Blood Map) This is further reflected in the first line: [code]mgr.addSpawn (1,52,0,{ -- Kristallregion V[/code] Where the numbers after the backet are some sort of x y z coordinate. Lower values of x being to the left (west) side of the map and lower values of y is to the top (north) of the map (why it starts at 52, I have no idea) and the z value is for dungeons. As in [code]mgr.addSpawn (3,31,-1,{ -- Temple Guardian Spawn Wasteland[/code] which is one level down and -2 is two levels down. As you then scroll through the file you will see the coordinates change to represent different parts of different regions. Range is from 1,52,0 to 63,60,0.

Each of the instances has a part that defines what creatures will spawn at the area defined by the coordinates. This is given by [code] {2036,4,"",0,0,0,0}, {2050,5,"",0,0,1,0}, {2041,2,"",0,0,2,0}, {2042,1,"",0,0,3,0},[/code] Where the first number in each line determines the type of creature that will spawn. To find out what creature the search for the specific number (in the line id = ) in the creatures.txt (in the same dir). For example 2050 gives: [code]mgr.createCreature { id = 2050, itemtype_id = 12653, name = "Monst_stonecreature_crystal_nk", behaviour = "Enemy_warrior_rush", dangerclass = 5, ... ...[/code] Where only the first part is of interest as it contains the name of the monster, and we can see that 2050 refers to on of the stone monsters in the crystal region. I am not sure what the rest of the numbers in the brackets for each monster instance means, but it does seem that if two monster id's (the first numbers) are the same the second from last numbers have to be different, as in: [code] {259,2,"",0,0,0,0}, {259,5,"",0,0,1,0}, {259,5,"",0,0,2,0}, {259,3,"",0,0,3,0}, {259,4,"",0,0,4,0},[/code]

Further three different spawn instances are allowed per area through the layermap_id line which takes the values 1, 2 and 3 (special case it seems is the start region which also has 4).

The total_density line then determines the density of monsters spawn on a layer in a specific area. Not sure about units, but a higher value means more monsters.

Any issues or queries can be discussed in the DarkMatters Modding forum.