From ZDoom Wiki
Jump to: navigation, search

int MorphActor (int tid, [str playerclass, [str monsterclass, [int duration, [int style, [str morphflash, [str unmorphflash]]]]]])


This function and its complement UnMorphActor give the ACS coder direct access to the engine's morph subsystem, instead of having to strategically place DECORATE items and suchlike.


  • tid: The actor(s) to morph. The activator is used if this parameter is zero.
  • playerclass: Defines what class to morph a player into.
  • monsterclass: Defines what class to morph a monster into.
  • duration: Defines the duration of the morphing effects.
  • style: Defines the behaviour of the morphing effects.
  • morphflash: Defines the effect flash actor to spawn when the player morphs. If omitted, the game's default teleport fog is used.
  • unmorphflash: Defines the effect flash actor to spawn when the player unmorphs. If omitted, the game's default teleport fog is used.

Excepting tid, the parameters are the same special properties defined by the MorphProjectile class. They are summarised above; for full details and additional notes, please refer to the MorphProjectile class.

Important note: the optional arguments are for the moment not optional due to a limitation in the current implementation of ACC. As a workaround, please treat all optional arguments to MorphActor as mandatory until the problem is resolved. Specify 0 for unused integer arguments and "" for unused string arguments. (This Wiki entry will be amended when the problem has been resolved.)


This function does honor the MRF_WHENINVULNERABLE flag when used on a player, provided that player is also the activator of the function.

The return value is the number of actors successfully morphed. This also means that for TID = 0, it's also a "boolean" (0=failed, 1=succeeded).


The following example assumes that a Cyberdemon with the DONTMORPH actor flag disabled has a TID of one. The function call turns him in to a pitiful little puppy demon, so you can kill him with ease. :)

Note that the Demon's DECORATE code is reproduced from zdoom.pk3 because the engine currently requires that all morphed monsters must inherit the MorphedMonster class and ZDoom does not support multiple inheritance; at the moment, you cannot arbitrarily morph one kind of monster into another.

script 1 (void)
	int morphed = MorphActor(1, "", "MorphDemon", 1048576, 0, "", "");
ACTOR MorphableCyberDemon : CyberDemon replaces CyberDemon

ACTOR MorphDemon : MorphedMonster
	Game Doom
	Health 150
	PainChance 180
	Speed 10
	Radius 30
	Height 56
	Mass 400
	SeeSound "demon/sight"
	AttackSound "demon/melee"
	PainSound "demon/pain"
	DeathSound "demon/death"
	ActiveSound "demon/active"
	Obituary "%o was killed by a dem... cyberd... well, by something anyway"
		SARG AB 10 A_Look
		SARG EF 8 A_FaceTarget
		SARG G 8 A_SargAttack
		Goto See
		SARG H 2
		SARG H 2 A_Pain
		Goto See
		SARG I 8
		SARG J 8 A_Scream
		SARG K 4
		SARG L 4 A_NoBlocking
		SARG M 4
		SARG N -1
		SARG N 5
		Goto See