DamageThing

From ZDoom Wiki
Jump to: navigation, search

73:DamageThing (amount, mod)


  • amount: The amount of damage to deal. If negative, it will heal.
  • mod: The obituary message that will appear if a player is killed. Uses same values as Thing_Damage.

Usage

Hurts the thing that activated the special. If amount is 0, then the thing is guaranteed to be killed regardless of any invulnerability (including God and Buddha). If a player is killed with this special, the game reports “Player died.” as the obituary.

Examples

This script simulates the player being set on fire. It takes a parameter, which is the strength of the fire, from 1 to 20. Anything above 10 is extremely deadly.

script 165 (int power)
{
	if (power > 20)
		power = 20;
	
	while (power > 0)
	{
		FadeTo(255, 240, 0, 0.05 * power, 1.0);
		DamageThing(power);
		AmbientSound("vile/firecrkl", 5 * power--);
		Delay(35);
	}
}

The script first checks that the power variable is not set too high. Then, it loops using a “while” loop, checking to see if the fire still has power left each time. Inside the loop, the first command gives the screen a yellow glow depending on the power of the fire. The second command damages the player based on the power. The third command plays the Arch Vile's fire crackle effect and also reduces power by one (see the double minus). The last line delays the next strike.


There is an example of this command in the ActivatorTID article for a script that can be placed on a line so that the line kills any monster that crosses it, but leaves players be.

External links