COG Verb - FireProjectile

Messages:

Verbs:

Flags:

Create a thing and "fire" it.

projectile = FireProjectile(origin_thing, projectile_template, projectile_sound, submode, offset, aim_error, extra, projectile_flags, horizontal_field_of_view, vertical_field_of_view);

Parameters

origin_thing [thing] The thing that "fires" the projectile. The projectile will travel in the direction that this thing is looking (which includes the torso pitch). The projectile is linked to the origin_thing's parent chain. If the origin_thing has itself for a parent, it will become the parent of the projectile.

projectile_template [template] The template used to create the projectile.

projectile_sound [sound] Sound that plays when projectile is created. Use -1 to not play a sound.

submode [int] Index of keyframe submode animation played when projectile is created. The submode needs to be listed in the projectile_template's pup file. Use -1 for no animation. (The most common submodes used in the LEC levels are 8 for small fire and 18 for large fire.)

offset [vector] [Form: 'sideways forward upward'. Units: JKUs.] Offset from the origin_thing's position where the projectile is created.

aim_error [vector] [Form: 'upward sideways 0'. Units: JKUs.] Gives aiming error to projectile. The vector is 2D because aiming in front or behind a target is not used.

extra [flex] Used by various Projectile Flags to control the projectile.

projectile_flags [int] Projectile Flags

horizontal_field_of_view [int] [Unit: Degrees.] If an actor is within the horizontal and the vertical fields of view, the projectile is auto-aimed at the actor. The 0x20 Projectile Flag must be set to enable auto-aim, and the 0x40 flag must be set to enable auto-aim in multiplayer.

vertical_field_of_view [int] [Unit: Degrees.] (See previous parameter description.)

Return Values

projectile [thing]

Notes

When this verb is used in Mulitplayer games, a network message is sent to all players' computers, regardless of cog flags, even if the projectile_template is in static.jkl. However, if the projectile_template is in static.jkl, the projectile is only created on the computer that called the verb. (This is usually why mods with new projectiles either don't work as expected or have higher lag than mods without new projectiles.)

Related Verbs

CreateThing, CreateThingNR, CreateThingAtPos, CreateThingAtPosNR

Used In

Examples

  • Create:
This page was last modified 18:42, 25 October 2009.   This page has been accessed 2,990 times.