Turok EX Modding Guide

Scripts kPlayer

meta object for managing player state

stored in global var Player

related classes:

Inventory Functions

void ConsumeAmmo( int amt )

draws amt from current weapon's alt ammo if it has any, primary otherwise

the weapon's primary ammo will not be deducted if its alt ammo > 0, but < amt

negative values will add ammo to alt ammo if it has any, primary otherwise (will go over max; will not overflow from primary into alt)

int GetAmmo( int weaponSlot )

int GetAltAmmo( int weaponSlot )

returns how much primary or alt ammo the player has for the specified weapon*, respectively

returns 0 for weapons with no ammo type defined

bool HasAmmo( int weaponSlot )

returns whether the specified weapon* has any ammo of either type

always returns true for weapons with no ammo type defined

bool HasAltAmmo()

bool HasAltAmmo( int weaponSlot )

returns whether the player has any of the current or specified weapon's* alt ammo type, respectively

always returns false if the weapon has no alt ammo type defined

int CurrentWeapon()

returns the slot number* of the player's current weapon

bool HasWeapon( int weaponSlot )

returns whether the player has the specified weapon*

bool GiveWeapon( int weaponSlot, int ammoAmt )

Gives the player the specified weapon* with the specified amount of ammo.

Ammo is given as you'd expect: if the player already has ammo for the weapon, ammoAmt will be added to it, and it will not go over max.

Does not display pickup message. todo: refer to Game.PrintLine()

int16& Armor()

returns a reference to the player's armor

note that the displayed armor is 13 the actual armor amount

Other Functions

kPuppet@ Actor()

returns a handle to the player's actor

uint16 Buttons()

returns a bit field representing the player's input

possible inputs are:

BC_ATTACK
BC_JUMP
BC_FORWARD
BC_BACKWARD
BC_STRAFELEFT
BC_STRAFERIGHT
BC_WEAPONRIGHT
BC_WEAPONLEFT
BC_MAPZOOMIN
BC_MAPZOOMOUT

void Lock()

completely halts all player/weapon simulation

player freezes (even in mid air), camera locks in place (even bob effects), weapon freezes mid-animation, enemies behave as if you no longer exist, etc.

this is the same functionality used by cutscenes

void Unlock()

presumably undoes Lock()

bool Locked()

returns whether Lock() is in effect

void Victory( int warpTID = -1, int mapID = -1 )

plays a cutscene of Turok's boss-defeated pose, then returns control to the player

parameters control an optional warp at the end