A_CustomPower

From SRB2 Wiki
Jump to: navigation, search

A_CustomPower is an action that gives the target (must be a player) a power-up, and plays SeeSound. The power-up is determined by Var1. Var2 sets the value of the power-up (how much of the power-up the player gets, or the duration). If any of the shield powers are selected using this action, the shield orb for the power given will be automatically spawned if it doesn't already exist on the player.

In SRB2, this action is internally used by linedef type 434, using a dummy MT_NULL Object to call A_CustomPower with the player who triggered it set as the target. Flag [6] / Not Climbable checked on this linedef special will make any timer powers infinite in duration – this is achieved in SOCs or Lua scripts using A_CustomPower by setting Var2 to UINT16_MAX (65535), a special value that prevents timer powers from reducing their values. NUMPOWERS can be used to retrieve the number of powers for Lua.

The custom powers are as follows:

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 Timer to prevent Springs from activating multiple times.
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.

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.

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.

  Actions – Powers and monitors [view]
A_1upThinkerA_AwardScoreA_BombShieldA_CustomPowerA_EggmanBoxA_ExtraLifeA_GiveShieldA_ForceShieldA_GiveWeaponA_GravityBoxA_InvincibilityA_JumpShieldA_MixUpA_MonitorPopA_PityShieldA_RecyclePowersA_RingBoxA_RingShieldA_SuperSneakersA_WaterShield