Turok EX Modding Guide

Scripts ScriptObject ScriptObjectWeapon

Base class of all weapon scripts, associated with a kWeapon actor. Weapon classes are defined in scripts/weapons.txt.

Every weapon is intialized at level start, not just those the player owns.

Ammo is managed by kPlayer, which you can get a reference to with kWeapon::Owner().

Inherited Functions

void OnBeginLevel()

seems to be skipped during initialization (other events are called as usual)

void OnTick()

called twice every tick, if it's the current weapon

Weapon Functions

void OnBeginFire()

Called if the fire button is pressed, and the weapon is idle.

The weapon will remain in the firing state until an animation ends (by completing or being stopped manually – interrupting with another animation does not count as "ending" the previous animation), or until anim_weaponIdle or anim_weaponIdleUnderwater is playing.

Therefore, if you do not play an animation in this function:

void OnFire()

called every tick, if the weapon is firing

first called one tick after OnBeginFire()

void OnEndFire()

called when the player first releases the fire button while the weapon is firing

void OnRaise()

called at the end of swap-in anim, when changing weapons or after climbing

void OnLower()

called at the end of swap-out anim, when changing weapons

void OnHoldster()

called at the end of swap-out anim, when climbing