Classes:MorphProjectile

From ZDoom Wiki
Jump to navigation Jump to 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 will 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.
Morph projectile base class
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name MorphProjectile


Classes: MorphProjectile
 →EggFX
 →PorkFX

MorphProjectile is the base class for projectiles that morph actors into other actors (such as the Morph Ovum). By inheriting from it you can create custom morph projectiles.

DECORATE definition

ACTOR MorphProjectile native
{
  Damage 1
  Projectile
  -ACTIVATEIMPACT
  -ACTIVATEPCROSS
}

Using in DECORATE

The MorphProjectile base class defines the following properties which are available to all inventory subclasses:

  • MorphProjectile.PlayerClass classname
Defines what class to morph players into.
  • MorphProjectile.MonsterClass classname
Defines what class to morph monsters into.
  • MorphProjectile.Duration tics
Defines the time that the victim stays morphed.
  • MorphProjectile.MorphStyle flags
Defines the behaviour of the morphing effects. Use | to use multiple flags at once. Omitting this property or specifying it as zero causes the default Heretic/Hexen behaviour to be applied; see the notes below for more information. These flags only affect morphed players (not morphed monsters) except where explicitly stated in a flag's description.
  • MRF_ADDSTAMINA — The current stamina is added to the maximum health that is effect (see MRF_FULLHEALTH) whenever the player receives health via normal means. This is normal under-the-hood behaviour that is by default suppressed when morphed. You would normally leave it off for a morph curse and turn it on for a morph powerup. Note that by default, only Strife games define a stamina mechanism.
  • MRF_FULLHEALTH — The morphed player's maximum health is the MaxHealth of the morphed player class (instead of hardcoded to 30).
  • MRF_UNDOBYTOMEOFPOWER — A morphed player unmorphs when they activate a Tome of Power.
  • MRF_UNDOBYCHAOSDEVICE — A morphed player unmorphs when they activate a Chaos Device.
  • MRF_FAILNOTELEFRAG — A morphed player stays morphed if unmorph by Tome of Power fails, instead of being telefragged.
  • MRF_FAILNOLAUGH — A morphed player doesn't laugh if unmorph by Chaos Device fails.
  • MRF_WHENINVULNERABLE — A player can morph when invulnerable but ONLY if morphing themselves via a morph powerup.
  • MRF_LOSEACTUALWEAPON — When the player unmorphs, the actual weapon given by the Player.MorphWeapon property is taken away.
  • MRF_NEWTIDBEHAVIOUR — A morphed actor's TID is by default transferred from the old actor to the new actor. (Applies to players and monsters)
  • MRF_UNDOBYDEATH — A morphed actor unmorphs when killed and (unless MORPH_UNDOBYDEATHSAVES is also used) stays dead. (Applies to players and monsters)
  • MRF_UNDOBYDEATHFORCED — A morphed actor having the MRF_UNDOBYDEATH style flag, is guaranteed to unmorph when killed. (Applies to players and monsters)
  • MRF_UNDOBYDEATHSAVES — A morphed actor having the MRF_UNDOBYDEATH style flag unmorphs normally when killed, instead of dying. (Applies to players and monsters)
  • MRF_UNDOALWAYS — Certain conditions would prevent an unmorph from occurring when the morph powerup expires, such as not having enough room, so it would continue to attempt unmorphing every second. This disables these conditions entirely and forces them to unmorph no matter what.
  • MRF_TRANSFERTRANSLATION — Transfers the actor's translation to the morphed actor. (Applies to players and monsters)
  • MorphProjectile.MorphFlash classname
Defines the effect flash actor to spawn when the victim morphs. If omitted, the game's default teleport fog is used.
  • MorphProjectile.UnMorphFlash classname
Defines the effect flash actor to spawn when the victim unmorphs. If omitted, the game's default teleport fog is used.

Notes

Actors can be defined such that they are unable to unmorph once morphed (the duration property is ignored) or cannot be morphed (most bosses have this).

For the morph style, it is important to be aware that when given health by a normal means, a maximum of 30 health is imposed and no stamina applied on top; furthermore, various other effects such as limited (or no) weapon switching and the inability to pick up items are hardcoded into the game or affected in other ways that to a DECORATE coder seem totally unpredictable. The reason for this new functionality being added was to bring the effects of morphing under DECORATE control and make it predictable. To this end, new flags will be added from time to time.

If an unmorph attempt fails, the engine will try to unmorph the player automatically every two seconds until it succeeds. Failure occurs if the player is stuck in something (solid object, wall, low ceiling, crusher, etc). MRF_UNDOALWAYS can be used to ignore stuck checking and unmorph them regardless.

Until the existence of morph powerups, invulnerability protected the player against morphing because it always occurred as the result of an attack; however, an invulnerable player should obviously be able to morph themselves, hence the introduction of the MRF_WHENINVULNERABLE flag. MorphProjectiles recognize this flag but ignore it, in order to preserve the integrity of the invulnerability effect.

When a player unmorphs, the engine by default takes away whichever weapon the player is wielding at the time; the assumptions behind this are no longer valid due to enhancements to the game made by ZDoom. With the MRF_LOSEACTUALWEAPON flag, the player only loses the weapon given upon morphing; furthermore, if the weapon was one that the player already had before morphing, it is not taken away at all. This new behavior is actually a bug fix, but must be activated via a style flag because existing mods may depend upon the old behavior.

When a player is morphed the TID can now be transferred via the MRF_NEWTIDBEHAVIOUR flag. This new behavior is actually a bug fix, but must be activated via a style flag because existing mods may depend upon the old behavior.

By default, an actor stays both morphed and dead if killed while morphed. The engine's normal thing spawn checks are also applied to an unmorphing actor and by default, the engine retries a failed unmorph every two seconds until it succeeds. Forcing the unmorph to occur via the MRF_UNDOBYDEATHFORCED flag makes sense if the monster will die upon unmorphing, because corpses are by default non-solid; however, using MRF_UNDOBYDEATHFORCED and MRF_UNDOBYDEATHSAVES together could leave an unmorphed but resurrected actor stuck inside a wall or even another actor, so use these flags with care.

For a flash actor, specifying "" or omitting the relevant property altogether means "use the default". To have no flash at all, a silent flash or a sound but no visible effect, define and specify the following actor or one like it:

ACTOR NoFlash
{
 // SeeSound "mysounds/myflashsound"
 RenderStyle None
 States
 {
 Spawn:
  TNT1 A 1
  Stop
 }
}