From ZDoom Wiki
Jump to navigation Jump to search

void SpawnProjectile (int tid, string type, int angle, int speed, int vspeed, int gravity, int newtid);


SpawnProjectile is similar to the Thing_Projectile, Thing_ProjectileGravity, and Thing_Projectile2 specials, but instead of using a spawn ID you pass an actor's class name.


This script will fire an imp's fireball from the script activator's position, using the activator's angle, with a speed of 20.

script 1 (void)
    SpawnProjectile(0, "DoomImpBall", GetActorAngle(0) >> 8, 20, 0, 0, 0);

This script will make actors with a TID of 10 fire a Cacodemon's fireball every 10 tics, with an angle of 128 and a speed of 40.

script 2 OPEN
    SpawnProjectile(10, "CacodemonBall", 128, 40, 0, 0, 0);

This script will fire a random projectile at a random angle from a thing with TID 1 as specified by the projectile array at a horizontal speed of 20.

str projectile[3] = {"DoomImpBall", "CacodemonBall", "BaronBall"};

script 3 (void)
    SpawnProjectile(1, projectile[ random(0, 2) ], random(0, 255), 20, 0, 0, 0);
ACS spawn functions
Spawn SpawnForced
SpawnSpot SpawnSpotForced
SpawnSpotFacing SpawnSpotFacingForced