NiGHTS power-ups are special Objects in SRB2 that are used to award power-ups to the player when flying around a track as Super Sonic in a NiGHTS level. In unmodified SRB2 there are 5 different NiGHTS power-ups available, some of which are based on power-ups found in NiGHTS into Dreams itself.
When placed on a map, these items will initially be completely invisible and cannot be collected by anyone. However, when the player performs a paraloop around the item, it will become visible and can then be collected to be awarded the item's respective power-up. Typically these items are placed within circles of rings and/or wing logos, to give hints as to where they are located in the level.
If the Special flag is checked, a NiGHTS power-up item will only appear if the player has already destroyed the Ideya Capture and is in bonus time. If the Ambush flag is checked, it will be visible and collectible on spawn.
NiGHTS power-ups in SRB2
- Thing type 1707: Super Paraloop
- Thing type 1708: Drill Refill
- Thing type 1709: Nightopian Helper
- Thing type 1711: Extra Time
- Thing type 1712: Link Freeze
Custom NiGHTS power-ups
It is possible to make custom NiGHTS power-ups for SRB2 with the use of SOCs and/or Lua. To make an Object behave like and be recognised as a NiGHTS power-up, it needs to be given the
MF_NIGHTSITEM flag. Typically a NiGHTS power-up is also given the
MF_NOCLIPHEIGHT flags. The following Object properties control the power-up's behavior:
SpawnState: The state used for the item when it first spawns on the map; typically this is set to an "invisible" state to mark that the item cannot be collected currently. However, if the Object has the Ambush flag checked,
SeeStatewill be displayed instead on spawn.
SeeState: This state is used when the item is to be made "visible", giving the Object the
MF_SPECIALflag and removing the
DeathSound: The sound played when the item has been collected.
Speed: For all NiGHTS power-ups in unmodified SRB2, this is used to determine the duration of the power-up awarded. For custom NiGHTS power-ups, this will need to be applied manually using Lua if needed.
A number of object flags are involved with NiGHTS power-ups:
MF_NIGHTSITEM: The main flag required for NiGHTS power-up item behavior. This flag is removed when the Object has been paralooped by a player or the Object has the Ambush flag checked.
MF_SPECIAL: This allows the player to touch a NiGHTS power-up item and be awarded the respective power-up for the item. This flag will automatically be given when the Object has been paralooped by a player or the Object has the Ambush flag checked. Note that for custom NiGHTS power-ups, Lua is needed to determine what happens when a NiGHTS item is touched (see below).
MF2_STRONGBOX: Prevents a NiGHTS power-up item from being made visible unless the player has destroyed the Ideya Capture and is in bonus time. This flag is given when the Special flag is checked.
Setting up the power-up effects
Lua is required to set up what happens when a player touches a custom NiGHTS power-up item, as otherwise it will simply play
DeathSound and disappear without doing anything by default. In particular, the "TouchSpecial" Lua hook is needed here. See the below example code (a re-creation of the Super Paraloop's effect) for a template of how to create a custom NiGHTS power-up:
local function NiGHTSPower(special, toucher) local player = toucher.player // "toucher" is the touching object, so here we make "player" the touching player for convenience if player.bot or not (player.flags & PF_NIGHTSMODE) return true // item should not be touched by a bot or a non-NiGHTS player end //////////////////////////////////////////// // Awarding the power-up to the player(s) // //////////////////////////////////////////// if not G_IsSpecialStage() // effects given outside of special stages player.powers[pw_nights_superloop] = special.info.speed // award the power-up only to the touching player else // effects given when in a special stage for p in players.iterate // award the power-up to ALL players playing as NiGHTS if p.flags & PF_NIGHTSMODE p.powers[pw_nights_superloop] = special.info.speed end end if special.info.deathsound != sfx_None // Play the power-up's collect sound from nowhere, so that all players in the map can hear it! // Normally this sound is made to be played by the player that collected the power-up, // the problem with this is that other players could be too far away to hear the sound at the time S_StartSound(nil, special.info.deathsound) end end //////////////////////////////////////////////////////////////////////////////////////////////////////////// // Displaying a cecho message on-screen, to alert the player(s) that they have just received the power-up // //////////////////////////////////////////////////////////////////////////////////////////////////////////// if not G_IsSpecialStage() // display power-up cecho message only for the touching player // note: the "\\"s are needed in the cecho to offset the text downwards from the top of the screen - 8 pairs of these are typically used here COM_BufInsertText(player, "cechoflags "+V_AUTOFADEOUT+"; cechoduration 4; cecho \\\\\\\\\\\\\\\\Super Paraloop") else // display the message for ALL players for p in players.iterate COM_BufInsertText(p, "cechoflags "+V_AUTOFADEOUT+"; cechoduration 4; cecho \\\\\\\\\\\\\\\\Super Paraloop") end end end addHook("TouchSpecial", NiGHTSPower, MT_NIGHTSSUPERLOOP)
| This disambiguation page lists articles associated with the same title.
If an internal link led you here, you may wish to change the link to point directly to the intended article.
|General||Enemy • Boss • Pushable • Spring • Monitor • NiGHTS power-up • Projectile • Ambient sound effect|
|Special||Player • Shields • Freed animals • Emblem • Overlay|
|Related links||List of Object types|