Turok
 
Loading...
Searching...
No Matches
Turok Manual

View ScriptAPI Page
Download t1_scriptAPI.cpp
How to setup Angelscript IDE Codelite

T1_json2modbin.py: Python script to convert a json dictionary to a Turok 1 mod data file that can be used in scripting with Game.LoadModDataFile

Scripts Execution Order

.ctor               <-- (actor properties from def are assigned here and Origin, Yaw and SectorIndex are set here)
---
OnSpawn
OnBeginLevel        <--- (ALL actor properties from map are not setup until this point)
OnRestore
*Map Script 0       <--- (Called on PlayLoop tick 0)
OnPostBeginLevel
    (*Note: Any spawned actor created after each of these events will not be called for that spawned actor.
            If spawned before/during then it will/might be called.)
---
OnSleep
OnWake
OnTouch             <--- called even if alseep
OnCollide           <--- called even if alseep
OnTick              <--- called only when awake
---
OnMenuTick          <--- called only when dummymenu active
---
OnRemoved           <--- called when actor is removed (Internally or through scripting). IsStale will return true immediately after this.
---
OnActivate          <--- called immediately after World.TriggerActorsByTID and when player enters event sector area only if AF_ACTIVATED is Off
---
OnPreDamage         <--- always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to override the damage value to prevent death.
OnDeath             <--- called only when actor dies (health > 0 and health - dmg <= 0). The actors Target TID is automatically used to trigger actors at this point.
OnDamage            <--- always called when damaged even after death. Health is reduced after this by dmg only if health was greater than 0
---
OnEndLevel          <--- called when map unloads

ScriptObject Functions

void OnSpawn() - Required for all ScriptObject
void OnBeginLevel()
void OnRestore()
void OnPostBeginLevel()
void OnSleep()
void OnWake()
void OnTouch(kActor @theActorThatTouchedMe) //called even if alseep
void OnCollide(kCModel@) //called even if alseep
void OnTick() - Required for all ScriptObject
void OnMenuTick() - called only when dummymenu active
void OnRemoved() - called when actor is removed (Internally or through scripting). IsStale will return true immediately after this.
void OnActivate()
void OnDeactivate() //Never used
void OnPreDamage(kActor @instigator, kDictMem @damageDef, const int damage) //always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to override the damage value to prevent death.
void OnDeath(kActor @killer, kDictMem @damageDef) //called only when actor dies
void OnDamage(kActor @instigator, kDictMem @damageDef, const int damage) //always called even after death
void OnEndLevel()
void OnBeginFire()
void OnFire()
void OnEndFire()
void OnLower()
void OnRaise()
void OnHoldster()
ScriptObjectPlayer
void OnPickup(kActor @pickup)
void OnArmorDamage(kActor @instigator, kDictMem @damageDef, const int damage)
void OnEnterWater()
Read only Dictionary object that holds keys and values.
Base type used by all actors.
The kCModel(CModel) global stores collision results when certain actor methods are called....

GruntVariants

GV_GENERIC = 0,
GV_GENERIC_AXE = 1,
GV_GENERIC_CLUB = 2,
GV_COMMANDER_SPEAR = 3,
GV_COMMANDER_RIFLE1 = 4,
GV_COMMANDER_RIFLE2 = 5,
GV_COMMANDER_RIFLE3 = 6,
GV_GENERIC_RIFLE = 7,
GV_COMMANDER_RIFLE4 = 8,
GV_POACHER_KNIFE = 9,
GV_POACHER_PISTOL1 = 10,
GV_POACHER_PISTOL2 = 11,
GV_POACHER_RIFLE = 12,
GV_POACHER_SHOTGUN = 13,
GV_WARRIOR_BONE = 14,
GV_WARRIOR_DART = 15,
GV_WARRIOR_SPEAR = 16,
GV_SHAMAN = 17,
GV_CYBORG_PULSE_RIFLE = 18,
GV_CYBORG_KNIFE = 19,
GV_CYBORG_SPEAR = 20,
GV_DEMON_AXE = 21,
GV_DEMON_SPEAR = 22,
GV_DEMON_HANDS = 23,
GV_DEMON_LORD = 24,
GV_GENERIC_HANGING = 25,

Music Details

$0 = "music/track01.ogg" //jungle
$1 = "music/track07.ogg" //Catacombs
$2 = "music/track08.ogg" //Caves
$3 = "music/track04.ogg" //Boss Battle
$4 = "music/track13.ogg" //final confrontation
$5 = "music/track14.ogg" //Campaigner
$6 = "music/track02.ogg" //the Hub
$7 = "music/track09.ogg" //tree top village
$8 = "music/track11.ogg" //the lost land
$9 = "music/track12.ogg" //cyborg T-Rex
$11 = "music/track10.ogg" //Lost Land Caves
$13 = "music/track03.ogg" //ancient city
$14 = "music/track05.ogg" //The Ruins
$100 = "music/track06.ogg" // underwater theme

Area Args

Hardcoded:
0: AAF_TELEPORT: WarpID
1: AAF_TELEPORT: WarpLevelID,  AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
3: AAF_EVENT: tag ID
4: Not used
5: AAF_SECRET: the secret index value (set automatically when level loads starting at 0. Conflicts with Default Scripts AAF_DAMAGE (so I guess no secrets should be placed on damaga sectors))

Default Scripts:
0: Not used
1: Not used
2: Not used
3: Not used
4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024            

Enemy Attack Flags

--Grunts--
Alt Stance is for holding two handed weapons
Has Strong(anim_aiMelee1) and Weak(anim_aiAltMelee1) Melee Attacks
Projectile Attack 1 = Shaman Wand Throw Fast Fireball   (anim_aiRangeAttack1)
Projectile Attack 2 = Pistol Fire                       (anim_aiRangeAttack2)
Projectile Attack 3 = crouch rifle Fire                 (anim_aiRangeAttack7)
Projectile Attack 4 = Nothing                           (anim_aiRangeAttack8)
Projectile Attack 5 = Stand Rifle Fire                  (anim_aiRangeAttack5)
Projectile Attack 6 = Pipe Blow                         (anim_aiRangeAttack6)
Projectile Attack 7 = Grenade Throw                     (anim_aiRangeAttack3)
Projectile Attack 8 = High Priest Homing Blue Flame     (anim_aiRangeAttack4)
Projectile Attack 9 = chest hadoken                     (anim_aiRangeAttack9)
Projectile Attack 10 = Shaman Lightning Hands in Air    (anim_aiRangeAttack10)

--Raptor--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Plasma Shot (anim_aiRangeAttack1)

--Purlin--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Fire Wrist Gun    (anim_aiRangeAttack1)
Projectile Attack 2 = Jump Smash        (anim_aiRangeAttack2)
Projectile Attack 7 = Ground Wave Smash (anim_aiRangeAttack3)

--Stalker/Leaper--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Leap forward  (anim_aiRangeAttack1)

--Alien--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Fire Right Hand  (anim_aiRangeAttack1)
Projectile Attack 2 = Fire Left Hand   (anim_aiRangeAttack2)

--Beetle--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Leap forward  (anim_aiRangeAttack1)

--Crab--
No Alt Stance
Has Strong and Weak Melee Attacks

--Dinosaur--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Shoot Guns    (anim_aiRangeAttack1)

--Dragon Fly / Insect Flying--
No Alt Stance
Has No Melee Attacks
The Standing and Running Animations do damage attacks

--Killer Plant--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Shoot (anim_aiRangeAttack1)

--Mech--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Missle        (anim_aiRangeAttack1)
Projectile Attack 2 = Machine Gun   (anim_aiRangeAttack2)

--Rider--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Missle Fire   (anim_aiRangeAttack1)
Projectile Attack 7 = Rifle Fire    (anim_aiRangeAttack3)

--Sandworm--
No Alt Stance
Has Only Strong Melee Attacks
Projectile Attack 1 = Acid Spit (anim_aiRangeAttack1)

--Turret--
No Alt Stance
Has No Melee Attacks
Projectile Attack 1 = Fire (anim_aiRangeAttack1)

ActorFx Commands

Note: Time increases by GAME_FRAME_TIME (0.25f) every tick and is effected by the current GameSpeed.

$idle                                           // Does nothing and processes the next command
$wait (time)                                    // float time
$random_wait (minTime, maxTime)                 // float minTime, maxTime.
$trans (alpha)                                  // float alpha 0..255. Sets object alpha (if material supports alpha)
$fade_trans (alpha, time)                       // float alpha 0..255. float time. Lerps from current trans to new trans value.
$color ({r g b}, brightness)                    // int rgb 0..255, float brightness 0..255 (rgb * brightness)
$fade_color ({r g b}, brightness, time)         // int rgb 0..255, float brightness 0..255 (rgb * brightness), float time. Lerps from current rgb/brightness to new rgb/brightness values.
$scale ({x, y, z}, scaleTime)                   // float x, y, z. float scaleTime is unused, just always set to 255.0. Sets actors to scale.
$fade_scale ({x, y, z}, scaleTime, time)        // float x, y, z. float scaleTime is unused, just always set to 255.0. float time. Lerps from current scale to new scale.
$play_sound (ID)                                // Play a sound by ID
$repeat                                         // Starts back at processing the first command again.
$action (ID, {x y z w})                         // Calls a script animation function by ID with x,y,z,w values passed into the function.

Species Mask (Unused)

#define AI_SPECIES_RAPTOR (1<<0) // raptor dinosaur
#define AI_SPECIES_HUMAN1 (1<<1) // human being type 1
#define AI_SPECIES_SABERTIGER (1<<2) // saber tooth tiger
#define AI_SPECIES_DIMETRODON (1<<3) // dimetrodon
#define AI_SPECIES_TRICERATOPS (1<<4) // triceratops
#define AI_SPECIES_MOSCHOPS (1<<5) // moschops
#define AI_SPECIES_PTERANODON (1<<6) // pteranodon
#define AI_SPECIES_SUBTERRANEAN (1<<7) // subterranean
#define AI_SPECIES_LEAPER (1<<8) // leaper
#define AI_SPECIES_ALIEN (1<<9) // alien
#define AI_SPECIES_HULK (1<<10) // hulk
#define AI_SPECIES_ROBOT (1<<11) // robot
#define AI_SPECIES_MANTIS_BOSS (1<<12) // mantis boss

Spawn A Shoot Only Actor

kVec3 pos = Player.Actor().Origin();
kActor @m_pDummyActor = ActorFactory.Spawn("DummyActor", pos.x, pos.y, pos.z, Player.Actor().Yaw(), Player.Actor().SectorIndex());
m_pDummyActor.ImpactType() = IT_FLESH_HUMAN;
m_pDummyActor.Radius() = 16;
m_pDummyActor.Height() = 32;
kPlayer Player
@ IT_FLESH_HUMAN
@ AF_NOMOVEMENT
will not do collision movement
@ AF_ALWAYSACTIVE
never sleep or go dormant
@ AF_CANBETOUCHED
allow invoking the OnTouch callback
@ AF_NODRAW
don't render
@ AF_DISABLED
don't update animations
@ AF_DEAD
actor is dead. handle special cases for collision
@ AF_CASTSHADOW
can cast a simple shadow
@ AF_SOLID
Can be collided.
@ AF_ALIGNTOFLOOR
rotate along slopes
@ AF_AVOIDWATER
clip against edges linking to water sectors
kActorFactory ActorFactory
Representation of 3D vectors and points.
int & ImpactType()
EnumImpactType.
float & Height()
uint & Flags()
EnumActorFlags.
float & Radius()

kfont file

filter linear   // Sets texture filter to linear (default = nearest)
filter nearest  // Sets texture filter to nearest (default = nearest)
texture "fonts/bigfont.png" // path to font texture atlas. (default = kex default checker texture)
padwidth 1.0    // Adds this amount to each characters width (default = 0.0)
scale 1.0       // (default = 1.0)
unicode         // (default = ascii)
noaccentoffset  // Disables the y offset for accent characters. (default = draw accent characters with a y offset)
                // Hardcoded character accent y offsets:
                // 224-228  (offset 11)
                // 232-235  (offset 13)
                // 236-239  (offset 12)
                // 242-246  (offset 11)
                // 246      (offset 13)
                // 249-252  (offset 13)
                // 253      (offset 11)

mapchar
{
    // char  x y width height  O (draw top offset)  // Leave a comment if you want but don't end any comment line with a backslash ( \ ) or the text preprocessor will think it's a line continuation and you'll have problems
        48   0 0  24     32    0                    // zero character
}

Sound Shader

sounds[1] = //number of sounds in this shader
{
    {
        wavefile = "sounds/waves/talset/ashamed.wav" // the sound file path
        bOneInstancePerSource = 0   // if sound has a source then this can only be played if this sound is not being played.
        bLoop = 0                   // loops the sound when it plays
        bEnableVolumeEnvelope = 0   // enable the volume_envelope lerp
        bEnablePitchEnvelope = 0    // enable the pitch_envelope lerp
        bFadeIfObstructed = 0       // on every other tick, if the sound has a source and CanSee player then keeps volume at normal, if can't see the player then fades out the volume.
        bUpdateNoEnvelope = 0       // NOT USED
        bLinkToEnvelope = 0         // NOT USED
        bFullVolume = 0             // always play sound at maximum volume with no positioning
        delay = 0                   // delay time (in ticks) before will start playing the sound
        priority = 80               // when 64 sounds are being played, higher priority sounds will stop lower priority sounds in order to play. If there are no sounds it can override then will not play the sound.
        random = 1.000000           // if not 1: if playloop ticks bit 1 is set then won't play, OR if random value from 0.0 to 1.0 >= random then won't play.
        radioVolume = 2             // 0: dist = (GAME_SCALE * 200) * 0.75f,  volume * 0.8f
                                    // 1 or any other value: dist = (GAME_SCALE * 200),  volume * 1.0f
                                    // 2: dist = (GAME_SCALE * 200) * 1.2f,  volume * 1.5f
                                    // 3: dist = (GAME_SCALE * 200) * 2.0f,  volume * 1.5f
        volume_envelope =
        {
            max = 1.000000          // how much to scale the volume by (even if bEnableVolumeEnvelope is 0). Default is 1.0 if you don't include this.
            start = 1.000000        // lerp from
            end = 1.000000          // lerp to
            duration = 60           // lerp time
            envStartTime = 0        // Delay time (in ticks) before the volume will lerp from the start to the end value.
        }

        pitch_envelope =
        {
            max = 1.000000          // is always starting pitch value (even if bEnablePitchEnvelope is 0). Default is 1.0 if you don't include this.
            start = 1.000000        // lerp from
            end = 1.000000          // lerp to
            duration = 60           // lerp time
            envStartTime = 0        // Delay time (in ticks) before the pitch will lerp from the start to the end value.
        }
    }
}

GameVariables Special Keys

Float:
    player.groundForwardSpeed   // Get and Set all these player variables using the kPuppet functions instead.
    player.groundBackwardSpeed
    player.groundStrafeSpeed
    player.groundForwardAccel
    player.groundBackwardAccel
    player.groundStrafeAccel
    player.groundDeaccel
    player.swimForwardSpeed
    player.swimBackwardSpeed
    player.swimStrafeSpeed
    player.swimForwardAccel
    player.swimBackwardAccel
    player.swimStrafeAccel
    player.swimDeaccel
    player.jumpMinSpeed
    player.jumpMaxSpeed
    player.jumpClimbSpeed
Int:
    g_difficulty                // Use Game.GetDifficulty or Game.SetDifficulty instead.
    g_startmap                  // The map to start on when starting a new game
    g_restartmap                // The map to go to when restart game is called
    g_trainingmap               // The map to go to when starting training or time trial
    g_creditsmap                // The map to go to when starting the credits
    g_gallerymap                // The map to go to when entering the gallery
    g_hubmapid                  // The map to go to when using the all keys cheat
    g_hubwarptid                // The warp TID to warp to when using the all keys cheat
    chronoPieceFlags            // Each bit indicates if that chrono piece has been picked up. Important: This key must be added through the scripts!
    player.overrideShadow       // Get: Player.Actor().OverrideShadow()  Set: Player.Actor().SetOverrideShadow();  0=none, 1=Force Disable shadow, 2=Force Enable shadow
    player.overrideWalkRun      // Get: Player.Actor().OverrideWalkRun()  Set: Player.Actor().SetOverrideWalkRun();  0=none, 1=Force Disable Walk
    OverrideFogType             // Set: Game.OverrideFogType();  Get: GameVariables.GetInt("OverrideFogType", result);  0=none, 1=force Radial, 2=force Plane
    OverridePerPolyCollision    // Set: Game.OverridePerPolyCollision();  Get: GameVariables.GetInt("OverridePerPolyCollision", result);  0=none, 1=force disable, 2=force enable
    ConfirmMenuResult           // Get: GameVariables.GetInt("ConfirmMenuResult", result);  Set: GameVariables.SetValue("ConfirmMenuResult", "0");
    g_loadedgame                // Check OnBeginLevel. value is the save slot from 1 to 16. any other value is game was not loaded. Is set to 0 after Map Script 0 is called.
Bool:
    g_newgame                   // is set to 1 when starting a newgame. Check OnBeginLevel.
    g_resetboss                 // is set to 1 when warping to the boss using the warp boss cheats. This sets them to their initial state. Is set back to 0 after OnPostBeginLevel is called.
    g_timetrial                 // is set to 1 when selecting time trial from the menu. Is set back to 0 after OnPostBeginLevel is called.
    DisableUnderwaterMusic      // Use GameVariables.SetValue("DisableUnderwaterMusic", "1");
    DisableWaterReflection      // Use GameVariables.SetValue("DisableWaterReflection", "1");

Difficulty

Easy:
- Damage enemies receive is scaled by 1.4
- Damage bosses receive is scaled by 1.1
- Enemies animation speed is normal.
  - AnimScalar() = 1.0
  - BlendScalar() = 10.0
- Normal enemy reaction times
- Normal chance to do range attacks
- Enemies drop items

Normal:
- Damage enemies receive is scaled by 1.0
- Damage bosses receive is scaled by 1.0
- Enemies animation speed is normal.
  - AnimScalar() = 1.0
  - BlendScalar() = 10.0
- Normal enemy reaction times
- Normal chance to do range attacks
- Enemies drop items

Hard:
- Damage enemies receive is scaled by 0.7
- Damage bosses receive is scaled by 0.9
- Enemies animation speed is fast.
  - AnimScalar() = 0.85
  - BlendScalar() = 6.0
- Fast enemy reaction times
- High chance to do range attacks
- Enemies do NOT drop items

Hardcore:
- Damage enemies receive is scaled by 0.7
- Damage bosses receive is scaled by 0.9
- Enemies animation speed is very fast.
  - AnimScalar() = 0.6
  - BlendScalar() = 4.0
- Very fast enemy reaction times
- Very High chance to do range attacks
- Enemies do NOT drop items
- Enemies turn twice as fast