Boss

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.
EGGMA1.png EGGNA1.png EGGOA1.png
Bosses

A boss is a powerful enemy that the player usually fights at the end of a zone. In SRB2, the third act of each zone (e.g. Greenflower Zone Act 3) generally features Eggman as a boss. Nearly all the official bosses take eight hits to defeat, and will usually make an Egg Capsule appear in the map upon being defeated. Many custom level packs follow this format. However, SRB2 currently includes only six unique bosses: Egg Mobile, Egg Slimer, Sea Egg, Eggscalibur, Metal Sonic and Brak Eggman. For this reason, people may want to create their own custom bosses to avoid using the standard SRB2 bosses frequently. This article provides information that may be useful when creating a custom boss.

Bosses in SRB2

SRB2 currently contains six bosses, plus an old scrapped boss that can still be used in custom maps:

The third act of each zone consists of a fight against one of these bosses. The player has to avoid their attacks and try to damage them through some kind of weak spot. After five hits, the boss will enter its pinch phase or panic mode and switch to a different attack pattern. After three more hits, it will be defeated and flee, usually leaving behind an Egg Capsule that the player can open to release trapped animals and end the level.

Brak Eggman is the only official boss that takes more than eight hits to defeat.

Of the six functional bosses in SRB2, the Egg Mobile and Brak Eggman are the only bosses that can simply be placed on a map and will function as intended. The Egg Slimer additionally needs an Axis on the map that it can rotate around. Both the Sea Egg and Brak Eggman (Old) need waypoints to guide their movement through the level. See the Boss Waypoint article for a guide on how to set these up. All bosses except Brak Eggman will rise to the level's ceiling upon being defeated; however, a Boss Escape Point can be placed on the map or outside its boundaries for the boss to flee to instead.

Brak Eggman is the only boss that ends the level by default after being defeated. For all other bosses, there are two ways to make them end the level: Checking the Ambush flag on boss Thing will cause the level to end immediately after defeating the boss. More commonly, an Egg Capsule will be placed on the map that rises after the boss is defeated and allows the player to end the level. See the Egg Capsule tutorial for an explanation of how to set this up.

Custom bosses

Custom bosses can be created through use of SOC and/or Lua. For a custom Object to become a boss, it needs to have the MF_BOSS flag checked. This will allow the Object to have a boss thinker – most of the official bosses are given specialised thinkers for themselves to use only, but custom bosses by default are given a relatively blank thinker (see feature list below) allowing for more freedom to modify its behavior via SOC than in previous versions of SRB2. (Previously, all custom bosses would automatically run A_Boss1Chase whenever they were in their SpawnState, effectively forcing them to be clones of the Egg Mobile.)

Default features given for custom boss Objects:

  • If the current state is about to go to SpawnState, MF2_FRET is removed from the Object's flags; this disables the temporary invincibility given when the boss is damaged.
  • If the Object's current target isn't damageable or doesn't exist, it will find a new player to target and play the sound determined by SeeSound if one is found. However, if the boss has been defeated, the sound played is instead determined by Mass.
  • If the Object's state is currently MeleeState or MissileState, the Object will automatically face its target. This will not occur if the boss's health is at the value of Damage or below.

Optionally, Lua can be used to add to this thinker or completely replace it, using the BossThinker hook.

Other points to consider when making a custom boss:

  • By default when a boss is damaged, the custom boss is given MF2_FRET, giving it temporary invincibility and makes the boss flash. If the default custom boss thinker is being overwritten by Lua, the new one should at some point remove MF2_FRET so the boss can be damaged by the player.
  • Most bosses include special attacks or behavior only for pinch phase or panic mode, typically given when the boss's health has been reduced to the value of Damage or lower. Custom bosses do not alter their behavior much for pinch phase by default, allowing for freedom to choose what to do during this phase of the boss battle.
  • Some of the official bosses alter their behavior gradually as they lose health, such as increasing their speed or changing their selection of attacks, regardless of whether they are in pinch phase or not. This is not actually required for custom bosses, though if added correctly can add to a player's experience of the boss battle.
  • When a boss Object is defeated, it will go into its DeathState and the player who defeated it will receive a score of 1000 points (Brak Eggman (Old) awards 1000 points to all players in the map). However, the action A_BossDeath is needed for the boss to do anything after dying, such as raising the capsule or fleeing. (See the article for A_BossDeath for more information).

Object properties

The majority of the Object properties have some form of use for a boss Object - the uses for each of these are detailed here:

States

  • SpawnState: The boss's spawnstate. This is typically used to remove MF2_FRET, removing the temporary invincibility given after being damaged.
  • SeeState: unused
  • PainState: The boss goes to this state if it has been hit and still has health points left.
  • MeleeState: If A_Boss1Chase is used, the boss calls either this or MissileState when it is ready to attack (except in pinch phase).
  • MissileState: If A_Boss1Chase is used, the boss calls either this or MeleeState when it is ready to attack (except in pinch phase).
  • DeathState: The boss goes to this state if it has no health left. Most bosses call A_BossScream in this state and onwards to spawn explosions, with A_BossDeath being used to finish the death sequence.
  • XDeathState: If A_BossDeath is used, the boss will go into this state while fleeing (except in Mario mode).
  • RaiseState: If A_Boss1Chase is used when the boss is in pinch phase, it will call this state when it is ready to attack.

Sounds

  • SeeSound: When the boss spots a player, this sound is played.
  • AttackSound: unused
  • DeathSound: If A_BossScream is used, this sound is played to accompany the spawned explosions.
  • ActiveSound: If A_SkullAttack is used, this is used as the dashing sound.

Other attributes

  • SpawnHealth: Sets the boss's initial health points. Most bosses set this to 8, although Brak Eggman sets this to 12.
  • ReactionTime: Sets the boss's initial reaction time, which for A_Boss1Chase controls how long it takes for the boss to execute an attack. While chasing the player, the boss will continually decrease its reaction time until it hits 0, after which it will use an attack. After this the boss's reaction time will be reset to this value for the next attack.
  • PainChance: unused
  • Speed: Actions such as A_Boss1Chase and A_Boss2Chase use this to set the speed at which the boss chases the player.
  • Mass: Sets the number of the sound to be played when the boss is defeated and flees.
  • Damage: Used by most boss thinkers to determine the starting number of health points left to use the boss's pinch phase behavior at; e.g. A_Boss1Chase uses this to start using RaiseState for its attacks instead of MeleeState/MissileState. Most bosses set this to 3.

Actions

See also: Actions#Boss thinkers

There are a large number of actions that are either designed to be used by bosses or behave differently from their normal behavior when used by bosses. These are listed here:

General

These actions are general-purpose actions, or are used by multiple of the bosses included in SRB2:

  • A_BossJetFume: Can be used to spawn Egg Mobile-style jet fumes, a Sea Egg-style propeller, a Metal Sonic-style jet fume, or an Eggscalibur-style jet flame. This action should only be used once if used at all, as every use of it will spawn new jet fumes; this is best done when the boss is first spawned.
  • A_BossFireShot: A specialized firing attack that allows the Egg Mobile (in previous versions of SRB2) and the Sea Egg to fire missiles from specific positions relative to themselves. This is rarely useful for custom bosses unless they have the same proportions as the Egg Mobile or the Sea Egg.
  • A_SkullAttack: A standard dashing attack; however, exclusively to the Egg Mobile and custom bosses, this will spawn a ghost trail of the boss. It is also used as part of the Egg Mobile's pain animation, making the boss fly away from the player before they have a chance to hit it again. Only the Egg Mobile can actually dash straight through the player, however; any other Object will stop as soon as they collide with another Object.
  • A_BossZoom: An action similarly built to A_SkullAttack, with a controllable speed but without options to modify flight direction – this was an action originally intended for the Egg Mobile, but was never used.
  • A_LobShot, A_FireShot, A_SuperFireShot: These actions work the same as they would for normal Objects, except that the reaction time will remain unchanged – this is so the boss thinker can handle the reaction time itself directly.
  • A_BossScream: When a boss is defeated, this action may be used to spawn explosions around the boss during a death animation – all of the bosses included in SRB2, except for Brak Eggman and Brak Eggman (Old) use this.
  • A_BossDeath: A specialized action for boss post-death behavior that, by default, makes bosses fly to the nearest Boss Escape Point (or upwards if none are found), raise the Egg Capsule (using sector tags 680-682) and switch to their XDeathState for fleeing. This behavior differs for some bosses, and can even be customised using the BossDeath Lua hook. If the boss has the flag MF2_BOSSNOTRAP checked (which can be set by checking the Special flag on the boss's map Thing), the boss will automatically end the level instead of raising the Egg Capsule. Note that when there are other bosses still alive on the map, the boss will not raise the Egg Capsule nor end the level, but will still flee.

Specialised

These actions are largely specialised to be used by these bosses only, though in some cases can be freely used for custom boss behavior:

  • Egg Mobile
    • A_Boss1Chase: The basic chasing behavior and thinker used by the Egg Mobile. Also includes the ability to select an attack from MeleeState, MissileState and RaiseState depending on the situation (see article for more details).
    • A_Boss1Laser: The Egg Mobile's laser attack thinker – when used, MF2_FIRING is turned on and the action is made to call itself again for the rest of the current state's duration.
    • A_FocusTarget: Used by the Egg Mobile's laser to move towards the target player.
    • A_Boss1Spikeballs: Used to spawn each of the Egg Mobile's spikeballs (once per use of the action) during pinch phase.
  • Egg Slimer
    • A_Boss2Chase: Egg Slimer's main thinker, for moving in a circle around an Axis and spraying goop around itself.
    • A_Boss2Pogo: Egg Slimer's pinch phase thinker, for pogoing around spraying goop around itself.
    • A_Boss2PogoSFX: Old pogoing thrust behavior used by the Egg Slimer in previous versions of SRB2.
    • A_Boss2PogoTarget: New pogoing thrust behavior used by the Egg Slimer from Version 2.1 onwards.
    • A_Boss2TakeDamage: Egg Slimer-specific pain-invincibility handler; prevents the boss from being damaged again for a limited time.
  • Sea Egg
    • A_Boss3Path: Used by the fake Sea Egg clones to behave similarly to that of the Sea Egg itself, but taking into account where the Sea Egg itself is actually located.
    • A_Boss3TakeDamage
  • Brak Eggman (Old)
    • A_Boss7Chase
    • A_Boss7FireMissiles: Fires four missiles of a set type from around the actor's middle; used for Brak Eggman to fire grabbable missiles at the player.
    • A_GoopSplat: Used by Brak Eggman's goop missiles to force the player to be immobilized when they land on the ground.

Object flags

Apart from the MF_BOSS flag itself, MF_SPECIAL and MF_SHOOTABLE are generally also needed to be checked for boss Objects; MF_SPECIAL enables the player to harm the boss or be harmed themselves by touching the boss, and MF_SHOOTABLE allows the boss to be harmed/killed by something, whether or not it is the player.

A number of other flags may be given to a boss Object by one of the various actions associated with it:

  • MF_NOGRAVITY, MF_NOCLIP and MF_NOCLIPHEIGHT: The default behavior of A_BossDeath gives these flags to the boss, to allow itself to fly out of the level boundaries when fleeing.
  • MF2_BOSSFLEE: The default behavior of A_BossDeath also gives this flag to the boss if there is a Boss Escape Point to flee to. This flag allows the boss to fly in the direction of its target Boss Escape Point.
  • MF2_BOSSNOTRAP: If the boss's map Thing has the Special flag set, this flag is given to the boss. If it is set, A_BossDeath will end the level automatically instead of raising an Egg Capsule.
  • MF2_FRET: Given to bosses when they have been hurt – this flag stops the player from being able to harm the boss and makes all black (palette color #31) in the boss's sprite flash white to signify it has been hit. For Metal Sonic a dark blue (palette color #239) is the flashing color, and for Brak Eggman the whole sprite flashes white. This flag is automatically removed when returning to the SpawnState.
  • MF2_JUSTATTACKED: This flag is given by A_Boss1Chase when the boss uses any of its attacks. This prevents the use of an attack for the next usage of A_Boss1Chase, instead sending the boss in a new direction.
  • MF2_SKULLFLY: When a boss uses A_SkullAttack, it is given this flag, which in turn allows it to spawn ghosts of itself.
  Object types [view]
General EnemyBossPushableSpringMonitorNiGHTS power-upProjectileAmbient sound effect
Special PlayerFreed animalsEmblemOverlay
Related links List of Object types