User Tools

Site Tools


xg:chains

XG chains

A single XG trigger event can produce any number of effects in one so-called “atomic action”. In most cases, events are triggered by an activator which is usually an entity in the current map (typically things such as enemies or other players). An example of which could be a switch that opens a door and lowers a staircase. This can be achieved by chaining multiple line types together. There are no restrictions on the number or combination of classes that can be chained together.

Note that the activator of each line type in the chain is that which triggered the initial event.

Another example could be a door closing automatically after a given amount of time has passed. The door line type's activation chain would move the ceiling of the tagged sector to some reasonable height, like to the lowest adjacent ceiling height with an offset of –4. The deactivation chain could alternatively move the ceiling back to its original height or move it to the same height with the floor of the sector, thus closing the door.

Available chains

Name Actioned
Activation (Act.) When a trigger line type is activated.
Deactivation (Deact.) When a trigger line type is deactivated.
Event When a trigger line type receives an event.

As an example let's say that a triggered line type has the activation chain 5120. Upon activation a chain event will occur which is first sent down the activation chain before any function or actions on the triggered line type are executed.

Event chains work a bit differently. Events sent to the triggered line type will first be processed treating the trigger line type as if it were of the type specified by the chain. If the event passes (i.e., it meets the (de)activation requirements of the chained type) further processing won't be done. In effect this allows for alternate functions and/or activation methods/requirements for a single line type.

Sector Type Chains

Each XG sector type has four chains: the floor, ceiling, inside and ticker chain. Like with lines, chains are always line type IDs. The floor chain is processed when a map object of a given type is touching the floor: a chain event whose originator is the object in question is sent to a temporary line that appears to belong to the sector. The ceiling chain works similarly, but is processed when an object is touching the ceiling. The inside chain is processed for all objects inside the sector. The ticker chain is processed up to 35 times per second. For the ticker chain there is no event originator.

Each chain can be configured to only affect certain types of things (player, monster, missile, etc.). Also, each chain has a start time and an end time, which define when the chain is operating. The rate at which to send the Chain events can be set as a min/max interval pair. Each chain has a counter that can be used to limit the number of times the chain can be processed. If the counter is greater than zero, it will be decremented every time a Chain event is successfully processed.

The chains can be configured to send activating or deactivating events. Internally, this means the temporary line that receives the events is initially inactive or active, respectively. The temporary line is set up as follows: it is a one-sided line, whose front sector is the sector the chain belongs to. It has no sidedefs, so operations that modify the sides of the line (Act texture, for instance) have no effect. The line's type is equal to the chain being processed (for example 5210). The line's tag number is equal to the sector's tag number.

As an example, a sector type that deals one point of damage to all players inside the sector once per second would be set up in the following way. The floor chain would be a line type that, when activated, deals a point of damage to its activator. Flags for the floor chain would be scef_player_a, which causes an activating Chain event to be sent for player mobjs. The floor chain counter would be set to –1 to allow the chain to work indefinitely. Both the min and max intervals for the chain would be one.

xg/chains.txt · Last modified: 2019-11-26 18:19 by skyjake