Classes:PowerupGiver

From ZDoom Wiki
Jump to: navigation, search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do not need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it's actually harmful as it can cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
  5. There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
Inventory
Actor type Internal Game MiniZDoomLogoIcon.png
DoomEd Number None Class Name Inventory


Classes: InventoryPowerupGiver
 →ArtiFly
 →ArtiInvisibility
 →ArtiInvulnerability
 →ArtiInvulnerability2
 →ArtiSpeedBoots
 →ArtiTomeOfPower
 →ArtiTorch
 →BlurSphere
 →EnvironmentalSuit
 →Infrared
 →InvulnerabilitySphere
 →RadSuit
 →Scanner
 →ShadowArmor
 →Targeter

A PowerupGiver is used to give one of the existing powerups to the player using or picking up this item. PowerupGiver is never used directly. It is only used as a base class for many predefined inventory items (e.g. the partial invisibility sphere of Doom) or as a base to define new powerup pickups.


Using in DECORATE

There are two ways to define a powerup giver item:

  • Items that activate automatically when the player picks them up
  • Items that go into the player's inventory and have to be used to do their work.

To create items that get used automatically you have to set inventory.maxamount to 0 and specify the flag +INVENTORY.AUTOACTIVATE. In any other case you will create items that go into the inventory.

Powerup givers support these special properties in addition to the basic Inventory properties:

  • Powerup.Color color, alpha
  • Powerup.Color BlueMap
  • Powerup.Color GoldMap
  • Powerup.Color GreenMap
  • Powerup.Color InverseMap
  • Powerup.Color RedMap
Specifies the color and the opacity of the screen blend that is used when the powerup is active. Color is specified either as three integers, an "RR GG BB" string or a color name from the X11R6RGB lump. Alpha is a value between 0.0 and 1.0. Instead of specifying a color you can also use the predefined values 'BlueMap', 'GoldMap', 'GreenMap', 'InverseMap' and 'RedMap'. These don't set a blending value but instead use a predefined blend.
  • Powerup.Colormap [sourcecolor, ]destcolor
A generalization of the colormaps (which, counter-intuitively, are used with Powerup.Color), this creates a color ramp from the source color to the destination color. This uses decimal numbers for the red, green, blue components, ranging from 0.0 to 1.0, inclusive. If only one color is provided, then black (0.0, 0.0, 0.0) is used as the source color. For example, Powerup.Colormap 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 and Powerup.Colormap 1.0, 1.0, 1.0 both create a grayscale, Powerup.Colormap 1.0, 1.0, 1.0, 0.0, 0.0, 0.0 creates the well known inverse map and Powerup.Colormap 1.0, 0.0, 0.0, 0.0, 1.0, 0.0 creates a red to green effect.
  • Powerup.Duration time
The length of time the power up will last in tics (1/35 of a second). If a negative duration is given, it will be taken as the duration in seconds (e.g., -30 is half a minute, while 30 is less than a second). The maximum duration is 0x7FFFFFFF, which corresponds to about two years of real time and can therefore safely be used for permanent powerups. Note, however, that due to the design of the TimeFreezer powerup, using such a duration value for this powerup is not recommended, as the engine will add one tic to the powerup's duration if it was activated on an odd game tic, resulting in a signed overflow error. A value of 0x7FFFFFFE is safe to use in such a case.
  • Powerup.Mode mode
For some powerups which may behave in different ways, specify the mode. Currently affects Invulnerability and Invisibility.
  • Invulnerability modes: None and Reflective. "None" is invulnerability without any added effect. "Reflective" also makes all projectiles bounce off of the player while the powerup is in effect.
  • Invisibility modes: Cumulative, Fuzzy, Opaque, Stencil and Translucent. Cumulative" allow multiple invisibility powerups of the same type to stack when active at the same time, adding their strength value together. "Fuzzy" uses the fuzz effect renderstyle, like that of the spectre. "Opaque" results in an opaque renderstyle, making the actor not invisible graphically speaking. "Stencil" uses the stencil renderstyle, showing just the shape. "Translucent" is merely a way of explicitly specifying the default invisibility mode.
  • Powerup.Strength strength
The magnitude of a powerup's effect. Currently applies to Invisibility (and Regeneration (development version 1c889dc only)), as other powerups have unquantifiable effects or use predetermined fields such as DamageFactor.
  • Invisibility strength: determines how translucent the affected actor becomes. 0 is for opaque, and 100 is for fully invisible. Does not apply to "Fuzzy" mode.
  • Regeneration strength: determines the amount of health regenerated. (development version 1c889dc only)
  • Powerup.Type power_name
The type of powerup given when item is used. This must be the name of an existing powerup; though optionally the "Power" prefix may be left out.
Standard powerups are: Buddha (development version 313245d only), Damage, DoubleFiringSpeed, Drain, Flight, Frightener, Ghost, HighJump, InfiniteAmmo, Invisibility, Invulnerable, IronFeet, LightAmp, Mask, Minotaur, Morph, Protection, Regeneration, Scanner, Shadow, Speed, Strength, Targeter, Torch, WeaponLevel2 and TimeFreezer.

Examples:

This defines Heretic's invulnerability item and is an example for an item that is put in the inventory:

actor ArtiInvulnerability : PowerupGiver 84
{
  spawnid 133
  inventory.pickupmessage "RING OF INVINCIBILITY"
  inventory.icon "ARTIINVU"
  inventory.respawntics 4230
  inventory.defmaxamount
  powerup.duration 30
  powerup.type "Invulnerable"
  +COUNTITEM
  +FLOATBOB
  +INVENTORY.PICKUPFLASH
  states
  {
  Spawn:
    INVU ABCD 3
    loop
  }
}

This defines Doom's Light Amplification Visor and is an example for an item that activates when being picked up:

actor Infrared : PowerupGiver 2045
{
  spawnid 138
  inventory.pickupmessage "Light Amplification Visor"
  inventory.maxamount 0
  powerup.duration 90
  powerup.type "LightAmp"
  +COUNTITEM
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Spawn:
    PVIS A 6
    PVIS B 6 bright
    loop
  }
}

DECORATE definition

ACTOR PowerupGiver : Inventory native
{
  Inventory.DefMaxAmount
  +INVENTORY.INVBAR
  +INVENTORY.FANCYPICKUPSOUND
  Inventory.PickupSound "misc/p_pkup"
}