To get NPCs and monsters to spawn, we use either the standard Encounter tool, pre-placed characters, or the random spawn variables. This post is about setting up the latter in the toolset, and changing an area's random spawns in-game through use of the DM client.
Older areas use the older spawn script until they are upgraded; thus we have two systems running side by side at the moment. They are identified by their use of the Types integer (this has a value greater than 0 if old spawning values are present). Being an integer, you can check this using the "GetVarInt Types" console command. I expect the Get/SetVarInt and Get/SetVarString commands are familiar to our DMs.
Setting variables for an area in the toolset is done under Area Properties, Advanced, Variables [...]. You type the variable name in the Name box, select whether it's an integer/float/string in the drop-down menu, and enter the value in the Value box. Then press Add, add more until you're done, fix mistakes using Replace, press OK when you're happy.
For waypoints, this is done under the Properties, Advanced, Variables button. It's reasonably straightforward.
Below is a listing of the various relevant variables. They'll be explained in detail later on.
area int Spawn area int Delay wp int Yaxis wp int Xaxis int NIGHT int ONEALT int SNumber? string Creature? string ALT?# string ALTN?# ? is a number from 1 to 7. It defines the order of spawning starting at 1. If a number is missing, following numbers are also disregarded (a list of 1, 2, 4, 5, 7 only leads to creautres 1 and 2 spawning) # is a number from 1 to 9. It defines alternative creature blueprints and there may be reasons not tot start at 1.
The spawn system follows a number of rules:
- Area spawns don't spawn within 5 meters of the map's edge but can spawn anywhere else.
- Waypoint spawns spawn in a rectanglular box of maximum dimensions Xaxis x 10, Yaxis x 10 meters to the north and east of the waypoint.
- Waypoint spawning points must be tagged SpawnWP
- Spawn must be set to 0 to deactivate spawning in an area, 1 to activate spawning, and 2 to activate area spawning but deactivate waypoint spawning.
- Spawned creatures (and encounter creatures) are subject to the area clean-up script and will be deleted when it runs.
- Creatures spawn when a player enters the area, if at least Delay seconds have passed. This defaults to 180 seconds if the value is not set. The counter is reset when the area is cleared through the clean-up script.
The trick and difficulty of the spawn system is in entering the right settings to get the desired effect.
SNumber? defines the amount of creatures of a group that spawns each time. The exact amount of creatures spawning varies slightly between spawns. For set creatures which are to spawn every single time, use an encounter trigger instead.
Creature? is where you define what creatures spawn.
-> For example, to spawn roughly 3 cows and 14 badgers, SNumber1 would be 3, SNumber2 would be 14, Creature1 would be nw_cow and Creature2 would be nw_badger.
That should be manageable. If you forget about waypoints for now, you're at the same level as we were with the old spawn system, except you don't need to define area size, you don't need a central waypoint, you don't need to announce how many creature types there were in total, they don't spawn at the map's edge, and you can't announce the chance of them spawning. In other words, it's even more simple than before but works better.
Here's where it gets more complicated/interesting.
If you define Creature? as ALT, you activate the alternative spawning for ?.
Alternative spawning simply means that you get an either/or functionality. You spawn either orcs or goblins, either bats or badgers or cows.
You do this using the ALT?# variables. If you wanted an area to spawn 12 rats, as well as either 4 bats, badgers or cows, you'd use SNumber1 = 12, SNumber2 = 4, Creature1 = nw_rat002, Creature2 = ALT, ALT21 = nw_bat, ALT22 = nw_badger, and ALT23 = nw_cow. All three have an equal chance of spawning. Now if you wanted to have a 50% chance at badgers and a 25% chance at the other two, you'd add ALT24 = nw_badger to give these an extra slot.
Assume then that you want an area to spawn greater or lesser goblins, but you also want both fighters and shamen to spawn.
Normally you'd use Creature1 = ALT, Creature2 = ALT, ALT11 = lessergoblinfighter, ALT 12 = greatergoblinfighter, ALT21 = lessergoblinshaman and ALT22 = greatergoblinshaman.
The above results in getting one type of shaman and one type of fighter. If you want either lesser goblins or greater goblins to spawn, you'd set the ONEALT variable to 10. This fixes the value of #. Therefore, you either spawn the ALT11 and ALT21 creatures, or the ALT12 and ALT 22 creatures.
-> (playing around further still, you can add Creature3 = ALT, ALT31 = goblinboss and ALT32 = - variables to make chieftains spawn only if lesser goblins also spawn. More than that, you could also define a #3 for the lesser goblin pairs; ALT13 = lessergoblinfighter and ALT23 = lessergoblinshaman to make the bosses spawn with the lesser goblins only half the time)
Then there's another variable, NIGHT, which can be set to 1 if you want different creatures to spawn at nighttime for Creature? = ALT spawns. During the day, the ALT?# creatures are spawned. During the night, the ALTN?# creatures are spawned. These too are under the effect of the ONEALT variable if it is set.
Thus, you can determine where creatures spawn using Waypoint defined subareas. You can determine what spawns at day, what spawns at night, how much time there is between spawns, and whether you have teams of spawns, or anything joins blends together. You can have fixed spawns or random spawns. You can regulate probabilities by adding extra options or leaving slots blank.
The simplest spawns however, require only the following area variables: int Spawn = 1 (or 2) int SNumber1 = (number of spawns of type Creature1) string Creature1 = (creature resref/blueprint)
int SNumber2 = ?
string Creature2 = ?
int SNumber3 = ?
string Creature3 = ?
etc.
An example of a spawn system is set up in the river valley orc stronghold.
_________________ What the king dreams, the Hand builds.
Last edited by Loreweaver on Apr 1st, '06, 20:15, edited 1 time in total.
|