ACR Spawn

From ALFA
Jump to: navigation, search

The following is a complete list of features in the ACR's spawn system.

Waypoints

See also: Using Local Variables

Just like NESS and other spawn systems, the ACR's spawn system uses waypoints as spawn points. These waypoints have a great deal of options on them, in the form of local variables which the builder can change to suit his needs. You'll find a base, blank template for a spawn waypoint in the ALFA Campaign Folder.

It is important to note that ACR Spawn waypoints must be tagged as ACR_SPAWN_WP.

Array Parameters

In computer lingo, an array is simply a list of some sort of data of the same type. The spawn system uses arrays to list the "resource names" of creatures or objects you want to spawn, and the scripts you may wish to attach to these creatures. Since the spawn system depends on local variables for configuration, the arrays are lists of local variables. For example, ACR_SPAWN_RESNAME_ is a local string which lists the resrefs of the creatures spawned. So ACR_SPAWN_RESNAME_1 would be the name of the local variable for the first resref, ACR_SPAWN_RESNAME_2 the second, ACR_SPAWN_RESNAME_3 the third, and so on. Never skip a entry in an array. If you do, the spawn system will think the array has stopped at the missing entry. Also, always start at 1, not 0.

Current Paramters

ACR_SPAWN_TYPE (integer) 
This indicates the type of object which is being spawned. The default is 0, for a creature, but other types are available, as listed below:
Value Result
0 Creatures
1 Placables
2 Items
3 Store
4 Waypoint
5 Triggers
6 Encounters
7 Lights
8 Trap
ACR_SPAWN_RESNAME_* (string array) 
This array lists Resource Names of objects which are always spawned by the spawn point. If the spawn point is activated, all the Resource Names in this array will be spawned. Resource Names listed more than once are spawned more than once.
Example: Leading to 2 badgers and a chicken each time: ACR_SPAWN_RESNAME_1 = "c_badger"; ACR_SPAWN_RESNAME_2 = "c_badger"; ACR_SPAWN_RESNAME_3 = "c_chicken"
ACR_SPAWN_RANDOM_RESNAME_* (string array) 
This array lists Resource Names of objects which are chosen at random to be spawned. The number of chosen Resource Names depends on the ACR_SPAWN_RESNAMES_MIN/MAX settings, see below. This array can have no more than 31 entries. Each time the spawns are chosen randomly from this list.
Example: Leading to 67% chicken and 33% badger: ACR_SPAWN_RANDOM_RESNAME_1 = "c_badger"; ACR_SPAWN_RANDOM_RESNAME_2 = "c_chicken"; ACR_SPAWN_RANDOM_RESNAME_3 = "c_chicken"
ACR_SPAWN_RESNAMES_MIN (integer)
ACR_SPAWN_RESNAMES_MAX (integer) 
These are the maximum and minimum numbers of Resource Names spawned from the ACR_SPAWN_RANDOM_RESNAME_ array. The actual number spawned is determined randomly between these values. They can range between 0 and 31. To keep this value from being random, set both the min and max equal. Each one will be an independent pull from the RANDOM_RESNAME array described above, so if these are >1, you may end up with multiples of Resource Names from the RANDOM_RESNAME array: best to leave uniques like bosses to their own waypoint, or use the ACR_SPAWN_RESNAME_# option above for them.
ACR_SPAWN_RESPAWN_COUNT (integer) 
This local integer defines the number of times a spawn point will spawn, if all its children have been killed. The default is 1, which indicates a "single-life" spawn. Mod reset or scripts can bring the spawn back, and normal despawning due to time or inactivity will not permanently deactivate the spawn point, only death of all of it's spawned "children". Note that this relies on the spawned objects having the correct acf_ondeath() scripts in their OnDeath events. A setting of "-1" will lead to an infinitely respawning waypoint, which will always repopulate after being "cleared out". Similarly, setting this value to "5", would mean the spawn point would have to be killed off 5 separate times to deactivate "for good". Note that currently a mod reset still sets this counter back to it's original state, though we may tie this into persistent variables once they become available to us again.
ACR_RESPAWN_DELAY_MIN (float)
ACR_RESPAWN_DELAY_MAX (float) 
This is the random period of time a spawn spends "recharging" after its children have all been killed (see above). This value is in game hours, and is chosen randomly between the mininum and maximum. To keep this value from being random, set both the min and max equal. In practical terms, the respawn will happen at the next spawn pseudoheartbest after the timer expires, so the "accuracy" of the respawn delay will be somewhat dependent on the refresh rate of the system. Also note that setting respawn delay to "0.0" means the respawn will still be delayed until the next pseudoheartbeat, so respawns are never instantaneous (though if a spawn is killed just before a heartbeat, it may appear so).
ACR_SPAWN_CHANCE (float) 
This value, from 0 to 100, represents the chance a spawn has of spawning. This chance is computed once every game day. The % chance applies per day for the waypoint collectively, so it is an all-or-nothing situation.
ACR_SPAWN_RANDOM_RADIUS (float) 
This, if nonzero, specifies a maximum distance from the chosen spawn point location at which the spawn child may appear, in a random direction. This is calculated separately (distance and direction) for each spawned child, so for a multiple spawn, you can imagine it to describe the tightness of the "scatter" of the spawned children around the spawn point target. A small value will give a closely-spaced group, while a large one will give the illusion of entirely separate spawns, even though they are all children of the same waypoint.
ACR_SPAWN_RANDOM_RANGE (float) 
This, if nonzero, specifies a range (in a random direction) from the actual location of the waypoint to the target/centerpoint of the spawning- 0.0 will always center the spawn right on top of the waypoint, while an arbitrarily large value could place the spawn anywhere in the area. Note that when spawning a single child, this parameter is functionally equivalent to ACR_SPAWN_RANDOM_RADIUS, but when used with multiple children, it can place a mob of creatures, placeables, or items in a less predictable position, either in a closely knit group, or a broad spread.
ACR_SPAWN_IN_VFX (integer) 
This integer indicates the Visual Effect number of a visual effect which is played on every object this spawn point spawns. It is commonly used to represent teleporting or summoned monsters.
ACR_SPAWN_VFX (integer) 
This integer indicates the visual effect number of a visual effect which is played on the spawn point itself as it activates. It is commonly used to represent groups of teleporting or summoned monsters.
ACR_SPAWN_IN_SFX (string) 
This is the Sound Effect file which is played on each object spawned at this spawn point.
ACR_SPAWN_SFX (string) 
This is the sound effect file which is played on the spawn point itself as it activates.
ACR_SPAWN_ANIMATION (string) 
This is the animation performed by all creatures spawned from this spawn point, as they spawn.
ACR_SPAWN_IN_HOUR (integer)
ACR_SPAWN_OUT_HOUR (integer) 
This is the hour of the day the spawn starts to spawn in and spawns out at. If the current hour is between these values, the spawn can be active. If the two values are equal (such as zero, the default), the hour of the day has no effect on whether or not the spawn activates. Valid values are between 0 and 23. This also works for "circular" cases, such as Night-only spaws.
Example: Here for spawning in at 18:00, and spawning back out every 06:00: ACR_SPAWN_IN_HOUR = "18" ACR_SPAWN_OUT_HOUR = "6"
ACR_SPAWN_IN_DAY (integer)
ACR_SPAWN_OUT_DAY (integer) 
This is the day of the month (28 days in the Fearunian month) in which the spawn will spawn in and spawn out. These should also work in a circular fashion similar to the hours above, though that behaviour has not been stringently tested.
ACR_SPAWN_IN_MONTH (integer)
ACR_SPAWN_OUT_MONTH (integer) 
This is the month of the year (12 months in the Faerunian year) the spawn starts to spawn in and spawns out at. If the current month is between these values, the spawn can be active. If the two values are equal (such as zero, the default), the month of the year has no effect on whether or not the spawn activates. Valid values are between 1 and 12.
ACR_SPAWN_IN_PC_SIGHT (integer) 
If nonzero, the spawn will spawn with a PC in sight of it. This is disabled to keep spawns from suddenly appearing in front of a PC in an OOC fashion.
ACR_SPAWN_ONLY_WHEN_NO_PC_IN_AREA (integer) 
If nonzero, this spawn will not respawn or activate at all if a PC is already in the area when it tries to do so. This is used to prevent creatures from re-appearing where they were after a PC just killed them, or something similar.
ACR_SPAWN_WITH_ANIMATION (integer) 
If nonzero, this setting makes the spawn appear with its default spawn-in animation. This is usually a "fly-down" effect for most creatures, and a "climb down" effect for spiders.
ACR_SPAWN_IS_DISABLED (integer) 
If nonzero, this spawn is disabled and will not spawn unless enabled by some other script or DM tool.
ACR_SPAWN_RANDOM_FACING (integer) 
If nonzero, the spawn's facing is random, instead of facing the direction of the spawn waypoint.
ACR_SPAWN_IN_STEALTH (integer) 
If nonzero, the spawn spawns in stealth mode.
ACR_SPAWN_IN_DETECT (integer) 
If nonzero, the spawn spawns in detect mode.
ACR_SPAWN_BUFFED (integer) 
If nonzero, spawned creatures spawn with all hour per level (or longer) buffs cast on itself in a semi-intelligent fashion (evil creatures cast protection from good, multiple magic vestimates or magic weapons are distributed over different items, etc).
ACR_COLOR_NAME (string) 
Sets the color of the creature's name to the string value. Anything that functions inside of <C=[this spot]>Name</C> is valid for use.
Example: A value of gold will set the spawned creature's name to a golden color.

Custom Script Parameters

The spawn system allows custom scripts to be run when a spawn activates, for scripters to use how they wish. In order to use the functions listed here, be sure and include the spawn system's source file with the line: #include "acr_spawn_i" at the top of your script.

ACR_SPAWN_IN_SCRIPT_ (string array) 
This array defines custom scripts which are run on each object spawned by the spawn point. Each script is executed on each spawned object once, with OBJECT_SELF pointing to the spawned object. These scripts can have any name.
ACR_SPAWN_SCRIPT_ (string array) 
This array defines custom scripts which are run on the spawn point after it activates and spawns children. Each script is executed once, with OBJECT_SELF pointing to the spawn waypoint itself. If you wish to spawn additional objects from this script, use the function ACR_SpawnObject(). These scripts can have any name.
ACR_SPAWN_IS_ACTIVE_SCRIPT (string) 
This variable defines a single custom which is run whenever the spawn system looks at the spawn point and tries to decide whether or not to spawn it. It allows custom logic to be used to decide whether or not the point should spawn, overriding the spawn point's normal behavior. In this script, OBJECT_SELF points to the spawn waypoint itself. If you wish the point to spawn, call ACR_ForceSpawn(). If you wish to keep it from spawning, call ACR_DisallowSpawn(). If you don't call either of these functions, the spawn point behaves as it normally would. If for some reason you call both, ACR_ForceSpawn() takes precedence and the spawn activates. (not yet tested)

System Configuration

In addition to the options of each spawn point, there are a few settings which you can use to globally configure ALFA's spawn system. These are constants located in the script acf_spawn_i. Like all ACF files (click here for an explaination), it is never updated in an ACR update. So any settings here will always be preserved, though server staff may be asked to add options to this file in the future as the ACR evolves.

_SPAWN_AREA_DESPAWN_DELAY 
This is the delay between when an area becomes empty of PCs, and when the spawn system despawns its children within it. Larger values here may lead to increased CPU usage as more creatures stay spawned at once.
_SPAWN_REFRESH_DELAY 
This is the "heartbeat" of the spawn system. Larger values here reduce CPU usage, but make the spawn system react slower.
_SPAWN_PRESPAWN_SEAMLESS 
This controls whether the spawn system will take cues from PCs entering seamless ATs in adjacent areas. If active, it should ensure all spawns are in place before the PC actually ATs. It may be disabled to keep memory use down, as it may lead to areas being population without PCs actually entering them (if the PC backs out of the AT trigger instead of continuing)
_SPAWN_PRESPAWN_PREDICTION 
This controls whether the spawn system will take into account the predicted arrival point of an ATing PC, when deciding whether to spawn a group intended to be out of sight.