Turok
 
Loading...
Searching...
No Matches
kAI Class Reference
Inheritance diagram for kAI:
kActor

Public Member Functions

uint & AIFlags ()
 EnumAIFlags.
 
void SetupAISpawnFlags ()
 call after setting your actors spawnflags for them to take effect on the kAI
 
int & AttackChance ()
 0-100
 
float & AttackRange ()
 squared
 
float & MeleeRange ()
 squared
 
float & LeashRadius ()
 squared
 
float & SightRange ()
 squared
 
float & LoudRange ()
 squared
 
float & QuietRange ()
 squared
 
float & FlyHeight ()
 squared
 
float & SightFOV ()
 in rads
 
int & Agitation ()
 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
 
float & AnimScalar ()
 default = 1.0f
 
float & BlendScalar ()
 default = 10.0f
 
int & Regenerate ()
 get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBeginLevel is called and is set to a random value from 0 to the mapActors maxRegenerations value or the actors def ai.maxRegenerations value(for non map actors).
 
- Public Member Functions inherited from kActor
const bool IsStale () const
 Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this actor.
 
kAngleYaw ()
 
kAnglePitch ()
 
kAngleRoll ()
 
kVec3Origin ()
 Position in world space.
 
kVec3Scale ()
 
kVec3PrevOrigin ()
 
void SetTarget (kActor@ actor)
 
kActor GetTarget ()
 
void SetSector (const uint sectorIndex)
 
void Remove ()
 Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
 
kVec3Velocity ()
 
kVec3Movement ()
 
kQuatRotation ()
 
int16 & Health ()
 
int & Type ()
 The actors Type ID.
 
int & ImpactType ()
 EnumImpactType.
 
int & ImpactTypeDmg ()
 EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
 
bool & IgnoreSectorHeightChange (void)
 if true will not change position(or velocity and movement) when sector height changes.
 
int & ModelVariation ()
 
int & SpeciesMask ()
 
uint & Flags ()
 EnumActorFlags.
 
const uint SpawnFlags1 () const
 EnumActorSpawnFlags1.
 
const uint SpawnFlags2 () const
 EnumActorSpawnFlags2.
 
const uint SpawnFlags3 () const
 EnumActorSpawnFlags3.
 
const int TID () const
 
float & Radius ()
 
float & Height ()
 
float & StepHeight ()
 AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the actor when they are dead so you can still shoot them.
 
float & WallRadius ()
 
float & Gravity ()
 
float & Friction ()
 
float & AnimSpeed ()
 
float & BounceDamp ()
 
float & FloorHeight ()
 
float & CeilingHeight ()
 
const int SectorIndex ()
 
const int AreaID () const
 
bool InstanceOf (const kStr &in className) const
 example: InstanceOf("kexPuppet")
 
void PlaySound (const kStr &in soundPath)
 
void PlaySoundWithLookupID (const int soundID)
 
void StopSound ()
 
void StopLoopingSounds ()
 
const int GameTicks () const
 
kAnimStateAnimState ()
 
kRenderModel RenderModel ()
 
const bool InWater () const
 
bool CheckPosition (const kVec3 &in origin)
 checks if the actor can move to this location
 
bool CheckPosition (const float angle, const float distance)
 calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor.Radius())
 
float GetTurnYaw (const kVec3 &in lookAtLocation) const
 
float GetAvoidanceAngle (const kVec3 &in lookAtLocation, const float distance)
 
const float GetWaterHeight () const
 
const bool CanSee (kActor@ actor, const uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags)
 
uint & ClipFlags ()
 EnumClipFlags.
 
kDictMem Definition ()
 get actors def data
 
bool OnGround () const
 
int GetWaterLevel () const
 EnumWaterLevel.
 
kActor CastToActor ()
 Casts to a kActor. Only used for kPuppet Actor().
 
kAI CastToAI ()
 Casts to kAI. returns null if isn't a kAI.
 
kFx SpawnProjectile (const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
 Returns the first Fx spawned.
 
void MeleeObject (const kStr &in damageType, const kVec3 &in offset, const float radius)
 
kFx SpawnFx (const kStr &in fxPath, const kVec3 &in pos)
 
kFx SpawnFx (const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
 
kVec3 GetTransformedVector (const kVec3 &in vector)
 
float DistanceToPoint (const kVec3 &in point) const
 calls DistanceToPoint(x,y,z)
 
float DistanceToPoint (const float x, const float y, const float z) const
 actors point is in the center
 
void InflictGenericDamage (kActor@ inflictor, const int damage)
 
void InflictGenericDamage (kActor@ inflictor, const kexStr &damageDef, const int damage)
 Can pass in a damage def. The damageDef keys used are mainly for custom scripting purposes only. Only the following keys are used internally when calling this function: bImpact, impactDamp, impactFalloff, bKnockback, knockBackForce.
 
void InflictDamage (kActor@ inflictor, const kStr &in damageDef)
 
void InteractActorsAtPosition (const kVec3 &in pos, const kStr &in callbackFunc, const float arg1=0, const float arg2=0, const float arg3=0, const float arg4=0)
 Calls a script function on all actors that are in the AreaNodes (KD-Tree search) contained inside a bounds. The bounds is calculated as: pos + this actors bounds(model bounds) + this actors radius. This will call for actors not necessarily in the bounds of the actor so checking distance is required in your script function.
 
kScriptObject ScriptObject ()
 
void MoveToPosition (const float x, const float y)
 Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
 
bool RandomDecision (const int randomBit) const
 randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set then returns true.
 
void SetPosition (const kVec3 &in pos, const bool clearInterpolation=true)
 best way to set an actors position (if you don't know the sector), will also set the sector and optionally clear interpolation
 
const int16 SpawnParams (const int paramID) const
 Get a map actors param value.
 
const float GetCeilingHeight () const
 calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
 
const float GetFloorHeight () const
 calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
 
void RunFxEvent (const kStr &in fxEventName)
 Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");.
 
bool FxEventActive ()
 Returns true if FxEvent is running.
 
const int GetSectorIndexAtLocation (const kVec3 &in pos, uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags)
 
void MarkPersistentBit (const bool clear)
 
const bool IsPersistentMarked ()
 
void SetHeadTrackTarget (kActor@ actor)
 
void ClearInterpolation ()
 
void AutomapToggle (const bool show)
 Use with Game.AutomapCustom(true);.
 
void SetAutomapColor (const int r, const int g, const int b)
 
void SetSpawnParams (const int param, const int16 value)
 Sets the actors param value. all params are int16.
 
void SetSpawnFlags1 (const uint flags)
 EnumActorSpawnFlags1.
 
void SetSpawnFlags2 (const uint flags)
 EnumActorSpawnFlags2.
 
void SetSpawnFlags3 (const uint flags)
 EnumActorSpawnFlags3.
 
void SetupSpawnParams ()
 call after setting your actors spawnflags for them to take effect on the kActor
 
void SetCustomDeadHeight (const bool bUse, const float height)
 Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
 
const float GetCustomDeadHeight ()
 
const bool GetUsingCustomDeadHeight ()
 
const bool OverridingKeyTouchTID ()
 used only for key pickups
 
const int16 GetOverrideKeyTouchTID ()
 used only for key pickups
 
void OverrideKeyTouchTID (const bool bOverride, const int16 tid)
 used only for key pickups to tell what key it is in the hub
 
bool & SkipKeyTouchCinema ()
 used only for key pickups
 
void SetModel (kStr &in modelFile, kStr &in animFile)
 a way to set the model/anim for actors that had no model set previously
 
bool & TriggerInvincibility ()
 Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
 
bool & DrawDelay ()
 Don't draw until has ticked once.
 
void GetBoundsMinMax (kVec3 &out min, kVec3 &out max) const
 actor must not be sleeping and have a model set and not be a pickup. otherwise will return default min/max values of (-128, -128, -128) (128, 128, 128). Sets the min and max kVec3 values (the actors origin is added to the values)
 
const int MapActorIndex () const
 Returns -1 if not a map actor.
 
int & DifficultyMode ()
 The difficulty this actor is currently set to.
 
void OverrideOnDamageValue (const int damage, const bool bOverride=true)
 call in OnPreDamage
 
bool & NoKnockBack ()
 Will not receive knock back movement from things like the alien weapon for example.
 
const float BaseHeight () const
 height of actor when spawned or when kAI regenerated
 
void RunAction (const int funcID, const float w=0.0f, const float x=0.0f, const float y=0.0f, const float z=0.0f)
 run a function on the actor defined in defs/animActions.txt
 
float & AirFriction ()
 default = 1.0f
 
float & WaterFriction ()
 default = 0.5f (same as Friction)
 
float & Mass ()
 default = GAME_SCALE * 1.0f
 
const float GetSkyHeight () const
 
bool & ChildOfTarget (void)
 if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then won't collide/get damaged.
 
kVec3 DamageOrigin (void) const
 The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who damaged this actor last. Gets set before OnPreDamage.
 
kVec3 DamageVelocity (void) const
 The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who damaged this actor last. Gets set before OnPreDamage.
 
const bool CanSee (kPuppet@ puppet, const uint excludeClipFlags=0)
 excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg is only available for kActor, not for kPuppet or kAI or kWeapon.
 
const kVec3PrevLerpOrigin (void) const
 
const kQuatPrevLerpRotation (void) const
 
const kAnglePrevLerpPitch (void) const
 
const kAnglePrevLerpRoll (void) const
 
const kAnglePrevLerpYaw (void) const
 
const int RefCount () const
 Returns the number of references there are to this actor. If actor is stale and RefCount is 0 then it will be removed after the actor ticks.
 
bool HasCustomRef (void) const
 
void AddCustomRef (void)
 Keeps the actor from getting freed from memory.
 
void ClearCustomRef (void)
 Allows the actor to get freed from memory if it has no references. This will be called automatically when level is unloaded.
 
void SetupHeadTrack (const kStr &in headTrackDef)
 Sets a headtrack.
 
float & SoundPitchModify ()
 Override the final pitch of sounds owned by this actor. A value of 1000 raises the pitch by the amount tiny cheat does. A value of -1000 lowers the pitch by the amount the big head cheat does. Set to 0 to stop overriding. if less than 1 will override with no pitch change so tiny and big head mode don't affect it.
 
void RotateAroundOrigin (const kAngle &in angle, const kVec3 &in platformOrigin, const bool setPos=true)
 The angle amount to rotate this actors position. if setPos is true will use SetPosition to position the actor else will use MoveToPosition.
 
void LinkArea ()
 Links the actor to an area node so that internally the actor can be found in quick searches (similar to a kd-tree) for explosive damage radius checks, when InteractActorsAtPosition is called, kAI GetAttention checks, and collision checks against actors. Should only call whenever you set the actors Origin() directly. Calling MoveToPosition or SetPosition or when the actors movement is updated by velocity changes or by gravity then LinkArea will be called internally.
 
void CheckLinkArea ()
 If origin or radius changed since the last LinkArea then calls LinkArea else does nothing. Links the Actor to an area node so that internally the Actor can be found in quick searches (similar to a kd-tree).
 
float SoundPlayTime (const kStr &in file)
 returns -1 if sound is not playing. Returns the amount of time in seconds the sound has been playing for. file is the "wavefile" property in the sound shader.
 
bool & RemoveTrailsOnAnimChange ()
 Will remove all model trails on this actor when animation is set/blend.
 
const float GetCurrentGameSpeed (void) const
 Gamespeed of this Actor (default 1.0f)
 
void SetCurrentGameSpeed (const float speed)
 Set Gamespeed of this Actor (default 1.0f)
 
bool & IgnoreGameSpeed ()
 GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapon. Default is False for every other actor)
 
bool & IgnoreFxGameSpeed ()
 GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
 
const float GetGameSpeed () const
 Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
 
kFx DamageFx () const
 The kFx that hit this actor. Will be null if no Fx hit this actor. Only use in OnPreDamage/OnDamage/OnDeath. Do not use anywhere else or it could be pointing to a random place in memory then the game will crash!
 
const float DecayTime (void)
 Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
 
void SetDecayTime (const float value)
 Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
 
float RadiusDamageFactor (const kVec3 &in origin, const float radius) const
 
bool & UseNewExplosiveRadiusCheck (void)
 (default False) Set to true to enable explosive damage checks from radius to actor cylinder(more accurate) instead of radius to actors center point.
 

Detailed Description

Definition at line 1294 of file t1_scriptAPI.cpp.

Member Function Documentation

◆ Agitation()

int & kAI::Agitation ( )

0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE

◆ AIFlags()

uint & kAI::AIFlags ( )

◆ AnimScalar()

float & kAI::AnimScalar ( )

default = 1.0f

◆ AttackChance()

int & kAI::AttackChance ( )

0-100

◆ AttackRange()

float & kAI::AttackRange ( )

squared

◆ BlendScalar()

float & kAI::BlendScalar ( )

default = 10.0f

◆ FlyHeight()

float & kAI::FlyHeight ( )

squared

◆ LeashRadius()

float & kAI::LeashRadius ( )

squared

◆ LoudRange()

float & kAI::LoudRange ( )

squared

◆ MeleeRange()

float & kAI::MeleeRange ( )

squared

◆ QuietRange()

float & kAI::QuietRange ( )

squared

◆ Regenerate()

int & kAI::Regenerate ( )

get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBeginLevel is called and is set to a random value from 0 to the mapActors maxRegenerations value or the actors def ai.maxRegenerations value(for non map actors).

◆ SetupAISpawnFlags()

void kAI::SetupAISpawnFlags ( )

call after setting your actors spawnflags for them to take effect on the kAI

◆ SightFOV()

float & kAI::SightFOV ( )

in rads

◆ SightRange()

float & kAI::SightRange ( )

squared