Difference between revisions of "HPL2/AMFP/ScriptFunctions"

From Frictional Wiki
< HPL2‎ | AMFP
Jump to navigation Jump to search
m (Syntax highlightin fix)
 
(13 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
A list of script functions available in A Machine For Pigs (that are not present in The Dark Descent). Many of TDD's scripts are available in AMFP, but not all. Some are replaced by ones listed below, and others are removed.
 
A list of script functions available in A Machine For Pigs (that are not present in The Dark Descent). Many of TDD's scripts are available in AMFP, but not all. Some are replaced by ones listed below, and others are removed.
 
{{note|'''NOTE:''' This page is partially incomplete. Some arguments for the functions listed here have unknown effects. If you wish to contribute, feel free to test them. It's also possible there are additional script functions not listed here that exist within the engine.}}
 
 
----
 
  
 
=== General ===
 
=== General ===
  
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
void CheckPoint(string@& asName, string@& asStartArea, string@& asFunction, string@& asTextCat, string@& asTextEntry, const bool abPlayerLimbo);
+
void CheckPoint(string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry, bool abKeepPlayerInLimbo);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 16: Line 12:
 
This function replaces TDD's <code>CheckPoint()</code>.
 
This function replaces TDD's <code>CheckPoint()</code>.
  
# ''asName'' - The internal name of the callback
+
# ''asName'' - The internal name of the callback
# ''asStartArea'' - The name of the PlayerStartArea to respawn at
+
# ''asStartPos'' - The name of the PlayerStartArea to respawn at
# ''asFunction'' - The name of the callback function to run
+
# ''asCallback'' - The name of the callback function to run
# ''asTextCat'' - The name of the .lang file category (SEEMS UNUSED)
+
# ''asDeathHintCat'' - The name of the .lang file category
# ''asTextEntry'' - The name of the .lang file entry (SEEMS UNUSED)
+
# ''asDeathHintEntry'' - The name of the .lang file entry
# ''abPlayerLimbo'' - Whether to put the player into a state of "limbo" upon death. In limbo, the death occurs normally, but once the screen fades to black, it remains so until <code>ReleasePlayerFromLimbo()</code>  is called. Player is still controllable during death.
+
# ''abKeepPlayerInLimbo'' - Whether to put the player into a state of "limbo" upon death. In limbo, the death occurs normally, but once the screen fades to black, it remains so until <code>ReleasePlayerFromLimbo()</code>  is called. Player is still controllable during death.
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
 
void ReleasePlayerFromLimbo();
 
void ReleasePlayerFromLimbo();
Line 28: Line 24:
 
Respawns the player if stuck in "limbo". Limbo can be enabled with ''CheckPoint''. Limbo is the state between life and death. The player enters limbo upon dying but won't respawn until this function is called.
 
Respawns the player if stuck in "limbo". Limbo can be enabled with ''CheckPoint''. Limbo is the state between life and death. The player enters limbo upon dying but won't respawn until this function is called.
  
<syntaxhighlight lang="cpp">
+
=== Particle Systems ===
void PlayScriptedAnimation(string@& asEntity, string@& asAnimation, const bool abLoop);
+
 
 +
<syntaxhighlight lang="c++">
 +
void SetParticleSystemActive(string& asName, bool abActive);
 +
</syntaxhighlight>
 +
 
 +
Pauses a particle system in its current frame. The paused particle system remains frozen at this frame until reactivated or destroyed.
 +
 
 +
# ''asName'' - The name of the particle system
 +
# ''abActive'' - False to pause, true to unpause
 +
 
 +
<syntaxhighlight lang="c++">
 +
void DestroyParticleSystemInstantly(string& asName);
 +
</syntaxhighlight>
 +
 
 +
Destroys a particle system and any existing particles already emitted from it. Similar to ''DestroyParticleSystem'', except that one will not destroy the existing particles and rather let them live out their lives. This function will cut all particles' lives short.
 +
 
 +
#''asName'' - The internal name of the particle system
 +
 
 +
=== Sounds ===
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice2(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 +
</syntaxhighlight>
 +
 
 +
Plays an audio file with two consecutive subtitles.
 +
 
 +
# ''asVoiceFile''  - The entire voice file to play (intended to include 2 sections)
 +
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 +
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice3(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 +
</syntaxhighlight>
 +
 
 +
Plays an audio file with three consecutive subtitles.
 +
 
 +
# ''asVoiceFile''  - The entire voice file to play (intended to include 3 sections)
 +
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 +
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''asText3Entry''  - The third .lang subtitle entry
 +
# ''afText3Delay''  - The time to wait until the third subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice4(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 +
</syntaxhighlight>
 +
 
 +
Plays an audio file with four consecutive subtitles.
 +
 
 +
# ''asVoiceFile''  - The entire voice file to play (intended to include 4 sections)
 +
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 +
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''asText3Entry''  - The third .lang subtitle entry
 +
# ''afText3Delay''  - The time to wait until the third subtitle starts
 +
# ''asText4Entry''  - The fourth .lang subtitle entry
 +
# ''afText4Delay''  - The time to wait until the fourth subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice5(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 +
</syntaxhighlight>
 +
 
 +
Plays an audio file with five consecutive subtitles.
 +
 
 +
# ''asVoiceFile''  - The entire voice file to play (intended to include 5 sections)
 +
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 +
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''asText3Entry''  - The third .lang subtitle entry
 +
# ''afText3Delay''  - The time to wait until the third subtitle starts
 +
# ''asText4Entry''  - The fourth .lang subtitle entry
 +
# ''afText4Delay''  - The time to wait until the fourth subtitle starts
 +
# ''asText5Entry''  - The fifth .lang subtitle entry
 +
# ''afText5Delay''  - The time to wait until the fifth subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice5(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, string& asText6Entry, float afText6Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 +
</syntaxhighlight>
 +
 
 +
Plays an audio file with six consecutive subtitles.
 +
 
 +
# ''asVoiceFile''  - The entire voice file to play (intended to include 6 sections)
 +
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 +
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''asText3Entry''  - The third .lang subtitle entry
 +
# ''afText3Delay''  - The time to wait until the third subtitle starts
 +
# ''asText4Entry''  - The fourth .lang subtitle entry
 +
# ''afText4Delay''  - The time to wait until the fourth subtitle starts
 +
# ''asText5Entry''  - The fifth .lang subtitle entry
 +
# ''afText5Delay''  - The time to wait until the fifth subtitle starts
 +
# ''asText6Entry''  - The sixth .lang subtitle entry
 +
# ''afText6Delay''  - The time to wait until the sixth subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 +
 
 +
<syntaxhighlight lang="c++">
 +
void AddEffectVoice7(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, string& asText6Entry, float afText6Delay, string& asText7Entry, float afText7Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an animation that has been added to an entity through the Model Editor. Similar to ''PlayEnemyAnimation''.
+
Plays an audio file with seven consecutive subtitles.
  
# asEntity - Internal name of the entity
+
# ''asVoiceFile''  - The entire voice file to play (intended to include 7 sections)
# asAnimation - The animation name inside the entity
+
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
# abLoop - Whether to loop the animation or play it only once
+
# ''asTextCat''  - The .lang text category for the subtitles
 +
# ''asTextEntry''  - The first .lang subtitle entry
 +
# ''afTextDelay''  - The time to wait until the first subtitle starts
 +
# ''asText2Entry''  - The second .lang subtitle entry
 +
# ''afText2Delay''  - The time to wait until the second subtitle starts
 +
# ''asText3Entry''  - The third .lang subtitle entry
 +
# ''afText3Delay''  - The time to wait until the third subtitle starts
 +
# ''asText4Entry''  - The fourth .lang subtitle entry
 +
# ''afText4Delay''  - The time to wait until the fourth subtitle starts
 +
# ''asText5Entry''  - The fifth .lang subtitle entry
 +
# ''afText5Delay''  - The time to wait until the fifth subtitle starts
 +
# ''asText6Entry''  - The sixth .lang subtitle entry
 +
# ''afText6Delay''  - The time to wait until the sixth subtitle starts
 +
# ''asText7Entry''  - The seventh .lang subtitle entry
 +
# ''afText7Delay ''- The time to wait until the seventh subtitle starts
 +
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 +
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 +
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 +
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
  
=== Screen effects ===
+
=== Screen Effects ===
  
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
void ShowScreenImage(string@& asImageFile, int alX, int alY, const float afUnknown1, const bool abUnknown2, const float afDuration, const float afFadeInTime, const float afFadeOutTime);
+
void ShowScreenImage(string& asImageName, float afX, float afY, float afScale, bool abUseRelativeCoordinates, float afDuration, float afFadeIn, float afFadeOut);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Shows a 2D image on the screen. Originally used for showing the intro logo during a sequence.
 
Shows a 2D image on the screen. Originally used for showing the intro logo during a sequence.
  
# ''asImageFile''  - The image file to show. Does not have to be pow2 (although it gives a warning if not)
+
May work similarly to the [[HPL2/Tutorials/ShowScreenImage()|ATTD 1.5 ShowScreenImage()]].
# ''alX -'' The X position of the top left corner, starting from the center of the screen. Use negative half of the width of the image to center it.
+
 
# ''alY -'' The Y position of the top left corner, starting from the center of the screen.
+
# ''asImageName''  - The image file to show. Does not have to be pow2 (although it gives a warning if not)
# ''afUnknown1'' - Unsure what this is. Any value 0 or greater results in the image not showing up, so use -1
+
# ''afX''- The X position of the top left corner, starting from the center of the screen. Use negative half of the width of the image to center it.
# ''abUnknown2'' - Unsure what this is. If set to true, image does not display, so use false
+
# ''afY''- The Y position of the top left corner, starting from the center of the screen.
# ''afDuration'' - How long, in seconds, the image displays. This does not include fade times
+
# ''afScale'' - The size of the image in pixels (not scale), or original image size if negative
# ''afFadeInTime'' - How long, in seconds, the fade in spends
+
# ''abUseRelativeCoordinates'' - Whether X and Y are relative to the screen resoltion, or pixel co-ordinates if not
# ''afFadeOutTime'' - How long, in seconds, the fade out spends
+
# ''afDuration'' - How long, in seconds, the image displays. This does not include fade times
 +
# ''afFadeIn'' - How long, in seconds, the fade in spends
 +
# ''afFadeOut'' - How long, in seconds, the fade out spends
 +
 
 
=== Journal ===
 
=== Journal ===
  
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
void AddHint(string& asNameAndTextEntry, string@& asImage);
+
void AddHint(string& asNameAndTextEntry, string& asImage);
 +
</syntaxhighlight>
 +
 
 +
Adds a hint to the player's journal.<br>This function replaces TDD's ''AddDiary''.
 +
 
 +
# ''asNameAndTextEntry'' - The .lang text entry of the hint. The entry must be in category "Journal" and use the format Hint_MyHint_Name for the title and Hint_MyHint_Text for the body, where MyHint replaces the value you put in this argument.
 +
# ''asImage'' - This argument does not seem to be used. Presumed to be for displaying an image but possibly removed functionality. All existing occurrences are empty.
 +
 
 +
<syntaxhighlight lang="cpp">
 +
bool GetJournalDisabled();
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Adds a hint to the player's journal. <br />This function replaces TDD's ''AddDiary''.
+
Returns if the journal is currently disabled.
  
# ''asNameAndTextEntry''  - The .lang text entry of the hint. The entry must be in category "Journal" and use the format Hint_MyHint_Name for the title and Hint_MyHint_Text for the body, where MyHint replaces the value you put in this argument.
 
# ''asImage''  - This argument does not seem to be used. Presumed to be for displaying an image but possibly removed functionality. All existing occurrences are empty.
 
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
void SetJournalDisabled(const bool abDisabled);
+
void SetJournalDisabled(bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Disables the player's ability to open their journal.
 
Disables the player's ability to open their journal.
  
# ''abDisabled''  - True to disable, false to enable again
+
# ''abX''  - True to disable, false to enable again
 +
 
 
=== Player ===
 
=== Player ===
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetLanternFlickerActive(const bool abActive);
+
void SetLanternFlickerActive(bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Enables/disables the flicker effect for the lantern's light.
 
Enables/disables the flicker effect for the lantern's light.
  
# ''abActive'' - True to flicker, false to not flicker
+
# ''abX'' - True to flicker, false to not flicker
 +
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetPlayerInfection(const float afAmount);
+
void SetPlayerInfection(float afInfection);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Sets the [[:hpl2:machine_for_pigs:infection|infection]] level for the player. Infection replaces sanity from TDD and acts similar, however it goes from 0-100 instead of 100-0. An infection level above approximately 20 will affect the player's ability to move. Infection level above 80 will kill the player. Infection slowly decreases over time, unless high enough. <br />This function replaces TDD's ''SetPlayerSanity''.
+
Sets the [[HPL2/AMFP/Infection|infection]] level for the player. Infection replaces sanity from TDD and acts similar, however it goes from 0-100 instead of 100-0. An infection level above 50 will affect the player's ability to move. Infection level above 80 will kill the player after a 2 second delay. Infection slowly decreases over time, unless above 75. <br />This function replaces TDD's ''SetPlayerSanity''.
 +
 
 +
# ''afInfection'' - The level of infection to set
  
# ''afAmount''  - The level of infection to set
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddPlayerInfection(const float afAmount);
+
void AddPlayerInfection(float afInfection);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Adds an amount of infection to the player's current amount. <br />This function replaces TDD's ''AddPlayerSanity''.
+
Adds an amount of infection to the player's current amount.<br>This function replaces TDD's ''AddPlayerSanity''.
  
# afAmount - The amount to add
+
# ''afInfection'' - The amount to add
  
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
Line 99: Line 257:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Returns the amount of infection the player currently has. <br />This function replaces TDD's ''GetPlayerSanity''.
+
Returns the amount of infection the player currently has.<br>This function replaces TDD's ''GetPlayerSanity''.
 +
 
 +
<syntaxhighlight lang="cpp">
 +
void GiveInfectionDamage(float afAmount, bool abUseEffect);
 +
</syntaxhighlight>
 +
 
 +
Increases the infection of the player.<br>This function replaces TDD's ''GiveSanityDamage''.
 +
 
 +
# ''afAmount'' - Amount of infection damage done
 +
# ''abUseEffect'' - Determines whether a sound effect is played when the infection damage is dealt
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void FadePlayerPitchTo(const float afPitch, const float afDeaccelleration, const float afSpeed);
+
void SetInfectionFauxMode(bool abFauxMode);
 +
</syntaxhighlight>
 +
 
 +
Enable/disable "faux mode" for infection. In faux mode, the player cannot die of infection and infection sounds don't play.
 +
 
 +
<syntaxhighlight lang="c++">
 +
void FadePlayerPitchTo(float afX, float afSpeedMul, float afMaxSpeed);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Moves the player's pitch (up and down rotation).
 
Moves the player's pitch (up and down rotation).
  
# ''afPitch'' - The target pitch to move towards. 0 = straight forward. Clamped to range: -70 to +70.
+
# ''afX'' - The target pitch to move towards. 0 = straight forward. Clamped to range: -70 to +70.
# ''afDeaccelleration'' - The deaccelleration when nearing the target pitch. A low value makes a slow change.
+
# ''afSpeedMul'' - The speed multiplier of the movement. A low value makes a slow change.
# ''afSpeed'' - The speed of the movement. Speed is affected by deaccelleration.
+
# ''afMaxSpeed'' - The max speed of the movement.
 +
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetPlayerUsesDragFootsteps(const bool abX);
+
void SetPlayerUsesDragFootsteps(bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 119: Line 293:
  
 
=== Entities ===
 
=== Entities ===
 +
 +
==== General ====
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetPhysicsAutoDisable(string@& asEntity, const bool abDisabled);
+
bool GetEntityActive(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Does… something. Not immediately apparent. Is only used on chandeliers in the campaign.
+
Returns whether an entity in the level is active or not.
 +
 
 +
# ''asName'' - The entity to check
  
# ''asEntity''  - The entity to affect
 
# ''abDisabled''  - Whether this effect auto disables or not
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetLampFlickerActive(string@& asLamp, const bool abActive);
+
void CreateEntityAtArea(string& asEntityName, string& asEntityFile, string& asAreaName, bool abFullGameSave, float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Enables a flickering effect on a Lamp-type entity.
+
Creates an entity at an area with the specified offsets and rotation. <br />This function replaces TDD's ''CreateEntityAtArea''.
 +
 
 +
# ''asEntityName'' - The internal name of the created entity
 +
# ''asEntityFile'' - The file for the entity (extension .ent)
 +
# ''asAreaName'' - The area to create entity at
 +
# ''abFullGameSave'' - Determines whether an entity "remembers" its state
 +
# ''afOffsetX'' - The offset along the X axis in units
 +
# ''afOffsetY'' - The offset along the Y axis in units
 +
# ''afOffsetZ'' - The offset along the Z axis in units
 +
# ''afRotX'' - The rotation on the X axis in degrees
 +
# ''afRotY'' - The rotation on the Y axis in degrees
 +
# ''afRotZ'' - The rotation on the Z axis in degrees
 +
 
 +
==== Props ====
  
# ''asLamp''  - The lamp entity
 
# ''abActive''  - Whether to enable flicker
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void StartPhoneRinging(string@& asEntity);
+
void SetPhysicsAutoDisable(string& asName, bool abAutoDisable);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Enables a PhoneBox-type entity to start ringing. A ringing phone box can be interacted with to play some audio files. After interacting, the phone will stop ringing.
+
If physics bodies will automatically sleep (become inactive and stop moving). Only used on chandeliers in the campaign.
 +
 
 +
# ''asName'' - The prop to affect
 +
# ''abAutoDisable'' - Whether physics auto disables or not
  
# ''asEntity''  - The PhoneBox entity
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void StopPhoneRinging(string@& asEntity)
+
void AttachPropToBone(string& asChildEntityName, string& asParentEntityName, string& asParentBoneName, float fPosX, float fPosY, float fPosZ, float fRotX, float fRotY, float fRotZ);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Stops a ringing PhoneBox-type entity.
+
Attaches a prop to a specific bone within another entity. You can inspect bones in the Model Editor. Note: Offsets and rotations are local to the bone and relative to its rotation.
 +
 
 +
# ''asChildEntityName'' - The prop to attach
 +
# ''asParentEntityName'' - The entity that holds the bone to attach to
 +
# ''asParentBoneName'' - The bone within the entity to attach to
 +
# ''afPosX'' - Offset along the X axis
 +
# ''afPosY'' - Offset along the Y axis
 +
# ''afPosZ'' - Offset along the Z axis
 +
# ''afRotX'' - Rotation along the X axis
 +
# ''afRotY'' - Rotation along the Y axis
 +
# ''afRotZ'' - Rotation along the Z axis
  
# ''asEntity''  - The PhoneBox entity
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
bool GetEntityActive(string@& asEntity);
+
void DetachPropFromBone(string& asChildEntityName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Returns whether an entity in the level is active or not.
+
Detaches an attached prop. Note: When detached, physics are not automatically enabled on the prop.
 +
 
 +
# ''asChildEntityName'' - The attached prop
  
# ''asEntity''  - The entity to check
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void StopPropAnimation(string@& asProp);
+
void AttachAreaToProp(string& asAreaName, string& asProp, int alBody);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Stops the animation currently playing on a prop. Animations can be started with ''PlayPropAnimation''.
+
Attaches an area to a prop. Originally used to attach a liquid area to a movable water plane entity in the sewers map.
 +
 
 +
# ''asAreaName'' - The area to attach
 +
# ''asProp'' - The prop to attach area to
 +
# ''alBody'' - The ID of the physics body of the prop to attach to
  
# ''asProp''  - The name of the entity/prop
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetPropAnimationPosition(string@& asProp, const float afPosition);
+
void StopPropAnimation(string& asProp);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Jumps to a specifc point in an animation. Generally used in conjunction with ''PlayPropAnimation''.
+
Stops the animation currently playing on a prop. Animations can be started with ''PlayPropAnimation''.
 +
 
 +
# ''asProp'' - The name of the prop
  
# ''asProp''  - The entity that is being animated
 
# ''afPosition''  - The time within the animation, in seconds, to jump to
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetSwingDoorOpenAmount(string@& asEntity, const float afOpenAmount, const float afTime, const bool abUnknown);
+
void PlayCurrentAnimation(string& asProp, float afFadeTime, bool abLoop);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Sets the open amount for a swing door.
+
Fades in the active animation, optionally allowing it to loop.
 +
 
 +
# ''asProp'' - The name of the prop
 +
# ''afFadeTime'' - The fade time between animations
 +
# ''abLoop'' - If the animation should be looped
  
# ''asEntity''  - The SwingDoor entity
 
# ''afOpenAmount''  - The new amount state to set. Range: 0 - 1
 
# ''afTime''  - The time in seconds until the door has changed state
 
# ''abUnknown''  - Unsure what this does. If set to true, nothing happens (?), so use false.
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void FadeLampTo(string@& asEntity, const uint alR, const uint alG, const uint alB, const uint alA, int alRadius, const double afTime);
+
void PauseCurrentAnimation(string& asProp, float afFadeTime);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Fades a Lamp-type entity's light to another color. This function uses integers for color values instead of floats, which is a little odd. Likewise, it uses a double floating point for the last argument instead of a regular one.
+
Fades out the active animation.
 +
 
 +
# ''asProp'' - The name of the prop
 +
# ''afFadeTime'' - The fade time between animations
  
# ''asEntity''  - The lamp to change
 
# ''alR''  - Red value (appropriate values are 0 - 10)
 
# ''alG''  - Green value (appropriate values are 0 - 10)
 
# ''alB''  - Blue value (appropriate values are 0 - 10)
 
# ''alA''  - Alpha value (has no effect?)
 
# ''alRadius''  - The new radius to use (affects illumination strength)
 
# ''afTime''  - Time in seconds until the light properties have changed
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetButtonCanBeSwitchedOn(string@& asEntity, const bool abX);
+
void SetPropAnimationSpeed(string& asProp, float afSpeed);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Changes whether a Button-type entity can be toggled.
+
Set the speed of the animation. Generally used in conjunction with ''PlayPropAnimation''.
 +
 
 +
# ''asProp'' - The prop that is being animated
 +
# ''afSpeed'' - The new animation speed
  
# ''asEntity''  - The button entity
 
# ''abX''  - Whether it can be switched on
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void CreateEntityAtArea(string@& asName, string@& asFile, string@& asArea, const bool abUnknown, const float afOffsetX, const float afOffsetY, const float afOffsetZ, const float afRotX, const float afRotY, const float afRotZ);
+
void SetPropAnimationPosition(string& asProp, float afPos);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Creates an entity at an area with the specified offsets and rotation. <br />This function replaces TDD's ''CreateEntityAtArea''.
+
Jumps to a specific point in an animation. Generally used in conjunction with ''PlayPropAnimation''.
 +
 
 +
# ''asProp'' - The prop that is being animated
 +
# ''afPos'' - The time within the animation, in seconds, to jump to
 +
 
 +
==== Lamps ====
  
# ''asName''  - The internal name of the created entity
 
# ''asFile''  - The file for the entity (extension .ent)
 
# ''asArea''  - The area to create entity at
 
# ''abUnknown''  - Not sure. Only true is used in the campaign. Seemingly has no effect
 
# ''afOffsetX''  - The offset along the X axis in units
 
# ''afOffsetY''  - The offset along the Y axis in units
 
# ''afOffsetZ''  - The offset along the Z axis in units
 
# ''afRotX''  - The rotation on the X axis in degrees
 
# ''afRotY''  - The rotation on the Y axis in degrees
 
# ''afRotZ''  - The rotation on the Z axis in degrees
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AttachPropToBone(string@& asProp, string@& asEntity, string@& asBone, const float afOffsetX, const float afOffsetY, const float afOffsetZ, const float afRotX, const float afRotY, const float afRotZ);
+
void SetLampFlickerActive(string& asName, bool abActive);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Attaches a prop to a specific bone within another entity. You can inspect bones in the Model Editor. Note: Offsets and rotations are local to the bone and relative to its rotation.
+
Enables a flickering effect on a Lamp.
 +
 
 +
# ''asName'' - The lamp entity
 +
# ''abActive'' - Whether to enable flicker
  
# ''asProp''  - The prop to attach
 
# ''asEntity''  - The entity that holds the bone to attach to
 
# ''asBone''  - The bone within the entity to attach to
 
# ''afOffsetX''  - Offset along the X axis
 
# ''afOffsetY''  - Offset along the Y axis
 
# ''afOffsetZ''  - Offset along the Z axis
 
# ''afRotX''  - Rotation along the X axis
 
# ''afRotY''  - Rotation along the Y axis
 
# ''afRotZ''  - Rotation along the Z axis
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void DetachPropFromBone(string@& asProp);
+
void FadeLampTo(string& asName, float afR, float afG, float afB, float afA, float afRadius, float afTime);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Detaches an attached prop. Note: When detached, physics are not automatically enabled on the prop.
+
Fades a Lamp's light to another color. This function uses integers for color values instead of floats, which is a little odd. Likewise, it uses a double floating point for the last argument instead of a regular one.
 +
 
 +
# ''asName'' - The lamp to change
 +
# ''afR'' - Red value (appropriate values are 0 - 10)
 +
# ''afG'' - Green value (appropriate values are 0 - 10)
 +
# ''afB'' - Blue value (appropriate values are 0 - 10)
 +
# ''afA'' - Alpha value (has no effect?)
 +
# ''afRadius'' - The new radius to use (affects illumination strength)
 +
# ''afTime'' - Time in seconds until the light properties have changed
  
# ''asProp''  - The attached prop
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AttachAreaToProp(string@& asArea, string@& asProp, const float afUnknown);
+
void SetLampCanBeLitByPlayer(string& asName, bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Attaches an area to a prop, however testing has not yielded any useful results. Originally used to attach a liquid area to a movable water plane entity in the sewers map.
+
Enables/disables the player's ability to light a lamp.
  
# ''asArea'' - The area to attach
+
# ''asName'' - The name of the Lamp
# ''asProp'' - The prop to attach area to
+
# ''abX'' - State to set
# ''alUnknown''  - Unknown float value
+
 
=== Sounds ===
+
==== Doors ====
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice2(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void SetSwingDoorOpenAmount(string& asName, float afOpenAmount, float afDuration, bool abOpenTowardsMaxAngle);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 2 consecutive subtitles.
+
Sets the open amount for a SwingDoor.
 +
 
 +
# ''asName'' - The SwingDoor entity
 +
# ''afOpenAmount'' - The new amount state to set. Range: 0 - 1
 +
# ''afDuration'' - The time in seconds until the door has changed state
 +
# ''abOpenTowardsMaxAngle'' - If the door will swing to its max angle instead of its min angle
 +
 
 +
==== Buttons ====
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 2 sections)
 
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice3(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, string@& asTextEntry3, const float afStartTime3, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void SetButtonCanBeSwitchedOn(string& asName, bool abCanBeSwitchedOn);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 3 consecutive subtitles.
+
Changes whether a Button can be switched from off to on.
 +
 
 +
# ''asName'' - The Button entity
 +
# ''abCanBeSwitchedOn'' - Whether it can be switched on
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 3 sections)
 
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''asTextEntry3''  - The third .lang subtitle entry
 
# ''afStartTime3''  - The time to wait until the third subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice4(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, string@& asTextEntry3, const float afStartTime3, string@& asTextEntry4, const float afStartTime4, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void SetButtonCanBeSwitchedOff(string& asName, bool abCanBeSwitchedOff);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 4 consecutive subtitles.
+
Changes whether a Button can be switched from on to off.
 +
 
 +
# ''asName'' - The Button entity
 +
# ''abCanBeSwitchedOff'' - Whether it can be switched off
 +
 
 +
==== PhoneBoxes ====
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 4 sections)
 
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''asTextEntry3''  - The third .lang subtitle entry
 
# ''afStartTime3''  - The time to wait until the third subtitle starts
 
# ''asTextEntry4''  - The fourth .lang subtitle entry
 
# ''afStartTime4''  - The time to wait until the fourth subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice5(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, string@& asTextEntry3, const float afStartTime3, string@& asTextEntry4, const float afStartTime4, string@& asTextEntry5, const float afStartTime5, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void StartPhoneRinging(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 5 consecutive subtitles.
+
Enables a PhoneBox to start ringing. A ringing phone box can be interacted with to play some audio files. After interacting, the phone will stop ringing.
 +
 
 +
# ''asName'' - The PhoneBox entity
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 5 sections)
 
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''asTextEntry3''  - The third .lang subtitle entry
 
# ''afStartTime3''  - The time to wait until the third subtitle starts
 
# ''asTextEntry4''  - The fourth .lang subtitle entry
 
# ''afStartTime4''  - The time to wait until the fourth subtitle starts
 
# ''asTextEntry5''  - The fifth .lang subtitle entry
 
# ''afStartTime5''  - The time to wait until the fifth subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice6(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, string@& asTextEntry3, const float afStartTime3, string@& asTextEntry4, const float afStartTime4, string@& asTextEntry5, const float afStartTime5, string@& asTextEntry6, const float afStartTime6, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void StopPhoneRinging(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 6 consecutive subtitles.
+
Stops a ringing PhoneBox.
 +
 
 +
# ''asName'' - The PhoneBox entity
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 6 sections)
 
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''asTextEntry3''  - The third .lang subtitle entry
 
# ''afStartTime3''  - The time to wait until the third subtitle starts
 
# ''asTextEntry4''  - The fourth .lang subtitle entry
 
# ''afStartTime4''  - The time to wait until the fourth subtitle starts
 
# ''asTextEntry5''  - The fifth .lang subtitle entry
 
# ''afStartTime5''  - The time to wait until the fifth subtitle starts
 
# ''asTextEntry6''  - The sixth .lang subtitle entry
 
# ''afStartTime6''  - The time to wait until the sixth subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEffectVoice7(string@& asVoiceFile, string@& asEffectFile, string@& asTextCat, string@& asTextEntry1, const float afStartTime1, string@& asTextEntry2, const float afStartTime2, string@& asTextEntry3, const float afStartTime3, string@& asTextEntry4, const float afStartTime4, string@& asTextEntry5, const float afStartTime5, string@& asTextEntry6, const float afStartTime6, string@& asTextEntry7, const float afStartTime7, const bool abUsePosition, string@& asPosEntity, const float afMinDistance, const float afMaxDistance);
+
void HangUpPhone(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Plays an audio file with 7 consecutive subtitles.
+
Hangs up a PhoneBox.
 +
 
 +
# ''asName'' - The PhoneBox entity
  
# ''asVoiceFile''  - The entire voice file to play (intended to include 7 sections)
+
==== Enemies ====
# ''asEffectFile''  - The background effect file to play during voices. Leave empty for no extra effect
 
# ''asTextCat''  - The .lang text category for the subtitles
 
# ''asTextEntry1''  - The first .lang subtitle entry
 
# ''afStartTime1''  - The time to wait until the first subtitle starts
 
# ''asTextEntry2''  - The second .lang subtitle entry
 
# ''afStartTime2''  - The time to wait until the second subtitle starts
 
# ''asTextEntry3''  - The third .lang subtitle entry
 
# ''afStartTime3''  - The time to wait until the third subtitle starts
 
# ''asTextEntry4''  - The fourth .lang subtitle entry
 
# ''afStartTime4''  - The time to wait until the fourth subtitle starts
 
# ''asTextEntry5''  - The fifth .lang subtitle entry
 
# ''afStartTime5''  - The time to wait until the fifth subtitle starts
 
# ''asTextEntry6''  - The sixth .lang subtitle entry
 
# ''afStartTime6''  - The time to wait until the sixth subtitle starts
 
# ''asTextEntry7''  - The seventh .lang subtitle entry
 
# ''afStartTime7 ''- The time to wait until the seventh subtitle starts
 
# ''abUsePosition''  - Whether to use 3D to play the sound from an entity
 
# ''asPosEntity''  - The entity to play the sound from. If empty, plays from player
 
# ''afMinDistance''  - The minimum distance required between the player and the entity in order to hear the audio
 
# ''afMaxDistance''  - The maximum distance allowed between the player and the entity in order to hear the audio
 
=== Enemies ===
 
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void AddEnemyPatrolNode(string@& asEnemy, string@& asPathNode, const float afWaitTime, string@& asAnimation, const bool abUnknown);
+
void AddEnemyPatrolNode(string& asName, string& asNodeName, float afWaitTime, string& asAnimation, bool abLoopAnimation);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Adds a patrol node to the enemy's walking path. A path is restarted from the beginning when the final node is reached. Note: Inputting an invalid animation in asAnimation at the final node will make the enemy wait there indefinitely. <br />This function replaces TDD's AddEnemyPatrolNode.
+
Adds a patrol node to the enemy's walking path. A path is restarted from the beginning when the final node is reached. Note: Inputting an invalid animation in asAnimation at the final node will make the enemy wait there indefinitely.<br />This function replaces TDD's AddEnemyPatrolNode.
 +
 
 +
# ''asName'' - The name of the enemy
 +
# ''asNodeName'' - Internal name of path node
 +
# ''afWaitTime'' - The time, in seconds, the enemy waits at this node before continuing. Note: A time of 0 instead randomizes between 1 and 3 seconds, so use 0.01 instead if you want the enemy to immediately continue to the next node.
 +
# ''asAnimation'' - The animation to play on the enemy when they arrive at this path node. Animations can be found in the Model Editor. Leave empty to play no special animation (uses default Idle animation). Note: If the animation lasts longer than afWaitTime, the enemy waits until the animation is complete before continuing the path.
 +
# ''abLoopAnimation'' - If the animation should be looped
  
# ''asEnemy''  - The name of the enemy
 
# ''asPathNode''  - Internal name of path node
 
# ''afWaitTime''  - The time, in seconds, the enemy waits at this node before continuing. Note: A time of 0.0f does not seem to skip waiting, use 0.01f instead if you want the enemy to immediately continue to the next node.
 
# ''asAnimation''  - The animation to play on the enemy when they arrive at this path node. Animations can be found in the Model Editor. Leave empty to play no special animation (uses default Idle animation). Note: If the animation lasts longer than afWaitTime, the enemy waits until the animation is complete before continuing the path.
 
# ''abUnknown''  - Unknown variable. Only false is ever used in the campaign. If set to true, seems to affect how animations are played, however they seem to just stutter or loop.
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetEnemyMoveType(string@& asEnemy, string@& asMoveType);
+
void SetEnemyMoveType(string& asName, string& asMoveType);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Changes how an enemy moves.
 
Changes how an enemy moves.
  
# ''asEnemy'' - The name of the enemy
+
# ''asName'' - The name of the enemy
# ''asMoveType'' - The type to change to. Type can be "WalkBiped", "RunBiped", "ChargeBiped", "Idle"
+
# ''asMoveType'' - The type to change to. Can be "WalkBiped", "RunBiped", "ChargeBiped", "Idle"
 +
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetManPigType(string@& asEnemy, string@& asType);
+
void SetManPigType(string& asName, string& asManPigType);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Sets the type for a ManPig enemy. It is unknown whether this function does anything or if it's just left over from an earlier state of the game. Only "Freddy" is used as the type, but supposedly it should also accept "Rod" and "Jane".
+
Sets the personality type for a ManPig enemy. Non-functional; left over from an earlier state of development. Only "Freddy" is used as the type, but supposedly it should also accept "Rod" and "Jane".
 +
 
 +
# ''asName'' - The ManPig enemy.
 +
# ''asManPigType'' - The type to set. Type can be "Freddy", "Rod", "Jane"
  
# ''asEnemy''  - The ManPig enemy.
 
# ''asType''  - The type to set. Type can be "Freddy", "Rod", "Jane"
 
 
The three types allegedly describe three different personality types for the AI, according to Peter Howell in [https://researchportal.port.ac.uk/portal/files/3364888/PeterHowell_PhD.pdf his PhD, section 7.4.4].
 
The three types allegedly describe three different personality types for the AI, according to Peter Howell in [https://researchportal.port.ac.uk/portal/files/3364888/PeterHowell_PhD.pdf his PhD, section 7.4.4].
  
Line 419: Line 542:
 
''The initial design of the game’s enemy artificial intelligence system contained three unique sets of behavioural controls. There was only one visual enemy style, however every enemy agent in the game would be assigned one of three possible ‘personalities’, referred to in the game’s code as the ‘Rod’, ‘Jane’ and ‘Freddy’ personality types. These personalities each had a different set of behavioural rules, thus allowing enemy agents that may otherwise appear identical to behave very differently to one another.''
 
''The initial design of the game’s enemy artificial intelligence system contained three unique sets of behavioural controls. There was only one visual enemy style, however every enemy agent in the game would be assigned one of three possible ‘personalities’, referred to in the game’s code as the ‘Rod’, ‘Jane’ and ‘Freddy’ personality types. These personalities each had a different set of behavioural rules, thus allowing enemy agents that may otherwise appear identical to behave very differently to one another.''
  
{| class="wikitable sortable" border=1
+
{| class="wikitable"
!Enemy Agent Personality Type !!Primary Behavioural Traits |
+
! Enemy Agent Personality Type !! Primary Behavioral Traits
 
|-
 
|-
| Rod || Will maintain a 'safe' distance to the player-character. <br />– unable to do so, will approach player character, investigate them (by getting close and smelling them), before continuing its patrol.  
+
| Rod ||  
 +
*Will maintain a 'safe' distance to the player-character.
 +
*If unable to do so, will approach player character, investigate them (by getting close and smelling them), before continuing its patrol.  
 
|-
 
|-
| Jane || Will maintain a ‘safe’ distance from player-character, whilst observing the player-character’s movements. <br />– If unable to maintain ‘safe’ distance, will panic and flee. <br />– If cornered and unable to flee, will attack and knock player-character to floor, then flee. <br />– Will only attack and kill player-character as a last resort.  
+
| Jane ||  
 +
*Will maintain a ‘safe’ distance from player-character, whilst observing the player-character’s movements
 +
*If unable to maintain ‘safe’ distance, will panic and flee.
 +
*If cornered and unable to flee, will attack and knock player-character to floor, then flee.  
 +
*Will only attack and kill player-character as a last resort.  
 
|-
 
|-
| Freddy || Will actively hunt the player-character. <br />– Will attack and kill them if given the opportunity.  
+
| Freddy ||  
 +
*Will actively hunt the player-character.
 +
*Will attack and kill them if given the opportunity.  
 
|-
 
|-
 
|}
 
|}
 +
 +
<syntaxhighlight lang="c">
 +
void SetTeslaPigFadeDisabled(string& asName, bool abX);
 +
</syntaxhighlight>
 +
 +
Enables/disables whether a specified Tesla ManPig should fade the player's view in and out.
 +
 +
#''asName ''- Internal name of the enemy
 +
#''abX''- Enabled/disabled
 +
 +
<syntaxhighlight lang="c">
 +
void SetTeslaPigSoundDisabled(string& asName, bool abX);
 +
</syntaxhighlight>
 +
 +
Enables/disables whether a specified Tesla ManPig should play the proximity sounds.
 +
 +
#''asName'' - Internal name of the enemy
 +
#''abX'' - Enabled/disabled
 +
 +
<syntaxhighlight lang="c">
 +
void SetTeslaPigEasyEscapeDisabled(string& asName, bool abX);
 +
</syntaxhighlight>
 +
 +
Enables/disables whether a specified Tesla ManPig should be easier to escape from when hunted. If not disabled, easy escape is activated if the player is more than 12.35 meters away, the enemy can't see the player, and the player has less than 75 health. When this occurs, the enemy is forced to stop hunting and wait for half a second.
 +
 +
#''asName'' - Internal name of the enemy
 +
#''abX'' - Enabled/disabled
 +
 +
<syntaxhighlight lang="c">
 +
void ForceTeslaPigSighting(string& asName);
 +
</syntaxhighlight>
 +
 +
Forces a Tesla ManPig to be visible for a short time.
 +
 +
#''asName'' - Internal name of the enemy
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void PlayEnemyAnimation(string@& asEnemy, string@& asAnimation, const bool abLoop, const float afDelay);
+
void PlayEnemyAnimation(string& asEnemyName, string& asAnimName, bool abLoop, float afFadeTime);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Plays a specific animation for an enemy.
 
Plays a specific animation for an enemy.
  
# ''asEnemy'' - Internal name of the enemy (asterisk is allowed)
+
# ''asEnemyName'' - Internal name of the enemy (asterisk is allowed)
# ''asAnimation'' - The name of an animation registered to the enemy
+
# ''asAnimName'' - The name of an animation registered to the enemy
# ''abLoop'' - Whether the animation loops
+
# ''abLoop'' - Whether the animation loops
# ''afDelay'' - Seems to affect how the animation plays out. A higher value makes the animation slower, although it seems to also skip some keyframes or perhaps merge them, making the animation look incorrect. Experiment to see what works based on the animation.
+
# ''afFadeTime'' - The fade time between animations
 +
 
 +
<syntaxhighlight lang="cpp">
 +
void PlayScriptedAnimation(string& asName, string& asAnimationName, bool abLoopAnimation);
 +
</syntaxhighlight>
 +
 
 +
Plays an animation that has been added to an entity through the Model Editor. Similar to ''PlayEnemyAnimation''.
 +
 
 +
# ''asName'' - Internal name of the enemy
 +
# ''asAnimationName'' - The animation name
 +
# ''abLoopAnimation'' - Whether to loop the animation or play it only once
 +
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void ChangeEnemyPose(string@& asEnemy, string@& asPose);
+
void ChangeEnemyPose(string& asName, string& asPoseType);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Changes the pose for an enemy. Can be either "Biped" or "Quadruped".
 
Changes the pose for an enemy. Can be either "Biped" or "Quadruped".
  
# ''asEnemy'' - Internal name of the enemy
+
# ''asName'' - Internal name of the enemy
# ''asPose''  - The pose to change to
+
# ''asPoseType''  - The pose to change to
 +
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void ForceEnemyWaitState(string@& asEnemy);
+
void ForceEnemyWaitState(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Forces the enemy's AI to change the state to "Wait" which makes the enemy wait for a short while before continuing its' normal actions. An enemy without patrol nodes defaults to the "Wait" state. Otherwise, if patrol nodes are added, the enemy will continue the path after waiting is done.
+
Forces the enemy's AI to change its state to "Wait", which makes the enemy wait for a short while before continuing its' normal actions. An enemy without patrol nodes defaults to the "Wait" state. Otherwise, if patrol nodes are added, the enemy will continue the path after waiting is done.
 +
 
 +
# ''asName'' - Internal name of the enemy
  
# ''asEnemy''  - Internal name of the enemy
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetEnemyBlind(string@& asEnemy, const bool abX);
+
void SendEnemyTimeOut(string& asName, float afTimeOut );
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Sets whether the enemy can see the player if they are within visible range.
+
Forces the enemy's AI to change its state to "TimeOut", which forces the enemy to pause.
 +
 
 +
# ''asName'' - Internal name of the enemy
 +
# ''afTimeOut'' - The length of the time out
  
# ''asEnemy''  - Internal name of the enemy
 
# ''abX''  - Whether enemy is blind
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetEnemyDeaf(string@& asEnemy, const bool abX);
+
void StopAnimationAndContinue(string& asName, float afTimeOut);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Sets whether the enemy can hear the player make sound if they are within audible range.
+
Forces the enemy to stop its patrol animation for the specified amount of time.
 +
 
 +
# ''asName'' - Internal name of the enemy
 +
# ''afTimeOut'' - The length of the time out
  
# ''asEnemy''  - Internal name of the enemy
 
# ''abX''  - Whether enemy is deaf
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
bool GetPlayerCanSeeEnemy(string@& asEnemy);
+
void SetEnemyBlind(string& asName, bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Returns whether the enemy is within visible range of the player.
+
Sets whether the enemy can see the player if they are within visible range.
 +
 
 +
# ''asName'' - Internal name of the enemy
 +
# ''abX'' - Whether enemy is blind
  
# ''asEnemy''  - Internal name of the enemy
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
float GetEnemyPlayerDistance(string@& asEnemy);
+
void SetEnemyDeaf(string& asName, bool abX);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Returns the distance (in HPL units) between the enemy and the player.
+
Sets whether the enemy can hear the player make sound if they are within audible range.
 +
 
 +
# ''asName'' - Internal name of the enemy
 +
# ''abX'' - Whether enemy is deaf
 +
 
 +
<syntaxhighlight lang="c++">
 +
bool GetPlayerCanSeeEnemy(string& asEnemyName);
 +
</syntaxhighlight>
  
# asEnemy - Internal name of the enemy
+
Returns whether the enemy is within visible range of the player.
  
=== Particles ===
+
# ''asEnemyName'' - Internal name of the enemy
  
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void SetParticleSystemActive(string@& asParticleSystem, const bool abActive);
+
float GetEnemyPlayerDistance(string& asEnemyName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Pauses a particle system in its current frame. The paused particle system remains frozen at this frame until reactivated or destroyed.
+
Returns the distance (in meters) between the enemy and the player.
 +
 
 +
# ''asEnemyName'' - Internal name of the enemy
  
# ''asParticleSystem''  - The name of the particle system
 
# ''abActive''  - False to pause, true to unpause
 
 
<syntaxhighlight lang="c++">
 
<syntaxhighlight lang="c++">
void DestroyParticleSystemInstantly(string@& asParticleSystem);
+
int GetEnemyState(string& asName);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Destroys a particle system and any existing particles already emitted from it. Similar to ''DestroyParticleSystem'', except that one will not destroy the existing particles and rather let them live out their lives. This function will cut all particles' lives short.
+
Returns the enemy's current state as an integer.
  
# ''asParticleSystem'' - The PS to destroy
+
# ''asName'' - Internal name of the enemy
  
 
<br />
 
<br />

Latest revision as of 08:31, 19 January 2025

Engine scripts

A list of script functions available in A Machine For Pigs (that are not present in The Dark Descent). Many of TDD's scripts are available in AMFP, but not all. Some are replaced by ones listed below, and others are removed.

General

void CheckPoint(string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry, bool abKeepPlayerInLimbo);

Creates a check point where the player will respawn if they die. Callback syntax:void MyFunc(string &in asName, int alCount) This function replaces TDD's CheckPoint().

  1. asName - The internal name of the callback
  2. asStartPos - The name of the PlayerStartArea to respawn at
  3. asCallback - The name of the callback function to run
  4. asDeathHintCat - The name of the .lang file category
  5. asDeathHintEntry - The name of the .lang file entry
  6. abKeepPlayerInLimbo - Whether to put the player into a state of "limbo" upon death. In limbo, the death occurs normally, but once the screen fades to black, it remains so until ReleasePlayerFromLimbo() is called. Player is still controllable during death.
void ReleasePlayerFromLimbo();

Respawns the player if stuck in "limbo". Limbo can be enabled with CheckPoint. Limbo is the state between life and death. The player enters limbo upon dying but won't respawn until this function is called.

Particle Systems

void SetParticleSystemActive(string& asName, bool abActive);

Pauses a particle system in its current frame. The paused particle system remains frozen at this frame until reactivated or destroyed.

  1. asName - The name of the particle system
  2. abActive - False to pause, true to unpause
void DestroyParticleSystemInstantly(string& asName);

Destroys a particle system and any existing particles already emitted from it. Similar to DestroyParticleSystem, except that one will not destroy the existing particles and rather let them live out their lives. This function will cut all particles' lives short.

  1. asName - The internal name of the particle system

Sounds

void AddEffectVoice2(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with two consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 2 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. abUsePosition - Whether to use 3D to play the sound from an entity
  9. asPosEntity - The entity to play the sound from. If empty, plays from player
  10. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  11. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio
void AddEffectVoice3(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with three consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 3 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. asText3Entry - The third .lang subtitle entry
  9. afText3Delay - The time to wait until the third subtitle starts
  10. abUsePosition - Whether to use 3D to play the sound from an entity
  11. asPosEntity - The entity to play the sound from. If empty, plays from player
  12. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  13. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio
void AddEffectVoice4(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with four consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 4 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. asText3Entry - The third .lang subtitle entry
  9. afText3Delay - The time to wait until the third subtitle starts
  10. asText4Entry - The fourth .lang subtitle entry
  11. afText4Delay - The time to wait until the fourth subtitle starts
  12. abUsePosition - Whether to use 3D to play the sound from an entity
  13. asPosEntity - The entity to play the sound from. If empty, plays from player
  14. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  15. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio
void AddEffectVoice5(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with five consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 5 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. asText3Entry - The third .lang subtitle entry
  9. afText3Delay - The time to wait until the third subtitle starts
  10. asText4Entry - The fourth .lang subtitle entry
  11. afText4Delay - The time to wait until the fourth subtitle starts
  12. asText5Entry - The fifth .lang subtitle entry
  13. afText5Delay - The time to wait until the fifth subtitle starts
  14. abUsePosition - Whether to use 3D to play the sound from an entity
  15. asPosEntity - The entity to play the sound from. If empty, plays from player
  16. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  17. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio
void AddEffectVoice5(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, string& asText6Entry, float afText6Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with six consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 6 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. asText3Entry - The third .lang subtitle entry
  9. afText3Delay - The time to wait until the third subtitle starts
  10. asText4Entry - The fourth .lang subtitle entry
  11. afText4Delay - The time to wait until the fourth subtitle starts
  12. asText5Entry - The fifth .lang subtitle entry
  13. afText5Delay - The time to wait until the fifth subtitle starts
  14. asText6Entry - The sixth .lang subtitle entry
  15. afText6Delay - The time to wait until the sixth subtitle starts
  16. abUsePosition - Whether to use 3D to play the sound from an entity
  17. asPosEntity - The entity to play the sound from. If empty, plays from player
  18. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  19. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio
void AddEffectVoice7(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry, float afTextDelay, string& asText2Entry, float afText2Delay, string& asText3Entry, float afText3Delay, string& asText4Entry, float afText4Delay, string& asText5Entry, float afText5Delay, string& asText6Entry, float afText6Delay, string& asText7Entry, float afText7Delay, bool abUsePostion, string& asPosEnitity, float afMinDistance, float afMaxDistance);

Plays an audio file with seven consecutive subtitles.

  1. asVoiceFile - The entire voice file to play (intended to include 7 sections)
  2. asEffectFile - The background effect file to play during voices. Leave empty for no extra effect
  3. asTextCat - The .lang text category for the subtitles
  4. asTextEntry - The first .lang subtitle entry
  5. afTextDelay - The time to wait until the first subtitle starts
  6. asText2Entry - The second .lang subtitle entry
  7. afText2Delay - The time to wait until the second subtitle starts
  8. asText3Entry - The third .lang subtitle entry
  9. afText3Delay - The time to wait until the third subtitle starts
  10. asText4Entry - The fourth .lang subtitle entry
  11. afText4Delay - The time to wait until the fourth subtitle starts
  12. asText5Entry - The fifth .lang subtitle entry
  13. afText5Delay - The time to wait until the fifth subtitle starts
  14. asText6Entry - The sixth .lang subtitle entry
  15. afText6Delay - The time to wait until the sixth subtitle starts
  16. asText7Entry - The seventh .lang subtitle entry
  17. afText7Delay - The time to wait until the seventh subtitle starts
  18. abUsePosition - Whether to use 3D to play the sound from an entity
  19. asPosEntity - The entity to play the sound from. If empty, plays from player
  20. afMinDistance - The minimum distance required between the player and the entity in order to hear the audio
  21. afMaxDistance - The maximum distance allowed between the player and the entity in order to hear the audio

Screen Effects

void ShowScreenImage(string& asImageName, float afX, float afY, float afScale, bool abUseRelativeCoordinates, float afDuration, float afFadeIn, float afFadeOut);

Shows a 2D image on the screen. Originally used for showing the intro logo during a sequence.

May work similarly to the ATTD 1.5 ShowScreenImage().

  1. asImageName - The image file to show. Does not have to be pow2 (although it gives a warning if not)
  2. afX- The X position of the top left corner, starting from the center of the screen. Use negative half of the width of the image to center it.
  3. afY- The Y position of the top left corner, starting from the center of the screen.
  4. afScale - The size of the image in pixels (not scale), or original image size if negative
  5. abUseRelativeCoordinates - Whether X and Y are relative to the screen resoltion, or pixel co-ordinates if not
  6. afDuration - How long, in seconds, the image displays. This does not include fade times
  7. afFadeIn - How long, in seconds, the fade in spends
  8. afFadeOut - How long, in seconds, the fade out spends

Journal

void AddHint(string& asNameAndTextEntry, string& asImage);

Adds a hint to the player's journal.
This function replaces TDD's AddDiary.

  1. asNameAndTextEntry - The .lang text entry of the hint. The entry must be in category "Journal" and use the format Hint_MyHint_Name for the title and Hint_MyHint_Text for the body, where MyHint replaces the value you put in this argument.
  2. asImage - This argument does not seem to be used. Presumed to be for displaying an image but possibly removed functionality. All existing occurrences are empty.
bool GetJournalDisabled();

Returns if the journal is currently disabled.

void SetJournalDisabled(bool abX);

Disables the player's ability to open their journal.

  1. abX - True to disable, false to enable again

Player

void SetLanternFlickerActive(bool abX);

Enables/disables the flicker effect for the lantern's light.

  1. abX - True to flicker, false to not flicker
void SetPlayerInfection(float afInfection);

Sets the infection level for the player. Infection replaces sanity from TDD and acts similar, however it goes from 0-100 instead of 100-0. An infection level above 50 will affect the player's ability to move. Infection level above 80 will kill the player after a 2 second delay. Infection slowly decreases over time, unless above 75.
This function replaces TDD's SetPlayerSanity.

  1. afInfection - The level of infection to set
void AddPlayerInfection(float afInfection);

Adds an amount of infection to the player's current amount.
This function replaces TDD's AddPlayerSanity.

  1. afInfection - The amount to add
float GetPlayerInfection();

Returns the amount of infection the player currently has.
This function replaces TDD's GetPlayerSanity.

void GiveInfectionDamage(float afAmount, bool abUseEffect);

Increases the infection of the player.
This function replaces TDD's GiveSanityDamage.

  1. afAmount - Amount of infection damage done
  2. abUseEffect - Determines whether a sound effect is played when the infection damage is dealt
void SetInfectionFauxMode(bool abFauxMode);

Enable/disable "faux mode" for infection. In faux mode, the player cannot die of infection and infection sounds don't play.

void FadePlayerPitchTo(float afX, float afSpeedMul, float afMaxSpeed);

Moves the player's pitch (up and down rotation).

  1. afX - The target pitch to move towards. 0 = straight forward. Clamped to range: -70 to +70.
  2. afSpeedMul - The speed multiplier of the movement. A low value makes a slow change.
  3. afMaxSpeed - The max speed of the movement.
void SetPlayerUsesDragFootsteps(bool abX);

Sets whether the player's footstep sounds are replaced with "drag" versions. Some surface materials do not have drag steps, and will therefore play no footstep sounds.

  1. abX - Whether to use "drag" step sounds

Entities

General

bool GetEntityActive(string& asName);

Returns whether an entity in the level is active or not.

  1. asName - The entity to check
void CreateEntityAtArea(string& asEntityName, string& asEntityFile, string& asAreaName, bool abFullGameSave, float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ);

Creates an entity at an area with the specified offsets and rotation.
This function replaces TDD's CreateEntityAtArea.

  1. asEntityName - The internal name of the created entity
  2. asEntityFile - The file for the entity (extension .ent)
  3. asAreaName - The area to create entity at
  4. abFullGameSave - Determines whether an entity "remembers" its state
  5. afOffsetX - The offset along the X axis in units
  6. afOffsetY - The offset along the Y axis in units
  7. afOffsetZ - The offset along the Z axis in units
  8. afRotX - The rotation on the X axis in degrees
  9. afRotY - The rotation on the Y axis in degrees
  10. afRotZ - The rotation on the Z axis in degrees

Props

void SetPhysicsAutoDisable(string& asName, bool abAutoDisable);

If physics bodies will automatically sleep (become inactive and stop moving). Only used on chandeliers in the campaign.

  1. asName - The prop to affect
  2. abAutoDisable - Whether physics auto disables or not
void AttachPropToBone(string& asChildEntityName, string& asParentEntityName, string& asParentBoneName, float fPosX, float fPosY, float fPosZ, float fRotX, float fRotY, float fRotZ);

Attaches a prop to a specific bone within another entity. You can inspect bones in the Model Editor. Note: Offsets and rotations are local to the bone and relative to its rotation.

  1. asChildEntityName - The prop to attach
  2. asParentEntityName - The entity that holds the bone to attach to
  3. asParentBoneName - The bone within the entity to attach to
  4. afPosX - Offset along the X axis
  5. afPosY - Offset along the Y axis
  6. afPosZ - Offset along the Z axis
  7. afRotX - Rotation along the X axis
  8. afRotY - Rotation along the Y axis
  9. afRotZ - Rotation along the Z axis
void DetachPropFromBone(string& asChildEntityName);

Detaches an attached prop. Note: When detached, physics are not automatically enabled on the prop.

  1. asChildEntityName - The attached prop
void AttachAreaToProp(string& asAreaName, string& asProp, int alBody);

Attaches an area to a prop. Originally used to attach a liquid area to a movable water plane entity in the sewers map.

  1. asAreaName - The area to attach
  2. asProp - The prop to attach area to
  3. alBody - The ID of the physics body of the prop to attach to
void StopPropAnimation(string& asProp);

Stops the animation currently playing on a prop. Animations can be started with PlayPropAnimation.

  1. asProp - The name of the prop
void PlayCurrentAnimation(string& asProp, float afFadeTime, bool abLoop);

Fades in the active animation, optionally allowing it to loop.

  1. asProp - The name of the prop
  2. afFadeTime - The fade time between animations
  3. abLoop - If the animation should be looped
void PauseCurrentAnimation(string& asProp, float afFadeTime);

Fades out the active animation.

  1. asProp - The name of the prop
  2. afFadeTime - The fade time between animations
void SetPropAnimationSpeed(string& asProp, float afSpeed);

Set the speed of the animation. Generally used in conjunction with PlayPropAnimation.

  1. asProp - The prop that is being animated
  2. afSpeed - The new animation speed
void SetPropAnimationPosition(string& asProp, float afPos);

Jumps to a specific point in an animation. Generally used in conjunction with PlayPropAnimation.

  1. asProp - The prop that is being animated
  2. afPos - The time within the animation, in seconds, to jump to

Lamps

void SetLampFlickerActive(string& asName, bool abActive);

Enables a flickering effect on a Lamp.

  1. asName - The lamp entity
  2. abActive - Whether to enable flicker
void FadeLampTo(string& asName, float afR, float afG, float afB, float afA, float afRadius, float afTime);

Fades a Lamp's light to another color. This function uses integers for color values instead of floats, which is a little odd. Likewise, it uses a double floating point for the last argument instead of a regular one.

  1. asName - The lamp to change
  2. afR - Red value (appropriate values are 0 - 10)
  3. afG - Green value (appropriate values are 0 - 10)
  4. afB - Blue value (appropriate values are 0 - 10)
  5. afA - Alpha value (has no effect?)
  6. afRadius - The new radius to use (affects illumination strength)
  7. afTime - Time in seconds until the light properties have changed
void SetLampCanBeLitByPlayer(string& asName, bool abX);

Enables/disables the player's ability to light a lamp.

  1. asName - The name of the Lamp
  2. abX - State to set

Doors

void SetSwingDoorOpenAmount(string& asName, float afOpenAmount, float afDuration, bool abOpenTowardsMaxAngle);

Sets the open amount for a SwingDoor.

  1. asName - The SwingDoor entity
  2. afOpenAmount - The new amount state to set. Range: 0 - 1
  3. afDuration - The time in seconds until the door has changed state
  4. abOpenTowardsMaxAngle - If the door will swing to its max angle instead of its min angle

Buttons

void SetButtonCanBeSwitchedOn(string& asName, bool abCanBeSwitchedOn);

Changes whether a Button can be switched from off to on.

  1. asName - The Button entity
  2. abCanBeSwitchedOn - Whether it can be switched on
void SetButtonCanBeSwitchedOff(string& asName, bool abCanBeSwitchedOff);

Changes whether a Button can be switched from on to off.

  1. asName - The Button entity
  2. abCanBeSwitchedOff - Whether it can be switched off

PhoneBoxes

void StartPhoneRinging(string& asName);

Enables a PhoneBox to start ringing. A ringing phone box can be interacted with to play some audio files. After interacting, the phone will stop ringing.

  1. asName - The PhoneBox entity
void StopPhoneRinging(string& asName);

Stops a ringing PhoneBox.

  1. asName - The PhoneBox entity
void HangUpPhone(string& asName);

Hangs up a PhoneBox.

  1. asName - The PhoneBox entity

Enemies

void AddEnemyPatrolNode(string& asName, string& asNodeName, float afWaitTime, string& asAnimation, bool abLoopAnimation);

Adds a patrol node to the enemy's walking path. A path is restarted from the beginning when the final node is reached. Note: Inputting an invalid animation in asAnimation at the final node will make the enemy wait there indefinitely.
This function replaces TDD's AddEnemyPatrolNode.

  1. asName - The name of the enemy
  2. asNodeName - Internal name of path node
  3. afWaitTime - The time, in seconds, the enemy waits at this node before continuing. Note: A time of 0 instead randomizes between 1 and 3 seconds, so use 0.01 instead if you want the enemy to immediately continue to the next node.
  4. asAnimation - The animation to play on the enemy when they arrive at this path node. Animations can be found in the Model Editor. Leave empty to play no special animation (uses default Idle animation). Note: If the animation lasts longer than afWaitTime, the enemy waits until the animation is complete before continuing the path.
  5. abLoopAnimation - If the animation should be looped
void SetEnemyMoveType(string& asName, string& asMoveType);

Changes how an enemy moves.

  1. asName - The name of the enemy
  2. asMoveType - The type to change to. Can be "WalkBiped", "RunBiped", "ChargeBiped", "Idle"
void SetManPigType(string& asName, string& asManPigType);

Sets the personality type for a ManPig enemy. Non-functional; left over from an earlier state of development. Only "Freddy" is used as the type, but supposedly it should also accept "Rod" and "Jane".

  1. asName - The ManPig enemy.
  2. asManPigType - The type to set. Type can be "Freddy", "Rod", "Jane"

The three types allegedly describe three different personality types for the AI, according to Peter Howell in his PhD, section 7.4.4.

Extract:

The initial design of the game’s enemy artificial intelligence system contained three unique sets of behavioural controls. There was only one visual enemy style, however every enemy agent in the game would be assigned one of three possible ‘personalities’, referred to in the game’s code as the ‘Rod’, ‘Jane’ and ‘Freddy’ personality types. These personalities each had a different set of behavioural rules, thus allowing enemy agents that may otherwise appear identical to behave very differently to one another.

Enemy Agent Personality Type Primary Behavioral Traits
Rod
  • Will maintain a 'safe' distance to the player-character.
  • If unable to do so, will approach player character, investigate them (by getting close and smelling them), before continuing its patrol.
Jane
  • Will maintain a ‘safe’ distance from player-character, whilst observing the player-character’s movements
  • If unable to maintain ‘safe’ distance, will panic and flee.
  • If cornered and unable to flee, will attack and knock player-character to floor, then flee.
  • Will only attack and kill player-character as a last resort.
Freddy
  • Will actively hunt the player-character.
  • Will attack and kill them if given the opportunity.
void SetTeslaPigFadeDisabled(string& asName, bool abX);

Enables/disables whether a specified Tesla ManPig should fade the player's view in and out.

  1. asName - Internal name of the enemy
  2. abX- Enabled/disabled
void SetTeslaPigSoundDisabled(string& asName, bool abX);

Enables/disables whether a specified Tesla ManPig should play the proximity sounds.

  1. asName - Internal name of the enemy
  2. abX - Enabled/disabled
void SetTeslaPigEasyEscapeDisabled(string& asName, bool abX);

Enables/disables whether a specified Tesla ManPig should be easier to escape from when hunted. If not disabled, easy escape is activated if the player is more than 12.35 meters away, the enemy can't see the player, and the player has less than 75 health. When this occurs, the enemy is forced to stop hunting and wait for half a second.

  1. asName - Internal name of the enemy
  2. abX - Enabled/disabled
void ForceTeslaPigSighting(string& asName);

Forces a Tesla ManPig to be visible for a short time.

  1. asName - Internal name of the enemy
void PlayEnemyAnimation(string& asEnemyName, string& asAnimName, bool abLoop, float afFadeTime);

Plays a specific animation for an enemy.

  1. asEnemyName - Internal name of the enemy (asterisk is allowed)
  2. asAnimName - The name of an animation registered to the enemy
  3. abLoop - Whether the animation loops
  4. afFadeTime - The fade time between animations
void PlayScriptedAnimation(string& asName, string& asAnimationName, bool abLoopAnimation);

Plays an animation that has been added to an entity through the Model Editor. Similar to PlayEnemyAnimation.

  1. asName - Internal name of the enemy
  2. asAnimationName - The animation name
  3. abLoopAnimation - Whether to loop the animation or play it only once
void ChangeEnemyPose(string& asName, string& asPoseType);

Changes the pose for an enemy. Can be either "Biped" or "Quadruped".

  1. asName - Internal name of the enemy
  2. asPoseType - The pose to change to
void ForceEnemyWaitState(string& asName);

Forces the enemy's AI to change its state to "Wait", which makes the enemy wait for a short while before continuing its' normal actions. An enemy without patrol nodes defaults to the "Wait" state. Otherwise, if patrol nodes are added, the enemy will continue the path after waiting is done.

  1. asName - Internal name of the enemy
void SendEnemyTimeOut(string& asName, float afTimeOut );

Forces the enemy's AI to change its state to "TimeOut", which forces the enemy to pause.

  1. asName - Internal name of the enemy
  2. afTimeOut - The length of the time out
void StopAnimationAndContinue(string& asName, float afTimeOut);

Forces the enemy to stop its patrol animation for the specified amount of time.

  1. asName - Internal name of the enemy
  2. afTimeOut - The length of the time out
void SetEnemyBlind(string& asName, bool abX);

Sets whether the enemy can see the player if they are within visible range.

  1. asName - Internal name of the enemy
  2. abX - Whether enemy is blind
void SetEnemyDeaf(string& asName, bool abX);

Sets whether the enemy can hear the player make sound if they are within audible range.

  1. asName - Internal name of the enemy
  2. abX - Whether enemy is deaf
bool GetPlayerCanSeeEnemy(string& asEnemyName);

Returns whether the enemy is within visible range of the player.

  1. asEnemyName - Internal name of the enemy
float GetEnemyPlayerDistance(string& asEnemyName);

Returns the distance (in meters) between the enemy and the player.

  1. asEnemyName - Internal name of the enemy
int GetEnemyState(string& asName);

Returns the enemy's current state as an integer.

  1. asName - Internal name of the enemy