A_ThrowGrenade

From ZDoom Wiki
Jump to: navigation, search

bool A_ThrowGrenade (string spawntype [float zheight [, float xyvel [, float zvel [, bool useammo]]]])

Spawns a projectile and throws it like a grenade. This function can be used for monsters, inventory items and weapons. useammo only has an effect when used with a weapon.

The parameters are:

  • spawntype: Type of the projectile to be spawned.
  • zheight: Height at which the projectile is spawned. The function adds 35 to this, so that passing 0 means at the center of the throwing actor.
  • xyvel, zvel: Speed with which the object is thrown.

Examples

This is a grenade-throwing zombie. The attack sound was changed so that it would not use the default pistol firing sound for throwing a grenade.

ACTOR GrenadierZombie : ZombieMan
{
  AttackSound ""
  States
  {
  Missile:
    POSS E 10 A_FaceTarget
    POSS F 8 A_ThrowGrenade("Grenade", 20, 8, 4)
    POSS E 8
    Goto See
  }
}