kGame
stored in global var Game
Level Sripts
void CallDelayedMapScript( int scriptID, kActor@ instigator, float delay )
void CallDelayedMapScript( kStr& s, kActor@ instigator, float delay )
invoke a level script after delay
seconds, or 1 tick, whichever is longer
the int version can invoke $script
s by their ID
the string version can invoke by name any level script function with the following type signature:
void( kActor@ )
both versions will simply do nothing if the specified script does not exist
void HaltMapScript( int scriptID )
terminates a map script in a $restart
loop or waiting to begin/continue
Other Level Methods
void ChangeMap( kStr& path )
change to an arbitrary map by file path (does not need to be defined in defs/mapInfo.txt)
screen fades to black (sets cinematic state to 1
then 5
), as opposed to teleportation screen effects
bool GetHubKeyInfo( uint levelNum, int& keys, int& remaining, int& lockBits )
gets info on level keys:
levelNum
is the number of the level to check, as defined in defs/mapInfo.txtkeys
will be set to the total number of keys on the level, as defined in defs/mapInfo.txtremaining
will be set to how many keys are left to find on the levellockBits
will be a bit field of which keys required to enter the level have been found
returns whether levelNum
is defined
int GetMapNumberFromName( kStr& levelName )
number of a level block in defs/mapInfo.txt
e.g., GetMapNumberFromName("Map_SpiritWorld")
returns 11
returns -1
if not found
int GetCurrentMapID()
mapid
of the current map
returns -1
if the current map isn't in defs/mapInfo.txt
Music
void PlayMusic( kStr& path, bool bLoop )
void StopMusic()
Title
void Restart()
return to title screen
void ShowMainMenu()
display title screen menu
Text
void PrintLine( kStr& msg, int lineNum, int ticks = 120 )
void PrintHelp( kStr& msg, bool bEndGame = false )
kStr GetLocalizedText( kStr& key )
Other
int GetDifficulty()
current difficulty setting
possible values are:
- DIFFICULTY_EASY
- DIFFICULTY_NORMAL
- DIFFICULTY_HARD
- DIFFICULTY_HARDCORE
Particles
void SpawnFx( kStr& path, kActor@ source, kVec3& vel, kVec3& loc, kQuat& rot )
void SpawnFx( kStr& path, kPuppet@ source, kVec3& vel, kVec3& loc, kQuat& rot )
void SpawnFx( kStr& path, kActor@ source, kVec3& loc, kQuat& rot )
void SpawnFx( kStr& path, kPuppet@ source, kVec3& loc, kQuat& rot )
void SpawnFx( kStr& path, kActor@ source, kVec3& loc, float f1, float f2 )
void SpawnFx( kStr& path, kPuppet@ source, kVec3& loc, float f1, float f2 )
void SpawnFx( kStr& path, kVec3& loc, int sector )
vel
will be used instead of source
's velocity for particles with bAddOffset
(delta per tick)
loc
is global