From SRB2 Wiki
Jump to: navigation, search
Test.png This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

A_AttractChase is an action that is used as part of the thinker for the rings, CTF team rings (red and blue) and coins, both in their regular forms and when spilled by the player. Its main purpose is to make rings/coins look for and chase players with an Attraction Shield. However, it also causes the spilled versions of the rings/coins to flicker before disappearing, and can cause normal rings/coins to be replaced by their spilled versions or vice versa. Note that SRB2's rings and coins themselves do not call this action via their states, but instead call it every tic from their internal Object thinkers. This is so that their chasing behavior can be smooth regardless of their state durations.


The actor will check for the nearest visible player with an Attraction Shield within 512 fracunits around it; if one is found, it will set the player as its tracer and chase it at a speed defined by the Object's Speed value. When the actor is chasing such a player, MF_NOCLIPHEIGHT is removed and MF_NOCLIP added to the actor's flags, allowing the actor to pass through walls but not the floor/ceiling. If the actor's tracer no longer exists, is not a player, has no health, or cannot be seen, the actor removes MF_NOCLIP from its flags and stops following the tracer if it has one.

If, however, the actor's tracer is a player without an Attraction Shield (when the actor presumably was previously attracted by a shield that has now been lost), the actor will spawn an Object of a type determined by ReactionTime to use as the "spilled" Object, while the actor itself is removed from the map. For "spilled" Objects (which should have a ReactionTime value matching their Object type), the actor will turn on and off MF2_DONTDRAW every other tic to flicker in its last two seconds before disappearing. However, if the "spilled" Object finds a player with an Attraction Shield nearby, the actor will spawn an Object of a type determined by PainChance to appear as the regular non-spilled version of the Object, and the actor itself is removed from the map.

Example values for ReactionTime and PainChance for existing Object types are given below:

Object type Description ReactionTime PainChance

If the actor has the flag MF2_NIGHTSPULL however, when the actor is being attracted to the player in a NiGHTS map, this action will do nothing. This action will also do nothing if the actor does not have any health.

Object type property Use
ReactionTime Object type to spawn when the tracer no longer has an Attraction Shield (unless this is the same as the actor's Object type)
PainChance Object type to spawn when attracted by an Attraction Shield (if the actor's Object type matches its ReactionTime value)
Speed Speed the actor chases players with an Attraction Shield

  Actions – Rings [view]