|
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
- This actor is already defined in GZDoom, there's no reason to define it again.
- In fact, trying to define an actor with the same name will cause an error (because it already exists).
- If you want to make your own version of this actor, use inheritance.
- Definitions for existing actors are put on the wiki for reference purpose only.
|
Increased damage power
|
Actor type
|
Power
|
Game
|
(ZDoom)
|
DoomEd Number
|
None
|
Class Name
|
PowerDamage
|
Classes: Inventory→Powerup→PowerDamage
(more)
One of the many powerups, i.e. items based on the Powerup class. While an item of this class is placed in an actor's inventory, the actor will be affected by it. Usually powerups are given through a PowerupGiver, but they can be given directly as well (see here for more details).
PowerBuddha modifies the damage its owner deals by using a ModifyDamage override.
Examples
A double damage item:
class PowerDoubleDamage : PowerDamage
{
Default
{
DamageFactor "normal", 2;
Inventory.Icon "MEGAA0";
}
}
A Quad damage item and an example of an accompanying PowerupGiver:
class PowerQuadDamage : PowerDamage
{
DamageFactor "normal", 4;
Inventory.Icon "MEGAA0";
}
actor QuadDamage : PowerupGiver
{
Default
{
Powerup.Type 'QuadDamage';
Powerup.Duration 1000;
Inventory.PickupMessage "Quad Damage!!"; // This is an example. It's recommended to use LANGUAGE for player-facing strings.
Powerup.Color "LawnGreen", 0.25
Inventory.MaxAmount 0;
Inventory.UseSound "pickups/slowmo";
Translation "128:143=120:127";
+Inventory.AUTOACTIVATE
+Inventory.FANCYPICKUPSOUND
}
States
{
Spawn:
MEGA ABCD 4 bright;
loop;
}
}
|
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
|
class PowerDamage : Powerup
{
Default
{
Powerup.Duration -25;
}
//===========================================================================
//
// InitEffect
//
//===========================================================================
override void InitEffect()
{
Super.InitEffect();
if (Owner != null)
{
Owner.A_StartSound(SeeSound, CHAN_5, CHANF_DEFAULT, 1.0, ATTN_NONE);
}
}
//===========================================================================
//
// EndEffect
//
//===========================================================================
override void EndEffect()
{
Super.EndEffect();
if (Owner != null)
{
Owner.A_StartSound(DeathSound, CHAN_5, CHANF_DEFAULT, 1.0, ATTN_NONE);
}
}
//===========================================================================
//
// ModifyDamage
//
//===========================================================================
override void ModifyDamage(int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags)
{
if (!passive && damage > 0)
{
newdamage = max(1, ApplyDamageFactors(GetClass(), damageType, damage, damage * 4));
if (Owner != null && newdamage > damage) Owner.A_StartSound(ActiveSound, CHAN_AUTO, CHANF_DEFAULT, 1.0, ATTN_NONE);
}
}
}
|
Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
|
ACTOR PowerDamage : Powerup native
{
Powerup.Duration -25
}