FireProjectile


This verb's main purpose is to fire projectiles for the weapon cogs, but because of it's versatility, this verb can be used for other purposes. Syntax:

projectile=FireProjectile(fire_thing, template, sound, submode, offset_vec, error_vec, vel_flex, proj_flags, AA_FOV, AA_dist);

fire_thing: This is the thing to fire the projectile from. The fired projectile will travel in the direction that this thing is looking. And if the fire_thing is a creature, the projectile will travel in the direction of the creature's torso, and not the true lookvector of the fire_thing.1

The fired projectile will be linked to the fire_thing's parent chain. If the fire_thing has itself for a parent, it will become the parent of the projectile. Read the Thing Property Notes for more information on parents.

template: This is the template to create the projectile from.

sound: This is a sound to play as the projectile is created. Use -1 for this parameter if you don't want to play a sound.

submode: This is the submode number of a keyframe in the fire_thing's puppet. When the projectile is fired, the fire_thing will be played the keyframe. The most common submodes used are 8 for small fire and 18 for large fire. Use -1 for no animation.

offset_vec: This is an offset from the player's position that the projectile will appear at. It is in the form of 'sideways forward upward' and is given in JKUs. Projectiles are usually put a little in front and to the right of the fire_thing so that they look better in the POV camera.

error_vec: This vector is used to give aiming error to projectiles. It is given in the form: 'upward sideways null'. The error vector is, of course, 2d because you can't aim in front or behind a target.

vel_flex: This flex is used to scale the velocity of the projectile. This parameter will be ignored unless the 0x1 Projectile Flag is used.

proj_flags: These Projectile Flags control how the projectile is fired.

AA_FOV: This is the Field of View in degrees. If an enemy is within this FOV, the projectile will be aimed at it.

AA_dist: This is the distance for the auto-aim. If the enemy is farther away than this distance, the auto-aim will be canceled.


1Because of this, projectiles fired from a player have the lookvector of the player's torso. See the Player's Lookvector Solution in the Tutorial Section for more on this.