From SRB2 Wiki
Jump to navigation Jump to search

Powers are special properties that can be applied to players, modifying their state via giving them a power-up such as a shield or altering how they interact with the environment.

There are three methods to apply powers to the player:

  • Setting player.powers[pw_powername] = value in Lua. As an example, to give the Super Sneakers for 3 seconds you would set player.powers[pw_sneakers] = 3*TICRATE
  • Using linedef type 434 in a map editor
  • Call A_CustomPower in SOC or Lua

List of Powers

Value Name Description
0 pw_invulnerability Sets the Invincibility timer.
1 pw_sneakers Sets the Super Sneakers timer.
2 pw_flashing Sets the temporary invincibility timer (as if the player has just been hit).
3 pw_shield Sets which shield(s) the player currently has. 1
4 pw_carry Sets what the player is being carried by. 2
5 pw_tailsfly Sets the amount of time left in the player's flight timer.
6 pw_underwater Sets the player's drowning timer.
7 pw_spacetime Sets the player's space timer.
8 pw_extralife Sets how long the extra life music lasts.
9 pw_pushing Timer for how recently this player pushed something.
10 pw_justsprung Sets how long to lock the player's facing angle in place. Applied internally when bouncing off a Spring, but otherwise has no relation to Spring logic.
11 pw_noautobrake Sets how long to disable autobrake.
12 pw_super Sets whether the player is Super. The player must still meet the criteria for becoming Super. (Note that this is used internally as a timer for how long the player has been super, in tics.)
13 pw_gravityboots Gives the player Gravity Boots for the given duration.
14 pw_infinityring Sets the Infinity Ring ammo.
15 pw_automaticring Sets the Automatic Ring ammo.
16 pw_bouncering Sets the Bounce Ring ammo.
17 pw_scatterring Sets the Scatter Ring ammo.
18 pw_grenadering Sets the Grenade Ring ammo.
19 pw_explosionring Sets the Explosion Ring ammo.
20 pw_railring Sets the Rail Ring ammo.
21 pw_emeralds Gives the player a specified number of multiplayer Chaos Emeralds. 3
22 pw_nights_superloop Sets the Super Paraloop power-up timer (NiGHTS only).
23 pw_nights_helper Sets the Nightopian Helper power-up timer (NiGHTS only).
24 pw_nights_linkfreeze Sets the Link Freeze power-up timer (NiGHTS only).
25 pw_nocontrol Takes control away from the player. Adding 32768 to this value will allow the player to jump while affected.
26 pw_dye Sets the player's color to this value, and sets player.mo.colorized to true.
27 pw_justlaunched Whether the player launched off a slope this tic, and what type of slope they've launched off of. 4
28 pw_ignorelatch While non-zero, prevents the player from latching to CR_GENERIC objects. Adding 32768 to this value will additionally prevent the player from latching to any object except for NiGHTS carrying objects. This does not prevent new attachments due to A_MixUp teleportation.
29 pw_strong A series of STR_ flags that toggle how a player attacks and can destroy FOFs. 5

1 The values for the shields are as follows:

Decimal Hexadecimal Name Description
0 0x0000 SH_NONE No shield.
1 0x0001 SH_PITY Pity Shield
2 0x0002 SH_WHIRLWIND Whirlwind Shield
3 0x0003 SH_ARMAGEDDON Armageddon Shield
4 0x0004 SH_PINK Pink version of Pity Shield granted from Amy's ability.
3073 0x0C01 SH_ELEMENTAL Elemental Shield. Equivalent to combining SH_PITY|SH_PROTECTFIRE|SH_PROTECTWATER.
4097 0x1001 SH_ATTRACT Attraction Shield. Equivalent to combining SH_PITY|SH_PROTECTELECTRIC.
1025 0x0401 SH_FLAMEAURA S3K Flame Shield. Equivalent to combining SH_PITY|SH_PROTECTFIRE.
2049 0x0801 SH_BUBBLEWRAP S3K Bubble Shield. Equivalent to combining SH_PITY|SH_PROTECTWATER.
4098 0x1002 SH_THUNDERCOIN S3K Lightning Shield. Equivalent to combining SH_WHIRLWIND|SH_PROTECTELECTRIC.
256 0x0100 SH_FORCE Force Shield flag. On its own this flag only gives one health point to the shield – the lower 8 bits can be used as extra health points, e.g. SH_FORCE|1 gives a force shield with 2 health points. Note: This cannot be combined with any of the values SH_PITY to SH_PINK.

In Lua scripts, use (player.powers[pw_shield] & SH_FORCE) to check if a player has the Force Shield.

255 0x00FF SH_FORCEHP Max extra health points for the Force Shield.

In Lua scripts, if the player is known to have a Force Shield, use (player.powers[pw_shield] & SH_FORCEHP) to check if the shield has extra health points.

512 0x0200 SH_FIREFLOWER Fire Flower shield flag. Note: This can be combined with any of the other shields.

In Lua scripts, use (player.powers[pw_shield] & SH_FIREFLOWER) to check if the player has the Fire Flower power-up.

512 0x0200 SH_STACK Mask for all shields that can be combined with others. Only includes Fire Flower currently.

In Lua scripts, use (player.powers[pw_shield] & SH_STACK) to get all shields that can be stacked with others.

65023 0xFDFF SH_NOSTACK Inverse of SH_STACK, mask for all shields that cannot be combined with others. Equivalent to typing ~SH_STACK.

In Lua scripts, use (player.powers[pw_shield] & SH_NOSTACK) to return everything except for shields that can be stacked with others.

1024 0x0400 SH_PROTECTFIRE Flag for shields that protect the user from Fire damage.
2048 0x0800 SH_PROTECTWATER Flag for shields that protect the user from Water damage.
4096 0x1000 SH_PROTECTELECTRIC Flag for shields that protect the user from Electric damage.
8192 0x2000 SH_PROTECTSPIKE Flag for shields that protect the user from Spike damage.

2 The values for carry types are as follows:

Value Name Description
0 CR_NONE Not being carried.
1 CR_GENERIC Generic, default case for miscellaneous objects.
2 CR_PLAYER Being carried by a flying Tails player.
3 CR_NIGHTSMODE The player is currently in NiGHTS mode.
4 CR_NIGHTSFALL The player has ran out of time in NiGHTS.
5 CR_BRAKGOOP Stuck in old Brak Eggman's goop.
6 CR_ZOOMTUBE Using a Zoom Tube.
7 CR_ROPEHANG Using a Rope Hang.
8 CR_MACESPIN Using a Mace swing.
9 CR_MINECART Using a Minecart.
10 CR_ROLLOUT Using a Rollout Rock.
11 CR_PTERABYTE Being carried by a Pterabyte.
12 CR_DUSTDEVIL Being carried by a Dust Devil.
13 CR_FAN Player is affected by a Fan or Fan Sector.

3 Var2 defines which multiplayer emeralds are given to the player according to the table below. If you wish to award multiple emeralds at once, add the corresponding values. For example, to award all seven Chaos Emeralds, Var2 should be 127.

Value Name Description
1 EMERALD1 Green Emerald
2 EMERALD2 Purple Emerald
4 EMERALD3 Blue Emerald
8 EMERALD4 Light Blue Emerald
16 EMERALD5 Orange Emerald
32 EMERALD6 Red Emerald
64 EMERALD7 Gray Emerald

4 The values for slope launch types are as follows:

Value Description
0 Didn't launch off a slope this tic.
1 Launched off a normal slope this tic.
2 Launched off a half-pipe this tic.

5 The values for pw_strong are as follows:

Decimal Hexadecimal Name Description
0 0x0000 STR_NONE Nothing. All strong powers can stack onto each other.
1 0x0001 STR_ANIM Remove powers when leaving current animation.
2 0x0002 STR_PUNCH Frontal attack (knuckles glide).
4 0x0004 STR_TAIL Rear attack.
8 0x0008 STR_STOMP Falling onto object (fang bounce).
16 0x0010 STR_UPPER Moving upwards into object (tails fly).
32 0x0020 STR_GUARD Protect against damage.
64 0x0040 STR_HEAVY Prevent vertical rebound when landing on enemies.
128 0x0080 STR_DASH Special type for machine dashmode, automatically removes your powers when leaving dashmode.
256 0x0100 STR_WALL Breaks any wall.
512 0x0200 STR_FLOOR Breaks floors.
1024 0x0400 STR_CEILING Breaks ceilings.
2048 0x0800 STR_SPRING Powers up spring objects.
4096 0x1000 STR_SPIKE Break spikes.
17 0x0011 STR_FLY Used by CA_FLY. Equal to STR_ANIM|STR_UPPER.
4224 0x1080 STR_METAL Used by SF_MACHINE dashmode. Equal to STR_DASH|STR_SPIKE.