User Tools

Site Tools


hpl2:amnesia:script_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl2:amnesia:script_functions [2019/09/19 17:41]
darkfire [Debugging]
hpl2:amnesia:script_functions [2020/03/10 22:48] (current)
mudbill Started formatting things a bit more consistently.
Line 8: Line 8:
  
 <code c++> <code c++>
-void OnStart(){ }+void OnStart();
 </​code>​ </​code>​
  
Line 14: Line 14:
  
 <code c++> <code c++>
-void OnEnter(){ }+void OnEnter();
 </​code>​ </​code>​
  
Line 20: Line 20:
  
 <code c++> <code c++>
-void OnLeave(){ }+void OnLeave();
 </​code>​ </​code>​
  
Line 26: Line 26:
  
 <code c++> <code c++>
-void OnGameStart(){ }+void OnGameStart();
 </​code>​ </​code>​
  
Line 39: Line 39:
 Generates a random float. Generates a random float.
  
-//afMin //- minimum value\\ +  - //afMin //- minimum value 
-//afMax //- maximum value+  ​- ​//afMax //- maximum value
 <code c++> <code c++>
 int RandInt(int alMin, int alMax); int RandInt(int alMin, int alMax);
 </​code>​ </​code>​
  
-Generates a random int. Note: the maximum value is //​inclusive//​ - the RandInt() function may return this value.+Generates a random int. Note: the maximum value is //​inclusive// ​ - the RandInt() function may return this value.
  
-//alMin //- minimum value\\ +  - //alMin //- minimum value 
-//alMax //- maximum value+  ​- ​//alMax //- maximum value
 <code c++> <code c++>
 bool StringContains(string&​ asString, string& asSubString);​ bool StringContains(string&​ asString, string& asSubString);​
 </​code>​ </​code>​
  
-Checks whether a string contains the specified string.\\ +Checks whether a string contains the specified string. \\ Example: searching for "​hello"​ in "hello world" would return **true**.
-Example: searching for "​hello"​ in "hello world" would return **true**.+
  
-//asString //- the string to check\\ +  - //asString //- the string to check 
-//​asSubString //- the string to search for+  ​- ​//​asSubString //- the string to search for
 <code c++> <code c++>
 string& StringSub(string&​ asString, int alStart, int alCount); string& StringSub(string&​ asString, int alStart, int alCount);
 </​code>​ </​code>​
  
-Returns the substring in a string.\\ +Returns the substring in a string. \\ Example: in the string "​frictional games rocks",​ using 4 as //​alStart// ​ and 6 as //​alCount// ​ would return **"​tional"​**.
-Example: in the string "​frictional games rocks",​ using 4 as //alStart// and 6 as //alCount// would return **"​tional"​**.+
  
-//asString //- the string\\ +  - //asString //- the string 
-//alStart //- start position in the string\\ +  ​- ​//alStart //- start position in the string 
-//alCount //- amount of characters+  ​- ​//alCount //- amount of characters
 <code c++> <code c++>
 int StringToInt(string&​in asString); int StringToInt(string&​in asString);
Line 76: Line 74:
 If possible, returns an integer converted from a string, else returns 0. If possible, returns an integer converted from a string, else returns 0.
  
-//​asString//​ - String to convert.+  - //​asString// ​ - String to convert.
 <code c++> <code c++>
 float StringToFloat(string&​in asString); float StringToFloat(string&​in asString);
Line 85: Line 83:
 If possible, returns a float converted from a string, else returns 0. If possible, returns a float converted from a string, else returns 0.
  
-//​asString//​ - String to convert.+  - //​asString// ​ - String to convert.
 <code c++> <code c++>
 bool StringToBool(string&​in asString); bool StringToBool(string&​in asString);
Line 94: Line 92:
 If possible, returns a boolean converted from a string, else returns false. If possible, returns a boolean converted from a string, else returns false.
  
-//​asString//​ - String to convert.+  - //​asString// ​ - String to convert.
 ==== Mathematical Operations ==== ==== Mathematical Operations ====
  
Line 105: Line 103:
 Returns the sine of the specified value. Returns the sine of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathCos(float afX); float MathCos(float afX);
Line 114: Line 112:
 Returns the cosine of the specified value. Returns the cosine of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathTan(float afX); float MathTan(float afX);
Line 123: Line 121:
 Returns the tangent of the specified value. Returns the tangent of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathAsin(float afX); float MathAsin(float afX);
Line 132: Line 130:
 Returns the arc sine of the specified value. Returns the arc sine of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathAcos(float afX); float MathAcos(float afX);
Line 141: Line 139:
 Returns the arc cosine of the specified value. Returns the arc cosine of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathAtan(float afX); float MathAtan(float afX);
Line 150: Line 148:
 Returns the arc tangent of the specified value. Returns the arc tangent of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathAtan2(float afX, float afY); float MathAtan2(float afX, float afY);
Line 159: Line 157:
 Calculates and returns the arc tangent of the specified values. Calculates and returns the arc tangent of the specified values.
  
-//afX// - First value to operate.\\ +  - //​afX// ​ - First value to operate. 
-//afY// - Second value to operate.+  ​- ​//​afY// ​ - Second value to operate.
 <code c++> <code c++>
 float MathSqrt(float afX); float MathSqrt(float afX);
Line 169: Line 167:
 Returns the square root of the specified value. Returns the square root of the specified value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 <code c++> <code c++>
 float MathPow(float afBase, float afExp); float MathPow(float afBase, float afExp);
Line 178: Line 176:
 Returns the value of afBase raised to the power of afExp. Returns the value of afBase raised to the power of afExp.
  
-//afBase// - The base value.\\ +  - //​afBase// ​ - The base value. 
-//afExp// - Value to calculate the base with.+  ​- ​//​afExp// ​ - Value to calculate the base with.
 <code c++> <code c++>
 float MathMin(float afA, float afB); float MathMin(float afA, float afB);
Line 188: Line 186:
 Returns the lowest value. Returns the lowest value.
  
-//afA// - First value.\\ +  - //​afA// ​ - First value. 
-//afB// - Second value.+  ​- ​//​afB// ​ - Second value.
 <code c++> <code c++>
 float MathMax(float afA, float afB); float MathMax(float afA, float afB);
Line 198: Line 196:
 Returns the highest value. Returns the highest value.
  
-//afA// - First value.\\ +  - //​afA// ​ - First value. 
-//afB// - Second value.+  ​- ​//​afB// ​ - Second value.
 <code c++> <code c++>
 float MathClamp(float afX, float afMin, float afMax); float MathClamp(float afX, float afMin, float afMax);
Line 208: Line 206:
 Returns afX clamped between afMin and afMax. If afX < afMin, returns afMin, and if afX > afMax, returns afMax. Returns afX clamped between afMin and afMax. If afX < afMin, returns afMin, and if afX > afMax, returns afMax.
  
-//afX// - The value to clamp.\\ +  - //​afX// ​ - The value to clamp. 
-//afMin// - The minimum value to clamp afX with.\\ +  ​- ​//​afMin// ​ - The minimum value to clamp afX with. 
-//afMax// - The maximum value to clamp afX with.+  ​- ​//​afMax// ​ - The maximum value to clamp afX with.
 <code c++> <code c++>
 float MathAbs(float afX); float MathAbs(float afX);
Line 219: Line 217:
 Returns the absolute value. Returns the absolute value.
  
-//afX// - Value to operate.+  - //​afX// ​ - Value to operate.
 ==== Debugging ==== ==== Debugging ====
  
Line 226: Line 224:
 </​code>​ </​code>​
  
-Prints a string to the log (''​hpl.log''​).+Prints a string to the log file (''​hpl.log''​). 
 <code c++> <code c++>
 void AddDebugMessage(string&​ asString, bool abCheckForDuplicates);​ void AddDebugMessage(string&​ asString, bool abCheckForDuplicates);​
Line 233: Line 232:
 Prints a string to the debug console. Prints a string to the debug console.
  
-//asString //- the string to print\\ +  - //asString //- the string to print 
-//​abCheckForDuplicates //- if true, the string won't be printed more than once on screen until it disappears+  ​- ​//​abCheckForDuplicates //- if true, the string won't be printed more than once on screen until it disappears
 <code c++> <code c++>
 void ProgLog(string&​ asLevel, string& asMessage); void ProgLog(string&​ asLevel, string& asMessage);
 </​code>​ </​code>​
  
-Prints an entry to the ProgLog.\\ +Prints an entry to the ProgLog ​(progression log). \\ ProgLog is a file created in Documents/​Amnesia/​main (or an FC folder if one is being used). It logs certain events, such us opening the menu or picking up the lantern, as well as the player'​s state (Health, Sanity, Oil, Tinderboxes,​ Coins), for the purpose of documenting a tester'​s playstyle. \\  \\ This function allows to log custom messages.The messages in the ProgLog file are sorted by time elapsed since a map was loaded.
-ProgLog is a file created in Documents/​Amnesia/​main (or an FC folder if one is being used). It logs certain events, such us opening the menu or picking up the lantern, as well as the player'​s state (Health, Sanity, Oil, Tinderboxes,​ Coins).\\ +
-\\ +
-This function allows to log custom messages.The messages in the ProgLog file are sorted by time elapsed since a map was loaded.+
  
-ProgLog has to be enabled for a player profile in ''​user_settings.cfg''​ before it starts working.+ProgLog has to be enabled for a player profile in ''​user_settings.cfg'' ​ before it starts working.
  
-//asLevel //- can be "​Low",​ "​Medium"​ or "​High"​. It's a tag which appears in each log entry, for event prioritising.\\ +  - //asLevel //- can be "​Low",​ "​Medium"​ or "​High"​. It's a tag which appears in each log entry, for event prioritising. 
-//asMessage //- The custom message to be printed to the log.+  ​- ​//asMessage //- The custom message to be printed to the log.
 <code c++> <code c++>
 bool ScriptDebugOn();​ bool ScriptDebugOn();​
 </​code>​ </​code>​
  
-Checks whether the debug mode is enabled.\\ +Checks whether the debug mode is enabled. \\ See [[:​hpl2:​amnesia:​devenvguide|Setting up Development Environment]] to setup debug mode on your own computer.
-See [[:​hpl2:​amnesia:​devenvguide|Setting up Development Environment]] to setup debug mode on your own computer.+
  
 ==== Variables ==== ==== Variables ====
Line 266: Line 261:
 int GetLocalVarInt(string&​ asName); int GetLocalVarInt(string&​ asName);
 </​code>​ </​code>​
- 
 <code c++> <code c++>
 void SetLocalVarFloat(string&​ asName, float afVal); void SetLocalVarFloat(string&​ asName, float afVal);
Line 272: Line 266:
 float GetLocalVarFloat(string&​ asName); float GetLocalVarFloat(string&​ asName);
 </​code>​ </​code>​
- 
 <code c++> <code c++>
 void SetLocalVarString(string&​ asName, const string& asVal); void SetLocalVarString(string&​ asName, const string& asVal);
Line 288: Line 281:
 int GetGlobalVarInt(string&​ asName); int GetGlobalVarInt(string&​ asName);
 </​code>​ </​code>​
- 
 <code c++> <code c++>
 void SetGlobalVarFloat(string&​ asName, float afVal); void SetGlobalVarFloat(string&​ asName, float afVal);
Line 294: Line 286:
 float GetGlobalVarFloat(string&​ asName); float GetGlobalVarFloat(string&​ asName);
 </​code>​ </​code>​
- 
 <code c++> <code c++>
 void SetGlobalVarString(string&​ asName, const string& asVal); void SetGlobalVarString(string&​ asName, const string& asVal);
Line 307: Line 298:
 </​code>​ </​code>​
  
-Preloads a particle system. ​Extension: .ps+Preloads a particle system.
  
 +  - //​asPSFile// ​ - The particle system file to load. Extension: .ps
 <code c++> <code c++>
 void CreateParticleSystemAtEntity(string&​ asPSName, string& asPSFile, string& asEntity, bool abSavePS); void CreateParticleSystemAtEntity(string&​ asPSName, string& asPSFile, string& asEntity, bool abSavePS);
Line 315: Line 307:
 Creates a particle system on an entity. Creates a particle system on an entity.
  
-//asPSName //- internal name\\ +  - //asPSName //- internal name 
-//asPSFile //- the particle system to use + extension .ps\\ +  ​- ​//asPSFile //- the particle system to use + extension .ps 
-//asEntity //- the entity to create the particle system at\\ +  ​- ​//asEntity //- the entity to create the particle system at 
-//abSavePS //- determines whether a particle system should "​remember"​ its shown/​hidden state, so that this state can be restored when the player revisits the level+  ​- ​//abSavePS //- determines whether a particle system should "​remember"​ its shown/​hidden state, so that this state can be restored when the player revisits the level
 <code c++> <code c++>
 void CreateParticleSystemAtEntityExt(string&​ asPSName, string& asPSFile, string& asEntity, bool abSavePS, void CreateParticleSystemAtEntityExt(string&​ asPSName, string& asPSFile, string& asEntity, bool abSavePS,
Line 327: Line 319:
 Creates a particle system on an entity, extended method with more options. Creates a particle system on an entity, extended method with more options.
  
-//asPSName //- internal name\\ +  - //asPSName //- internal name 
-//asPSFile //- the particle system to use + extension .ps\\ +  ​- ​//asPSFile //- the particle system to use + extension .ps 
-//asEntity //- the entity to create the particle system at\\ +  ​- ​//asEntity //- the entity to create the particle system at 
-//abSavePS //- determines whether a particle system should "​remember"​ its shown/​hidden state, so that this state can be restored when the player revisits the level\\ +  ​- ​//abSavePS //- determines whether a particle system should "​remember"​ its shown/​hidden state, so that this state can be restored when the player revisits the level 
-//afR //- red value\\ +  ​- ​//afR //- red value 
-//afG //- green value\\ +  ​- ​//afG //- green value 
-//afB //- blue value\\ +  ​- ​//afB //- blue value 
-//afA //- alpha value\\ +  ​- ​//afA //- alpha value 
-//​abFadeAtDistance //- determines whether a particle system fades from a certain distance on\\ +  ​- ​//​abFadeAtDistance //- determines whether a particle system fades from a certain distance on 
-//​afFadeMinEnd //- minimum distance at which the particle system stops fading\\ +  ​- ​//​afFadeMinEnd //- minimum distance at which the particle system stops fading 
-//​afFadeMinStart //- minimum distance at which the particle system starts fading\\ +  ​- ​//​afFadeMinStart //- minimum distance at which the particle system starts fading 
-//​afFadeMaxStart //- maximum distance at which the particle system starts fading\\ +  ​- ​//​afFadeMaxStart //- maximum distance at which the particle system starts fading 
-//​afFadeMaxEnd //- maximum distance at which the particle system stops fading+  ​- ​//​afFadeMaxEnd //- maximum distance at which the particle system stops fading
 <code c++> <code c++>
 void DestroyParticleSystem(string&​ asName); void DestroyParticleSystem(string&​ asName);
Line 346: Line 338:
 Destroys a particle system. Destroys a particle system.
  
 +  - //​asName// ​ - The internal name of the particle system
 ==== Sounds & Music ==== ==== Sounds & Music ====
  
Line 352: Line 345:
 </​code>​ </​code>​
  
-Preloads a sound. ​Extension: .snt+Preloads a sound.
  
 +  - //​asSoundFile// ​ - The sound file to load. Extension: .snt
 <code c++> <code c++>
 void PlaySoundAtEntity(string&​ asSoundName,​ string& asSoundFile,​ string& asEntity, float afFadeTime, bool abSaveSound);​ void PlaySoundAtEntity(string&​ asSoundName,​ string& asSoundFile,​ string& asEntity, float afFadeTime, bool abSaveSound);​
Line 360: Line 354:
 Creates a sound on an entity. Creates a sound on an entity.
  
-//​asSoundName //- internal name\\ +  - //​asSoundName //- internal name 
-//​asSoundFile //- the sound to use + extension .snt\\ +  ​- ​//​asSoundFile //- the sound to use + extension .snt 
-//asEntity //- the entity to create the sound at, can be "​Player"​\\ +  ​- ​//asEntity //- the entity to create the sound at, can be "​Player"​ 
-//​afFadeTime //- time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f\\ +  ​- ​//​afFadeTime //- time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f 
-//​abSaveSound //- if ''​true'',​ a looping sound will "​remember"​ its playback state (currently playing/​stopped),​ and that state will be restored the next time the level is entered. If ''​true'',​ the sound is never attached to the entity! Note that saving should only be used on //looping sounds//!+  ​- ​//​abSaveSound //- if ''​true'',​ a looping sound will "​remember"​ its playback state (currently playing/​stopped),​ and that state will be restored the next time the level is entered. If ''​true'',​ the sound is never attached to the entity! Note that saving should only be used on //looping sounds//!
 <code c++> <code c++>
 void FadeInSound(string&​ asSoundName,​ float afFadeTime, bool abPlayStart);​ void FadeInSound(string&​ asSoundName,​ float afFadeTime, bool abPlayStart);​
Line 371: Line 365:
 Fades in a sound. Fades in a sound.
  
-//​asSoundName //- internal name\\ +  - //​asSoundName //- internal name 
-//​afFadeTime //- time in seconds\\ +  ​- ​//​afFadeTime //- time in seconds 
-//​abPlayStart //- ?+  ​- ​//​abPlayStart //- ?
 <code c++> <code c++>
 void StopSound(string&​ asSoundName,​ float afFadeTime);​ void StopSound(string&​ asSoundName,​ float afFadeTime);​
Line 380: Line 374:
 Fades out a sound. Fades out a sound.
  
-//​asSoundName //- internal name\\ +  - //​asSoundName //- internal name 
-//​afFadeTime //- time in seconds, use 0 to immediatly stop the sound+  ​- ​//​afFadeTime //- time in seconds, use 0 to immediatly stop the sound
 <code c++> <code c++>
 void PlayMusic(string&​ asMusicFile,​ bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume); void PlayMusic(string&​ asMusicFile,​ bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
Line 388: Line 382:
 Plays music. Plays music.
  
-//​asMusicFile //- the music to play + extension .ogg\\ +  - //​asMusicFile //- the music to play + extension .ogg 
-//abLoop //- determines whether a music track should loop\\ +  ​- ​//abLoop //- determines whether a music track should loop 
-//afVolume //- volume of the music\\ +  ​- ​//afVolume //- volume of the music 
-//​afFadeTime //- time in seconds until music reaches full volume\\ +  ​- ​//​afFadeTime //- time in seconds until music reaches full volume 
-//alPrio //- priority of the music. Note that only the music with the highest priority can be heard! 0 - lowest, 1 - higher, etc.\\ +  ​- ​//alPrio //- priority of the music. Note that only the music with the highest priority can be heard! 0 - lowest, 1 - higher, etc. 
-//​abResume//​ - if ''​true'',​ playback will be continued from where the track stopped after the call to StopMusic();​ if ''​false'',​ the track will be restarted.+  ​- ​//​abResume// ​ - if ''​true'',​ playback will be continued from where the track stopped after the call to StopMusic();​ if ''​false'',​ the track will be restarted.
 <code c++> <code c++>
 void StopMusic(float afFadeTime, int alPrio); void StopMusic(float afFadeTime, int alPrio);
Line 400: Line 394:
 Stops music. Stops music.
  
-//​afFadeTime //- time in seconds until music stops\\ +  - //​afFadeTime //- time in seconds until music stops 
-//alPrio //- the priority of the music that should stop+  ​- ​//alPrio //- the priority of the music that should stop
 <code c++> <code c++>
 void FadeGlobalSoundVolume(float afDestVolume,​ float afTime); void FadeGlobalSoundVolume(float afDestVolume,​ float afTime);
Line 408: Line 402:
 Influences the global sound volume, that means everything you can hear **from the world**. This does not affect music of GUI sounds. Influences the global sound volume, that means everything you can hear **from the world**. This does not affect music of GUI sounds.
  
-//​afDestVolume //- desired volume\\ +  - //​afDestVolume //- desired volume 
-//afTime //- time in seconds until volume reaches desired volume+  ​- ​//afTime //- time in seconds until volume reaches desired volume
 <code c++> <code c++>
 void FadeGlobalSoundSpeed(float afDestSpeed,​ float afTime); void FadeGlobalSoundSpeed(float afDestSpeed,​ float afTime);
Line 416: Line 410:
 Influences the global sound speed. Influences the global sound speed.
  
-//​afDestSpeed //- desired speed\\ +  - //​afDestSpeed //- desired speed 
-//afTime //- time in seconds until volume reaches desired speed+  ​- ​//afTime //- time in seconds until volume reaches desired speed
 ==== Lights ==== ==== Lights ====
  
Line 426: Line 420:
 Enables/​disables lights. Enables/​disables lights.
  
-//​asLightName //- internal name\\ +  - //​asLightName //- internal name 
-//abVisible //- determines the state of the light+  ​- ​//abVisible //- determines the state of the light
 <code c++> <code c++>
 void FadeLightTo(string&​ asLightName,​ float afR, float afG, float afB, float afA, float afRadius, float afTime); void FadeLightTo(string&​ asLightName,​ float afR, float afG, float afB, float afA, float afRadius, float afTime);
Line 434: Line 428:
 Changes the properties of a light. Changes the properties of a light.
  
-//​asLightName //- internal name\\ +  - //​asLightName //- internal name 
-//afR //- red value\\ +  ​- ​//afR //- red value 
-//afG //- green value\\ +  ​- ​//afG //- green value 
-//afB //- blue value\\ +  ​- ​//afB //- blue value 
-//afA //- alpha value\\ +  ​- ​//afA //- alpha value 
-//afRadius //- radius of the light. -1 means keeping the radius\\ +  ​- ​//afRadius //- radius of the light. -1 means keeping the radius 
-//afTime //- time in seconds until change is done+  ​- ​//afTime //- time in seconds until change is done
 <code c++> <code c++>
 void SetLightFlickerActive(string&​ asLightName,​ bool abActive); void SetLightFlickerActive(string&​ asLightName,​ bool abActive);
Line 447: Line 441:
 Activates flickering on a light. Activates flickering on a light.
  
 +  - //​asLightName// ​ - The internal light name
 +  - //​abActive// ​ - true = active, false = inactive
 ===== Game scripts ===== ===== Game scripts =====
  
Line 457: Line 453:
 Starts the end credits screen. Starts the end credits screen.
  
-//asMusic //- the music to play (including .ogg)\\ +  - //asMusic //- the music to play (including .ogg) 
-//​abLoopMusic //- determines whether the music should loop\\ +  ​- ​//​abLoopMusic //- determines whether the music should loop 
-//asTextCat //- the category to be used in the .lang file\\ +  ​- ​//asTextCat //- the category to be used in the .lang file 
-//​asTextEntry //- the entry in the .lang file\\ +  ​- ​//​asTextEntry //- the entry in the .lang file 
-//alEndNum //- Amnesia has 3 different endings and displays a code at the bottom. Determines which code is displayed. 0-2 will display codes, any other integer will not.+  ​- ​//alEndNum //- Amnesia has 3 different endings and displays a code at the bottom. Determines which code is displayed. 0-2 will display codes, any other integer will not.
 <code c++> <code c++>
 void StartDemoEnd();​ void StartDemoEnd();​
Line 478: Line 474:
 </​code>​ </​code>​
  
-Sets a checkpoint at which the player will respawn in case he dies.\\ +Sets a checkpoint at which the player will respawn in case he dies. \\ Callback syntax: ​''​void MyFunc(string &in asName, int alCount)''  ​\\ Count is 0 on the first checkpoint load!
-Callback syntax: ​**void MyFunc(string &in asName, int alCount)** \\ +
-Count is 0 on the first checkpoint load!+
  
-//asName //- the internal name\\ +  - //asName //- the internal name 
-//​asStartPos //- the name of the StartPos in the editor\\ +  ​- ​//​asStartPos //- the name of the StartPos in the editor 
-//​asCallback //- the function to call when the player dies/​respawns\\ +  ​- ​//​asCallback //- the function to call when the player dies/​respawns 
-//​asDeathHintCat //- the category of the death hint message to be used in the .lang file\\ +  ​- ​//​asDeathHintCat //- the category of the death hint message to be used in the .lang file 
-//​asDeathHintEntry //- the entry in the .lang file+  ​- ​//​asDeathHintEntry //- the entry in the .lang file
 <code c++> <code c++>
 void ChangeMap(string&​ asMapName, string& asStartPos, string& asStartSound,​ string& asEndSound);​ void ChangeMap(string&​ asMapName, string& asStartPos, string& asStartSound,​ string& asEndSound);​
Line 493: Line 487:
 Immediatly loads another map. Immediatly loads another map.
  
-//asMapName //- the file to load\\ +  - //asMapName //- the file to load 
-//​asStartPos //- the name of the StartPos on the next map\\ +  ​- ​//​asStartPos //- the name of the StartPos on the next map 
-//​asStartSound //- the sound that is played when the change starts\\ +  ​- ​//​asStartSound //- the sound that is played when the change starts 
-//​asEndSound //- the sound that is played when the new map is loaded+  ​- ​//​asEndSound //- the sound that is played when the new map is loaded
 <code c++> <code c++>
 void ClearSavedMaps();​ void ClearSavedMaps();​
Line 516: Line 510:
 Sets the map name shown in save file names. If none is set NULL is assumed. Sets the map name shown in save file names. If none is set NULL is assumed.
  
-//​asNameEntry //- the entry to display, category must be "​Levels"​!+  - //​asNameEntry //- the entry to display, category must be "​Levels"​!
 <code c++> <code c++>
 void SetSkyBoxActive(bool abActive); void SetSkyBoxActive(bool abActive);
 </​code>​ </​code>​
  
-Enables<​nowiki>​\<​/nowiki>Disables the skybox.+Enables/​Disables the skybox.
  
 +  - //​abActive// ​ - true = active, false = inactive
 <code c++> <code c++>
 void SetSkyBoxTexture(string&​ asTexture); void SetSkyBoxTexture(string&​ asTexture);
Line 529: Line 524:
 Sets the texture of the skybox. Sets the texture of the skybox.
  
 +  - //​asTexture// ​ - The texture file to set. Extension: .dds
 <code c++> <code c++>
 void SetSkyBoxColor(float afR, float afG, float afB, float afA); void SetSkyBoxColor(float afR, float afG, float afB, float afA);
 </​code>​ </​code>​
  
-//afR //- red value\\ +Sets the solid color of the skybox rather than a texture. 
-//afG //- green value\\ + 
-//afB //- blue value\\ +  - //afR //- red value 
-//afA //- alpha value+  ​- ​//afG //- green value 
 +  ​- ​//afB //- blue value 
 +  ​- ​//afA //- alpha value
 <code c++> <code c++>
 void SetFogActive(bool abActive); void SetFogActive(bool abActive);
 </​code>​ </​code>​
  
-Enables<​nowiki>​\<​/nowiki>Disables the global fog.+Enables/​Disables the global fog.
  
 +  - //​abActive// ​ - true = active, false = inactive
 <code c++> <code c++>
 void SetFogColor(float afR, float afG, float afB, float afA); void SetFogColor(float afR, float afG, float afB, float afA);
 </​code>​ </​code>​
  
-//afR //- red value\\ +Sets the color to use for the global fog. 
-//afG //- green value\\ + 
-//afB //- blue value\\ +  - //afR //- red value 
-//afA //- alpha value+  ​- ​//afG //- green value 
 +  ​- ​//afB //- blue value 
 +  ​- ​//afA //- alpha value
 <code c++> <code c++>
 void SetFogProperties(float afStart, float afEnd, float afFalloffExp,​ bool abCulling); void SetFogProperties(float afStart, float afEnd, float afFalloffExp,​ bool abCulling);
 </​code>​ </​code>​
  
-//afStart //- how many meters from the camera should the fog begin\\ +Sets the properties for the global fog. 
-//afEnd //- how many meters from the camera should the fog reach full thickness\\ + 
-//​afFalloffExp //- the amount by which the thinkness increases\\ +  - //afStart //- how many meters from the camera should the fog begin 
-//abCulling //- whether occlusion culling is active for the fog; this prevents objects behind the fog from being loaded+  ​- ​//afEnd //- how many meters from the camera should the fog reach full thickness 
 +  ​- ​//​afFalloffExp //- the amount by which the thinkness increases 
 +  ​- ​//abCulling //- whether occlusion culling is active for the fog; this prevents objects behind the fog from being loaded
 <code c++> <code c++>
 void SetupLoadScreen(string&​asTextCat,​ string&​asTextEntry,​ int alRandomNum,​ string&​asImageFile);​ void SetupLoadScreen(string&​asTextCat,​ string&​asTextEntry,​ int alRandomNum,​ string&​asImageFile);​
Line 565: Line 568:
 Determines which loading screen will be shown when changing maps. Determines which loading screen will be shown when changing maps.
  
-//asTextCat //- the category of the loading text in the .lang file to be shown on the loading screen\\ +  - //asTextCat //- the category of the loading text in the .lang file to be shown on the loading screen 
-//​asTextEntry //- the entry in the .lang file\\ +  ​- ​//​asTextEntry //- the entry in the .lang file 
-//​alRandomNum //- if greater 1, then it will randomize between 1 and alRandom for each LoadScreen giving entry the suffix XX (eg 01). If < =1 then no suffix is added\\ +  ​- ​//​alRandomNum //- if greater 1, then it will randomize between 1 and alRandom for each LoadScreen giving entry the suffix XX (eg 01). If < =1 then no suffix is added 
-//​asImageFile //- the image to be shown (optional)+  ​- ​//​asImageFile //- the image to be shown (optional)
 ==== Game Timer ==== ==== Game Timer ====
  
Line 575: Line 578:
 </​code>​ </​code>​
  
-Creates a timer which calls a function when it expires.\\ +Creates a timer which calls a function when it expires. \\ Callback syntax: ​''​void MyFunc(string &in asTimer)''​
-Callback syntax: ​**void MyFunc(string &in asTimer)**+
  
-//asName //- the name of the timer\\ +  - //asName //- the name of the timer 
-//afTime //- time in seconds\\ +  ​- ​//afTime //- time in seconds 
-//​asFunction //- the function to call+  ​- ​//​asFunction //- the function to call
 <code c++> <code c++>
 void RemoveTimer(string&​ asName); void RemoveTimer(string&​ asName);
Line 587: Line 589:
 Removes a timer, no matter how much time is left. Removes a timer, no matter how much time is left.
  
 +  - //​asName// ​ - the internal name of the timer.
 <code c++> <code c++>
 float GetTimerTimeLeft(string&​ asName); float GetTimerTimeLeft(string&​ asName);
Line 593: Line 596:
 Returns the time left on a timer. Returns the time left on a timer.
  
 +  - //​asName// ​ - the internal name of the timer.
 ==== Screen Effects ==== ==== Screen Effects ====
  
Line 602: Line 606:
  
 //afTime //- time in seconds until the screen is completly black //afTime //- time in seconds until the screen is completly black
 +
 <code c++> <code c++>
 void FadeIn(float afTime); void FadeIn(float afTime);
Line 609: Line 614:
  
 //afTime //- time in seconds until the screen back to normal //afTime //- time in seconds until the screen back to normal
 +
 <code c++> <code c++>
 void FadeImageTrailTo(float afAmount, float afSpeed); void FadeImageTrailTo(float afAmount, float afSpeed);
Line 615: Line 621:
 Applies the image trail effect to the screen. Applies the image trail effect to the screen.
  
-//afAmount //- intensity (default: 0)\\ +//afAmount //- intensity (default: 0) \\ //afSpeed //- time in seconds until full effect 
-//afSpeed //- time in seconds until full effect+
 <code c++> <code c++>
 void FadeSepiaColorTo(float afAmount, float afSpeed); void FadeSepiaColorTo(float afAmount, float afSpeed);
Line 623: Line 629:
 Makes the screen go dark red. Makes the screen go dark red.
  
-//afAmount //- intensity (default: 0)\\ +//afAmount //- intensity (default: 0) \\ //afSpeed //- time in seconds until full effect 
-//afSpeed //- time in seconds until full effect+
 <code c++> <code c++>
 void FadeRadialBlurTo(float afSize, float afSpeed); void FadeRadialBlurTo(float afSize, float afSpeed);
Line 631: Line 637:
 Applies radial blur effects to the screen. Applies radial blur effects to the screen.
  
-//afSize //- intensity (default: 0)\\ +//afSize //- intensity (default: 0) \\ //afSpeed //- time in seconds until full effect 
-//afSpeed //- time in seconds until full effect+
 <code c++> <code c++>
 void SetRadialBlurStartDist(float afStartDist);​ void SetRadialBlurStartDist(float afStartDist);​
Line 640: Line 646:
  
 //​afStartDist //- the distance at which the effect starts //​afStartDist //- the distance at which the effect starts
 +
 <code c++> <code c++>
 void StartEffectFlash(float afFadeIn, float afWhite, float afFadeOut); void StartEffectFlash(float afFadeIn, float afWhite, float afFadeOut);
Line 646: Line 653:
 Fades the screen to white. Fades the screen to white.
  
-//afFadeIn //- time in seconds until screen is white\\ +//afFadeIn //- time in seconds until screen is white \\ //afWhite //- determines to which percentage the screen fades to white (1.0 = completly white) \\ //afFadeOut //- time in seconds until screen is back to normal again 
-//afWhite //- determines to which percentage the screen fades to white (1.0 = completly white)\\ +
-//afFadeOut //- time in seconds until screen is back to normal again+
 <code c++> <code c++>
 void StartEffectEmotionFlash(string&​ asTextCat, string& asTextEntry,​ string& asSound); void StartEffectEmotionFlash(string&​ asTextCat, string& asTextEntry,​ string& asSound);
Line 655: Line 661:
 Fades the screen to white and shows a text message. Fades the screen to white and shows a text message.
  
-//asTextCat //- the category in the .lang file\\ +//asTextCat //- the category in the .lang file \\ //​asTextEntry //- the text entry in the .lang file \\ //asSound //- the sound to play while fading 
-//​asTextEntry //- the text entry in the .lang file\\ +
-//asSound //- the sound to play while fading+
 <code c++> <code c++>
 void AddEffectVoice(string&​ asVoiceFile,​ string& asEffectFile,​ string& asTextCat, string& asTextEntry,​ void AddEffectVoice(string&​ asVoiceFile,​ string& asEffectFile,​ string& asTextCat, string& asTextEntry,​
Line 665: Line 670:
 This adds a voice and an effect to be played. It is okay to call this many times in order to play many voices in a row. The EffectVoiceOverCallback is not called until ALL voices have finished. This adds a voice and an effect to be played. It is okay to call this many times in order to play many voices in a row. The EffectVoiceOverCallback is not called until ALL voices have finished.
  
-//​asVoiceFile //- the voice to play\\ +//​asVoiceFile //- the voice to play \\ //​asEffectFile //- the effect to play \\ //asTextCat //- the category in the .lang file \\ //​asTextEntry //- the text entry in the .lang file \\ //​abUsePosition //- plays using 3D from the entity, or without 3D \\ //​asPosEntity //- the entity at which the effect appears \\ //​afMinDistance //- minimum distance to see the effect \\ //​afMaxDistance //- maximum distance to see the effect 
-//​asEffectFile //- the effect to play\\ +
-//asTextCat //- the category in the .lang file\\ +
-//​asTextEntry //- the text entry in the .lang file\\ +
-//​abUsePosition //- plays using 3D from the entity, or without 3D\\ +
-//​asPosEntity //- the entity at which the effect appears\\ +
-//​afMinDistance //- minimum distance to see the effect\\ +
-//​afMaxDistance //- maximum distance to see the effect+
 <code c++> <code c++>
 void StopAllEffectVoices(float afFadeOutTime);​ void StopAllEffectVoices(float afFadeOutTime);​
Line 689: Line 688:
 </​code>​ </​code>​
  
-Sets the function to be called when the EffectVoices are finished.\\ +Sets the function to be called when the EffectVoices are finished. \\ Callback syntax: **void MyFunc()** 
-Callback syntax: **void MyFunc()**+
 <code c++> <code c++>
 bool GetFlashbackIsActive();​ bool GetFlashbackIsActive();​
Line 702: Line 701:
 </​code>​ </​code>​
  
-Spawns ​particle systems around the player. ​It uses the settings ​from ''​.sps''​ files which are located in the ''/​misc''​ folder.\\ +Continuously spawn regular ​particle systems ​(''​.ps''​) ​around the player. ​Particles created by this script carry over from map to map. \\  \\ //​asSPSFile// ​ - the ''​.sps'' ​ file to use. Exemplary ''​.sps''  ​files are located in the ''/​misc'' ​ folder ​in the main game directory. \\  \\ Custom ''​.sps'' ​ files can be created by hand in a text editor (see existing ones and mimic how those are written)\\ Since ''​StopPlayerSpawnPS()'' ​ doesn'​t seem to work, to stop an SPS you must create an ''​.sps'' ​ file with an empty particle field field and override ​the old SPS by calling ''​StartPlayerSpawnPS'' ​ again.
-Can be used e.g. to continuously spawn fog effects around ​the player.+
  
 <code c++> <code c++>
Line 711: Line 709:
 Plays a sound, not using 3D. Plays a sound, not using 3D.
  
-//​asSoundFile //- the sound to play (extension is .snt)\\ +//​asSoundFile //- the sound to play (extension is .snt) \\ //afVolume //- the volume of the sound 
-//afVolume //- the volume of the sound+
 <code c++> <code c++>
 void StartScreenShake(float afAmount, float afTime, float afFadeInTime,​ float afFadeOutTime);​ void StartScreenShake(float afAmount, float afTime, float afFadeInTime,​ float afFadeOutTime);​
Line 719: Line 717:
 Shakes the screen. Shakes the screen.
  
-//afAmount //- intensity of the shake\\ +//afAmount //- intensity of the shake \\ //afTime //- duration of the shake \\ //​afFadeInTime //- time in seconds until full intensity is reached \\ //​afFadeOutTime //- time until screen is back to normal 
-//afTime //- duration of the shake\\ +
-//​afFadeInTime //- time in seconds until full intensity is reached\\ +
-//​afFadeOutTime //- time until screen is back to normal+
 <code c++> <code c++>
 void SetInDarknessEffectsActive(bool abX); void SetInDarknessEffectsActive(bool abX);
Line 731: Line 727:
 Enables/​disables the sanity drain and night vision effects while in the darkness. Enables/​disables the sanity drain and night vision effects while in the darkness.
  
-//bool abX// - Enable/​disable effects.+//bool abX//  - Enable/​disable effects. 
 ==== Insanity ==== ==== Insanity ====
  
Line 740: Line 737:
 Determines which InsanitySets are enabled. Determines which InsanitySets are enabled.
  
-//asSet //- the set\\ +//asSet //- the set \\ //abX //- enabled or not 
-//abX //- enabled or not+
 <code c++> <code c++>
 void StartInsanityEvent(string &in asEventName);​ void StartInsanityEvent(string &in asEventName);​
Line 751: Line 748:
  
 //​asEventName //- Insanity event to play. //​asEventName //- Insanity event to play.
 +
 <code c++> <code c++>
 void StartRandomInsanityEvent();​ void StartRandomInsanityEvent();​
Line 769: Line 767:
 </​code>​ </​code>​
  
-Checks whether an insanity event is currently in effect... Or so it was supposed to be, but as it doesn'​t return a value, we can never know {{http://​wiki.frictionalgames.com/​lib/​images/​smileys/​icon_smile.gif?​nolink&​15x15}}+Checks whether an insanity event is currently in effect… Or so it was supposed to be, but as it doesn'​t return a value, we can never know {{http://​wiki.frictionalgames.com/​lib/​images/​smileys/​icon_smile.gif?​nolink&​15x15}}
  
 ==== Player ==== ==== Player ====
Line 799: Line 797:
 Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects. Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects.
  
-//afX //- amount along the X-axis\\ +//afX //- amount along the X-axis \\ //afY //- amount along the Y-axis \\ //afZ //- amount along the Z-axis \\ //​abUseLocalCoords //- If true, axes are based on where the player is facing, not the world. 
-//afY //- amount along the Y-axis\\ +
-//afZ //- amount along the Z-axis\\ +
-//​abUseLocalCoords //- If true, axes are based on where the player is facing, not the world.+
 <code c++> <code c++>
 void ShowPlayerCrossHairIcons(bool abX); void ShowPlayerCrossHairIcons(bool abX);
Line 859: Line 855:
 Reduces the sanity of the player. Reduces the sanity of the player.
  
-//afAmount //- amount of sanity damage done\\ +//afAmount //- amount of sanity damage done \\ //​abUseEffect //- determines whether an effect is played when the sanity damage is dealt 
-//​abUseEffect //- determines whether an effect is played when the sanity damage is dealt+
 <code c++> <code c++>
 void GivePlayerDamage(float afAmount, string& asType, bool abSpinHead, bool abLethal); void GivePlayerDamage(float afAmount, string& asType, bool abSpinHead, bool abLethal);
Line 867: Line 863:
 Reduces the health of the player. Reduces the health of the player.
  
-//afAmount //- amount of damage done to health\\ +//afAmount //- amount of damage done to health \\ //asType //- plays a certain effect on the screen when the damage is dealt (BloodSplat,​ Claws or Slash) \\ //​abSpinHead //- changes the camera view when damage is dealt \\ //abLethal //- set to true if player can die from given damage 
-//asType //- plays a certain effect on the screen when the damage is dealt (BloodSplat,​ Claws or Slash)\\ +
-//​abSpinHead //- changes the camera view when damage is dealt\\ +
-//abLethal //- set to true if player can die from given damage+
 <code c++> <code c++>
 void FadePlayerFOVMulTo(float afX, float afSpeed); void FadePlayerFOVMulTo(float afX, float afSpeed);
Line 877: Line 871:
 Changes the field of view of the player. A shorter FOV will create a zoom effect. Changes the field of view of the player. A shorter FOV will create a zoom effect.
  
-//afX //- multiplier of default FOV (1 is default)\\ +//afX //- multiplier of default FOV (1 is default) \\ //afSpeed //- the speed of change between FOV's 
-//afSpeed //- the speed of change between FOV's+
 <code c++> <code c++>
 void FadePlayerAspectMulTo(float afX, float afSpeed); void FadePlayerAspectMulTo(float afX, float afSpeed);
Line 885: Line 879:
 Changes the aspect ratio of the player. Basically stretches or narrows the screen horizontally. Changes the aspect ratio of the player. Basically stretches or narrows the screen horizontally.
  
-//afX //- multiplier of default aspect (default is 1)\\ +//afX //- multiplier of default aspect (default is 1) \\ //afSpeed //- the speed of change between FOV's 
-//afSpeed //- the speed of change between FOV's+
 <code c++> <code c++>
 void FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);​ void FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);​
Line 893: Line 887:
 Rotates the position of the camera on the player'​s body. Rotates the position of the camera on the player'​s body.
  
-//afX //- angle of rotation of head, positive being counter-clockwise\\ +//afX //- angle of rotation of head, positive being counter-clockwise \\ //​afSpeedMul //- speed (possibly acceleration) multiplier of the rotation (default 1, which is really slow) \\ //​afMaxSpeed //- maximum speed of rotation 
-//​afSpeedMul //- speed (possibly acceleration) multiplier of the rotation (default 1, which is really slow)\\ +
-//​afMaxSpeed //- maximum speed of rotation+
 <code c++> <code c++>
 void MovePlayerHeadPos(float afX, float afY, float afZ, float afSpeed, float afSlowDownDist);​ void MovePlayerHeadPos(float afX, float afY, float afZ, float afSpeed, float afSlowDownDist);​
Line 902: Line 895:
 Changes the position of the camera on the player'​s body. Changes the position of the camera on the player'​s body.
  
-//afX //- amount along the X-axis\\ +//afX //- amount along the X-axis \\ //afY //- amount along the Y-axis \\ //afZ //- amount along the Z-axis \\ //afSpeed //- speed at which the change happens \\ //​afSlowDownDist //- distance at which to start slowing down (prevents the head from abruptly stopping) 
-//afY //- amount along the Y-axis\\ +
-//afZ //- amount along the Z-axis\\ +
-//afSpeed //- speed at which the change happens\\ +
-//​afSlowDownDist //- distance at which to start slowing down (prevents the head from abruptly stopping)+
 <code c++> <code c++>
 void StartPlayerLookAt(string&​ asEntityName,​ float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);​ void StartPlayerLookAt(string&​ asEntityName,​ float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);​
Line 914: Line 904:
 Forces the player to look at a certain entity until StopPlayerLookAt is used. Forces the player to look at a certain entity until StopPlayerLookAt is used.
  
-//​asEntityName //- the entity to look at\\ +//​asEntityName //- the entity to look at \\ //​afSpeedMul //- how fast should the player look at the entity \\ //​afMaxSpeed //- maximum speed allowed \\ //​asAtTargetCallback //- function to call when player looks at target 
-//​afSpeedMul //- how fast should the player look at the entity\\ +
-//​afMaxSpeed //- maximum speed allowed\\ +
-//​asAtTargetCallback //- function to call when player looks at target+
 <code c++> <code c++>
 void SetPlayerMoveSpeedMul(float afMul); void SetPlayerMoveSpeedMul(float afMul);
Line 969: Line 957:
 </​code>​ </​code>​
  
-Sets the function to call when the player uses his lantern.\\ +Sets the function to call when the player uses his lantern. \\ Callback syntax: **MyFunc(bool abLit)** 
-Callback syntax: **MyFunc(bool abLit)**+
 <code c++> <code c++>
 void SetMessage(string&​ asTextCategory,​ string& asTextEntry,​ float afTime); void SetMessage(string&​ asTextCategory,​ string& asTextEntry,​ float afTime);
Line 977: Line 965:
 Displays a message on the screen. Displays a message on the screen.
  
-//​asTextCategory //- the category in the .lang file\\ +//​asTextCategory //- the category in the .lang file \\ //​asTextEntry //- the entry in the .lang file \\ //afTime //- determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length. 
-//​asTextEntry //- the entry in the .lang file\\ +
-//afTime //- determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length.+
 <code c++> <code c++>
 void SetDeathHint(string&​ asTextCategory,​ string& asTextEntry);​ void SetDeathHint(string&​ asTextCategory,​ string& asTextEntry);​
Line 986: Line 973:
 Sets the message that appears when the player dies. Sets the message that appears when the player dies.
  
-//​asTextCategory //- the category in the .lang file\\ +//​asTextCategory //- the category in the .lang file \\ //​asTextEntry //- the entry in the .lang file 
-//​asTextEntry //- the entry in the .lang file+
 <code c++> <code c++>
 void DisableDeathStartSound();​ void DisableDeathStartSound();​
Line 1016: Line 1003:
 Sets the player'​s position within the level. Sets the player'​s position within the level.
  
-//afX// - X co-ordinate position.\\ +//​afX// ​ - X co-ordinate position. \\ //​afY// ​ - Y co-ordinate position. \\ //​afZ// ​ - Z co-ordinate position. 
-//afY// - Y co-ordinate position.\\ +
-//afZ// - Z co-ordinate position.+
 <code c++> <code c++>
 float GetPlayerPosX();​ float GetPlayerPosX();​
Line 1037: Line 1023:
 Adds a note to the player'​s journal. Adds a note to the player'​s journal.
  
-//​asNameAndTextEntry //- entries in the .lang file. Must end with _Name and _Text and be in category "​Journal"​!\\ +//​asNameAndTextEntry //- entries in the .lang file. Must end with _Name and _Text and be in category "​Journal"​! \\ //asImage //- the background image to be used 
-//asImage //- the background image to be used+
 <code c++> <code c++>
 void AddDiary(string&​ asNameAndTextEntry,​ string& asImage); void AddDiary(string&​ asNameAndTextEntry,​ string& asImage);
Line 1045: Line 1031:
 Adds a diary to the player'​s journal. Adds a diary to the player'​s journal.
  
-//​asNameAndTextEntry //- entries in the .lang file. Must end with _NameX and _TextY whereas X and Y are numbers of the parts (_Name1: first diary, _Text1: first page) and be in category "​Journal"​!\\ +//​asNameAndTextEntry //- entries in the .lang file. Must end with _NameX and _TextY whereas X and Y are numbers of the parts (_Name1: first diary, _Text1: first page) and be in category "​Journal"​! \\ //asImage //- the background image to be used 
-//asImage //- the background image to be used+
 <code c++> <code c++>
 void ReturnOpenJournal(bool abOpenJournal);​ void ReturnOpenJournal(bool abOpenJournal);​
Line 1061: Line 1047:
 Adds a quest to the player'​s journal. Adds a quest to the player'​s journal.
  
-//asName //- the internal name to be used\\ +//asName //- the internal name to be used \\ //​asNameAndTextEntry //- entry in the .lang file. Must start with "​Quest_<​texthere>​_Text”,​ and be in category “Journal”! 
-//​asNameAndTextEntry //- entry in the .lang file. Must start with "​Quest_<​texthere>​_Text”,​ and be in category “Journal”!+
 <code c++> <code c++>
 void CompleteQuest(string&​ asName, string& asNameAndTextEntry);​ void CompleteQuest(string&​ asName, string& asNameAndTextEntry);​
Line 1069: Line 1055:
 Completes a quest. Completes a quest.
  
-//asName //- the internal name of the quest\\ +//asName //- the internal name of the quest \\ //​asNameAndTextEntry //- entry in the .lang file. Must start with " Quest_<​texthere>​_Text ”, and be in category “Journal”! 
-//​asNameAndTextEntry //- entry in the .lang file. Must start with " Quest_<​texthere>​_Text ”, and be in category “Journal”!+
 <code c++> <code c++>
 bool QuestIsCompleted(string&​ asName); bool QuestIsCompleted(string&​ asName);
Line 1085: Line 1071:
  
 //​alNumberOfQuests //- Amount of Quests //​alNumberOfQuests //- Amount of Quests
 +
 <code c++> <code c++>
 void GiveHint (string&​ asName, string& asMessageCat,​ string& asMessageEntry,​ float afTimeShown);​ void GiveHint (string&​ asName, string& asMessageCat,​ string& asMessageEntry,​ float afTimeShown);​
Line 1091: Line 1078:
 Displays a hint on the player'​s screen. Displays a hint on the player'​s screen.
  
-//asName //- the internal name\\ +//asName //- the internal name \\ //​asMessageCat //- the category in the .lang file \\ //​asMessageEntry //- the entry in the .lang file \\ //​afTimeShown //- time in seconds until the message disappears. If time is <= 0 then the life time is calculated based on string length. 
-//​asMessageCat //- the category in the .lang file\\ +
-//​asMessageEntry //- the entry in the .lang file\\ +
-//​afTimeShown //- time in seconds until the message disappears. If time is <= 0 then the life time is calculated based on string length.+
 <code c++> <code c++>
 void RemoveHint (string&​ asName); void RemoveHint (string&​ asName);
Line 1123: Line 1108:
 Adds a message at the bottom of the inventory screen. Adds a message at the bottom of the inventory screen.
  
-//​asTextCategory //- the category in the .lang file\\ +//​asTextCategory //- the category in the .lang file \\ //​asTextEntry //- the entry in the .lang file \\ //afTime //- time in seconds until the message disappears. If life time is <= 0 then the life time is calculated based on string length. 
-//​asTextEntry //- the entry in the .lang file\\ +
-//afTime //- time in seconds until the message disappears. If life time is <= 0 then the life time is calculated based on string length.+
 <code c++> <code c++>
 void GiveItem(string&​ asName, string& asType, string& asSubTypeName,​ string& asImageName,​ float afAmount); void GiveItem(string&​ asName, string& asType, string& asSubTypeName,​ string& asImageName,​ float afAmount);
Line 1132: Line 1116:
 Adds an item to the inventory of the player. Note that the item does not have to exist as entity in the world to be able to do this. Adds an item to the inventory of the player. Note that the item does not have to exist as entity in the world to be able to do this.
  
-//asName //- internal name\\ +//asName //- internal name \\ //asType //- item to give \\ //​asSubTypeName //- item name for .lang file \\ //​asImageName //- For exemple: void GiveItem(string&​ asName, string& asType, "​chemical_container_full",​ <font 12pt:​normal/​auto;;​rgb(255,​0,​0);;​inherit>​“chemical_container_full.tga”</​font> ​   , float afAmount); The image is from <//​nowiki>// ​ <//​nowiki>// ​ <//​nowiki><​nowiki>​\</​nowiki>// ​ <///​nowiki>// ​ <///​nowiki>// ​ <///​nowiki>// ​ graphics<​nowiki>​\</​nowiki>​Item<​nowiki>​\</​nowiki>​chemical_container_full.tga : is the image which will appear in Inventory - [[http://​img155.imageshack.us/​img155/​6871/​20806785.jpg|img155.imageshack.us/​img155/​6871/​20806785.jpg]]
-//asType //- item to give\\ +
-//​asSubTypeName //- item name for .lang file\\ +
-//​asImageName //- For exemple: void GiveItem(string&​ asName, string& asType, "​chemical_container_full",​ <font 12pt:​normal/​auto;;​rgb(255,​0,​0);;​inherit>​“chemical_container_full.tga”</​font> ​   , float afAmount); The image is from <//​nowiki>//​ <//​nowiki>//​ <//​nowiki><​nowiki>​\</​nowiki>//​ <///​nowiki>//​ <///​nowiki>//​ <///​nowiki>//​ graphics<​nowiki>​\</​nowiki>​Item<​nowiki>​\</​nowiki>​chemical_container_full.tga : is the image which will appear in Inventory - [[http://​img155.imageshack.us/​img155/​6871/​20806785.jpg|img155.imageshack.us/​img155/​6871/​20806785.jpg]]+
  
 //afAmount //- amount to give //afAmount //- amount to give
 +
 <code c++> <code c++>
 void RemoveItem(string&​ asName); void RemoveItem(string&​ asName);
Line 1156: Line 1138:
 Adds a single item to the player'​s inventory. This is meant to be used for debug mostly as it creates the actual item and then destroys it. Adds a single item to the player'​s inventory. This is meant to be used for debug mostly as it creates the actual item and then destroys it.
  
-//asName //- internal name\\ +//asName //- internal name \\ //​asFileName //- item to give + extension (.ent) 
-//​asFileName //- item to give + extension (.ent)+
 <code c++> <code c++>
 void AddCombineCallback(string&​ asName, string& asItemA, string& asItemB, string& asFunction, bool abAutoRemove);​ void AddCombineCallback(string&​ asName, string& asItemA, string& asItemB, string& asFunction, bool abAutoRemove);​
 </​code>​ </​code>​
  
-Allows the player to combine items in his inventory.\\ +Allows the player to combine items in his inventory. \\ Callback syntax: **void MyFunc(string &in asItemA, string &in asItemB)** 
-Callback syntax: **void MyFunc(string &in asItemA, string &in asItemB)**+ 
 +//asName //- internal name for the callback \\ //asItemA //- internal name of first item \\ //asItemB //- internal name of second item \\ //​asFunction //- the function to call \\ //​abAutoRemove //- determines whether the callback should be removed when the items are combined
  
-//asName //- internal name for the callback\\ 
-//asItemA //- internal name of first item\\ 
-//asItemB //- internal name of second item\\ 
-//​asFunction //- the function to call\\ 
-//​abAutoRemove //- determines whether the callback should be removed when the items are combined 
 <code c++> <code c++>
 void RemoveCombineCallback(string&​ asName); void RemoveCombineCallback(string&​ asName);
 </​code>​ </​code>​
  
-Removes a combine callback.\\ +Removes a combine callback. \\ //​asName// ​ - the internal name of the callback to be removed (as specified in AddCombineCallback) 
-//asName// - the internal name of the callback to be removed (as specified in AddCombineCallback)+
 <code c++> <code c++>
 void AddUseItemCallback(string&​ asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy);​ void AddUseItemCallback(string&​ asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy);​
 </​code>​ </​code>​
  
-Allows the player to use items on the world.\\ +Allows the player to use items on the world. \\ Callback syntax: **void MyFunc(string &in asItem, string &in asEntity)** 
-Callback syntax: **void MyFunc(string &in asItem, string &in asEntity)**+ 
 +//asName //- internal name \\ //asItem //- internal name of the item \\ //asEntity //- entity to be able to use the item on \\ //​asFunction //- function to call \\ //​abAutoDestroy //- determines whether the item is destroyed when used
  
-//asName //- internal name\\ 
-//asItem //- internal name of the item\\ 
-//asEntity //- entity to be able to use the item on\\ 
-//​asFunction //- function to call\\ 
-//​abAutoDestroy //- determines whether the item is destroyed when used 
 <code c++> <code c++>
 void RemoveUseItemCallback(string&​ asName); void RemoveUseItemCallback(string&​ asName);
Line 1212: Line 1186:
 Activates/​deactivates an entity'​s visual mesh. The collision body remains. Activates/​deactivates an entity'​s visual mesh. The collision body remains.
  
-//asName// - Name of the entity.\\ +//​asName// ​ - Name of the entity. \\ //​abActive// ​ - Activate/​deactivate mesh. 
-//​abActive//​ - Activate/​deactivate mesh.+
 <code c> <code c>
 bool GetEntityExists(string&​ asName); bool GetEntityExists(string&​ asName);
Line 1226: Line 1200:
 Changes the crosshair that is used when focusing an entity. Changes the crosshair that is used when focusing an entity.
  
-//asName //- internal name\\ +//asName //- internal name \\ //​asCrossHair //- desired crosshair, can be: Default (uses default), Grab, Push, Ignite, Pick, LevelDoor, Ladder 
-//​asCrossHair //- desired crosshair, can be: Default (uses default), Grab, Push, Ignite, Pick, LevelDoor, Ladder+
 <code c> <code c>
 void CreateEntityAtArea(string&​ asEntityName,​ string& asEntityFile,​ string& asAreaName, bool abFullGameSave);​ void CreateEntityAtArea(string&​ asEntityName,​ string& asEntityFile,​ string& asAreaName, bool abFullGameSave);​
Line 1234: Line 1208:
 Creates an entity at an area. When creating an enemy though, it cannot chase properly along PathNodes(using for example ShowEnemyPlayerPosition). Creates an entity at an area. When creating an enemy though, it cannot chase properly along PathNodes(using for example ShowEnemyPlayerPosition).
  
-//​asEntityName //- internal name\\ +//​asEntityName //- internal name \\ //​asEntityFile //- entity to be used extension .ent \\ //​asAreaName //- the area to create the entity at \\ //​abFullGameSave //- determines whether an entity "​remembers"​ its state 
-//​asEntityFile //- entity to be used extension .ent\\ +
-//​asAreaName //- the area to create the entity at\\ +
-//​abFullGameSave //- determines whether an entity "​remembers"​ its state+
 <code c> <code c>
 void ReplaceEntity(string &in asName, string &in asBodyName, string &in asNewEntityName,​ string &in asNewEntityFile,​ bool abFullGameSave);​ void ReplaceEntity(string &in asName, string &in asBodyName, string &in asNewEntityName,​ string &in asNewEntityFile,​ bool abFullGameSave);​
Line 1246: Line 1218:
 Removes an entity and places a new one in its place. Removes an entity and places a new one in its place.
  
-//asName// - Name of the entity to replace.\\ +//​asName// ​ - Name of the entity to replace. \\ //​asBodyName// ​ - Name of the body of the entity to place the new entity at. If empty the first body is used (might be buggy, recommended to name a body anyway). \\ //​asNewEntityName// ​ - Name of the new entity. \\ //​asNewEntityFile// ​ - Name of the new entity file. Extension .ent. \\ //​abFullGameSave// ​ - Whether ALL properties of this entity should be saved throughout levels. 
-//​asBodyName//​ - Name of the body of the entity to place the new entity at. If empty the first body is used (might be buggy, recommended to name a body anyway).\\ +
-//​asNewEntityName//​ - Name of the new entity.\\ +
-//​asNewEntityFile//​ - Name of the new entity file. Extension .ent.\\ +
-//​abFullGameSave//​ - Whether ALL properties of this entity should be saved throughout levels.+
 <code c++> <code c++>
 void PlaceEntityAtEntity(string &in asName, string &in asTargetEntity,​ string &in asTargetBodyName,​ bool abUseRotation);​ void PlaceEntityAtEntity(string &in asName, string &in asTargetEntity,​ string &in asTargetBodyName,​ bool abUseRotation);​
Line 1259: Line 1228:
 Places an entity at the position of another entity. Does not work for enemies, use TeleportEnemyToEntity instead. Places an entity at the position of another entity. Does not work for enemies, use TeleportEnemyToEntity instead.
  
-//asName// - Name of the entity to place.\\ +//​asName// ​ - Name of the entity to place. \\ //​asTargetEntity// ​ - Name of the other entity to place the first entity at. \\ //​asTargetBodyName// ​ - Name of the body of the entity to place the first entity at. If empty the first body is used (might be buggy, recommended to name a body anyway). \\ //​abUseRotation// ​ - Whether the entity should be rotated like the target entity. 
-//​asTargetEntity//​ - Name of the other entity to place the first entity at.\\ +
-//​asTargetBodyName//​ - Name of the body of the entity to place the first entity at. If empty the first body is used (might be buggy, recommended to name a body anyway).\\ +
-//​abUseRotation//​ - Whether the entity should be rotated like the target entity.+
 <code c> <code c>
 void SetEntityPos(string &in asName, float afX, float afY, float afZ); void SetEntityPos(string &in asName, float afX, float afY, float afZ);
Line 1271: Line 1238:
 Moves an entity to a position in the level. Moves an entity to a position in the level.
  
-//asName// - Name of the entity to move.\\ +//​asName// ​ - Name of the entity to move. \\ //​afX// ​ - X co-ordinate position. \\ //​afY// ​ - Y co-ordinate position. \\ //​afZ// ​ - Z co-ordinate position. 
-//afX// - X co-ordinate position.\\ +
-//afY// - Y co-ordinate position.\\ +
-//afZ// - Z co-ordinate position.+
 <code c> <code c>
 float GetEntityPosX(string &in asName); float GetEntityPosX(string &in asName);
Line 1285: Line 1250:
 Returns an entity'​s position in the level on the specified axis. Returns an entity'​s position in the level on the specified axis.
  
-//asName// - Name of the entity.+//​asName// ​ - Name of the entity. 
 <code c> <code c>
 void SetEntityPlayerLookAtCallback(string&​ asName, string& asCallback, bool abRemoveWhenLookedAt);​ void SetEntityPlayerLookAtCallback(string&​ asName, string& asCallback, bool abRemoveWhenLookedAt);​
 </​code>​ </​code>​
  
-Calls a function when the player looks at a certain entity.\\ +Calls a function when the player looks at a certain entity. \\ Callback syntax: **void MyFunc(string &in asEntity, int alState)** ​ \\ alState: 1 = looking, -1 = not looking 
-Callback syntax: **void MyFunc(string &in asEntity, int alState)** \\ + 
-alState: 1 = looking, -1 = not looking+//asName //- internal name \\ //​asCallback //- function to call \\ //​abRemoveWhenLookedAt //- determines whether the callback should be removed when the player looked at the entity
  
-//asName //- internal name\\ 
-//​asCallback //- function to call\\ 
-//​abRemoveWhenLookedAt //- determines whether the callback should be removed when the player looked at the entity 
 <code c> <code c>
 void SetEntityPlayerInteractCallback(string&​ asName, string& asCallback, bool abRemoveOnInteraction);​ void SetEntityPlayerInteractCallback(string&​ asName, string& asCallback, bool abRemoveOnInteraction);​
 </​code>​ </​code>​
  
-Calls a function when the player interacts with a certain entity.\\ +Calls a function when the player interacts with a certain entity. \\ Callback syntax: **void MyFunc(string &in asEntity)** 
-Callback syntax: **void MyFunc(string &in asEntity)**+ 
 +//asName //- internal name \\ //​asCallback //- function to call \\ //​abRemoveOnInteraction //- determines whether the callback should be removed when the player interacts with the entity
  
-//asName //- internal name\\ 
-//​asCallback //- function to call\\ 
-//​abRemoveOnInteraction //- determines whether the callback should be removed when the player interacts with the entity 
 <code c> <code c>
 void SetEntityCallbackFunc(string&​ asName, string& asCallback);​ void SetEntityCallbackFunc(string&​ asName, string& asCallback);​
 </​code>​ </​code>​
  
-Calls a function when the player interacts with a certain entity.\\ +Calls a function when the player interacts with a certain entity. \\ Callback syntax: **void MyFunc(string &in asEntity, string &in type)** ​ \\ Type depends on entity type and includes: "​OnPickup",​ "​Break",​ "​OnIgnite",​ etc
-Callback syntax: **void MyFunc(string &in asEntity, string &in type)** \\ +
-Type depends on entity type and includes: "​OnPickup",​ "​Break",​ "​OnIgnite",​ etc+
  
 <code c> <code c>
Line 1319: Line 1278:
 </​code>​ </​code>​
  
-A callback called when ever the connection state changes (button being switched on, lever switched, etc).\\ +A callback called when ever the connection state changes (button being switched on, lever switched, etc). \\ Callback syntax: **void Func(string &in asEntity, int alState)** ​ \\ alState: -1 = off, 0 = between, 1 = on
-Callback syntax: **void Func(string &in asEntity, int alState)** \\ +
-alState: -1 = off, 0 = between, 1 = on+
  
 <code c> <code c>
Line 1339: Line 1296:
 </​code>​ </​code>​
  
-Calls a function when two entites collide.\\ +Calls a function when two entites collide. \\ Callback syntax: **void MyFunc(string &in asParent, string &in asChild, int alState)** ​ \\ alState: 1 = enter, -1 = leave 
-Callback syntax: **void MyFunc(string &in asParent, string &in asChild, int alState)** \\ + 
-alState: 1 = enter, -1 = leave+//​asParentName //- internal name of main object \\ //​asChildName //- internal name of object that collides with main object (asterix (<​nowiki>​*</​nowiki>​) NOT supported!) \\ //​asFunction //- function to call \\ //​abDeleteOnCollide //- determines whether the callback after it was called \\ //alStates //- 1 = only enter, -1 = only leave, 0 = both
  
-//​asParentName //- internal name of main object\\ 
-//​asChildName //- internal name of object that collides with main object (asterix (<​nowiki>​*</​nowiki>​) NOT supported!)\\ 
-//​asFunction //- function to call\\ 
-//​abDeleteOnCollide //- determines whether the callback after it was called\\ 
-//alStates //- 1 = only enter, -1 = only leave, 0 = both 
 <code c> <code c>
 void RemoveEntityCollideCallback(string&​ asParentName,​ string& asChildName);​ void RemoveEntityCollideCallback(string&​ asParentName,​ string& asChildName);​
Line 1353: Line 1305:
  
 Removes an EntityCollideCallback. Asterix (<​nowiki>​*</​nowiki>​) not supported in //​asChildName//​. Removes an EntityCollideCallback. Asterix (<​nowiki>​*</​nowiki>​) not supported in //​asChildName//​.
 +
 <code c> <code c>
 bool GetEntitiesCollide(string&​ asEntityA, string& asEntityB); bool GetEntitiesCollide(string&​ asEntityA, string& asEntityB);
Line 1367: Line 1320:
 Sets the mass of an entity'​s body. Sets the mass of an entity'​s body.
  
-//asName// - Name of the body of an entity. The body name of an entity is EntityName_BodyName.\\ +//​asName// ​ - Name of the body of an entity. The body name of an entity is EntityName_BodyName. \\ //​afMass// ​ - The mass to set. 
-//afMass// - The mass to set.+
 <code c> <code c>
 float GetBodyMass(string &in asName); float GetBodyMass(string &in asName);
Line 1377: Line 1330:
 Gets the mass of an entity'​s body. Gets the mass of an entity'​s body.
  
-//asName// - Name of the body of an entity. The body name of an entity is EntityName_BodyName.\\ +//​asName// ​ - Name of the body of an entity. The body name of an entity is EntityName_BodyName. \\ //​afMass// ​ - The mass to get. 
-//afMass// - The mass to get.+
 === Props === === Props ===
  
Line 1393: Line 1346:
 Activates/​deactivates a prop. Activates/​deactivates a prop.
  
-//asName //- internal name\\ +//asName //- internal name \\ //abActive //- nothing to add \\ //​afFadeTime //- time in seconds until prop fully fades 
-//abActive //- nothing to add\\ +
-//​afFadeTime //- time in seconds until prop fully fades+
 <code c> <code c>
 void SetPropStaticPhysics(string&​ asName, bool abX); void SetPropStaticPhysics(string&​ asName, bool abX);
Line 1414: Line 1366:
 Rotates the prop up to a set speed. Rotates the prop up to a set speed.
  
-//asName //- internal name\\ +//asName //- internal name \\ //afAcc //- acceleration \\ //​afGoalSpeed //- desired speed \\ //afAxisX //- rotation around X axis \\ //afAxisY //- rotation around Y axis \\ //afAxisZ //- rotation around Z axis \\ //​abResetSpeed //- determines whether the speed is resetted after goal speed is reached \\ //​asOffsetArea //- the area to rotate around, if empty, then the center of the body is used Note: The entity you want to rotate MUST be a "​StaticObject"​ entity! 
-//afAcc //- acceleration\\ +
-//​afGoalSpeed //- desired speed\\ +
-//afAxisX //- rotation around X axis\\ +
-//afAxisY //- rotation around Y axis\\ +
-//afAxisZ //- rotation around Z axis\\ +
-//​abResetSpeed //- determines whether the speed is resetted after goal speed is reached\\ +
-//​asOffsetArea //- the area to rotate around, if empty, then the center of the body is used Note: The entity you want to rotate MUST be a "​StaticObject"​ entity!+
 <​code>​ <​code>​
 void StopPropMovement(string&​ asName); void StopPropMovement(string&​ asName);
Line 1434: Line 1380:
 Attaches a prop to another prop. Attaches a prop to another prop.
  
-a//​sPropName//​- the prop to attach another prop at\\ +a//​sPropName//​- the prop to attach another prop at \\ //​asAttachName //- internal name of the prop that gets attached \\ //​asAttachFile //- the prop that gets attached extension .ent \\ //afPosX //- X position of the attach from the prop \\ //afPosY //- Y position of the attach from the prop \\ //afPosZ //- Z position of the attach from the prop \\ //afRotX //- rotation around X axis of the attach \\ //afRotY //- rotation around Y axis of the attach \\ //afRotZ //- rotation around ZX axis of the attach Note: for the purposes of "​AddEntityCollideCallback",​ attached props will not call the callback function if they collide with a "​static_object"​ or a "​StaticProp"​ entity type! 
-//​asAttachName //- internal name of the prop that gets attached\\ + 
-//​asAttachFile //- the prop that gets attached extension .ent\\ +**Bug:​** ​ //afRotZ //  is used for both the ZX rotation and the Z position of the attached prop. Unwanted rotation can be avoided by using: \\ AddAttachedPropToProp(asPropName,​asAttachName,​asAttachFile,​afPosX,​afPosY,​0,​afPosZ,​90.0f,​afPosZ)
-//afPosX //- X position of the attach from the prop\\ +
-//afPosY //- Y position of the attach from the prop\\ +
-//afPosZ //- Z position of the attach from the prop\\ +
-//afRotX //- rotation around X axis of the attach\\ +
-//afRotY //- rotation around Y axis of the attach\\ +
-//afRotZ //- rotation around ZX axis of the attach Note: for the purposes of "​AddEntityCollideCallback",​ attached props will not call the callback function if they collide with a "​static_object"​ or a "​StaticProp"​ entity type!+
  
-**Bug:​** ​//afRotZ // is used for both the ZX rotation ​and the Z position of the attached prop. Unwanted rotation can be avoided by using:\\ +**Bug:​** ​ ​Attaching a breakable prop to a physically active prop, and then breaking ​the attached prop, will cause the game to crash should the parent object ​be moved or reset.
-AddAttachedPropToProp(asPropName,​asAttachName,​asAttachFile,​afPosX,​afPosY,​0,​afPosZ,​90.0f,afPosZ)+
  
-**Bug:** Attaching a breakable prop to a physically active prop, and then breaking the attached prop, will cause the game to crash should the parent object be moved or reset. 
 <​code>​ <​code>​
 void AttachPropToProp(string&​ asPropName, string& asAttachName,​ string& asAttachFile,​ float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ); void AttachPropToProp(string&​ asPropName, string& asAttachName,​ string& asAttachFile,​ float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ);
Line 1456: Line 1394:
 Attaches a prop to another prop. Fixed version of AddAttachedPropToProp. Attaches a prop to another prop. Fixed version of AddAttachedPropToProp.
  
-//​asPropName //- the prop to attach another prop at\\ +//​asPropName //- the prop to attach another prop at \\ //​asAttachName //- internal name of the prop that gets attached \\ //​asAttachFile //- the prop that gets attached extension .ent \\ //afPosX //- X position of the attach from the prop \\ //afPosY //- Y position of the attach from the prop \\ //afPosZ //- Z position of the attach from the prop \\ //afRotX //- rotation around X axis of the attach \\ //afRotY //- rotation around Y axis of the attach \\ //afRotZ //- rotation around ZX axis of the attach Note: for the purposes of "​AddEntityCollideCallback",​ attached props will not call the callback function if they collide with a "​static_object"​ or a "​StaticProp"​ entity type! 
-//​asAttachName //- internal name of the prop that gets attached\\ +
-//​asAttachFile //- the prop that gets attached extension .ent\\ +
-//afPosX //- X position of the attach from the prop\\ +
-//afPosY //- Y position of the attach from the prop\\ +
-//afPosZ //- Z position of the attach from the prop\\ +
-//afRotX //- rotation around X axis of the attach\\ +
-//afRotY //- rotation around Y axis of the attach\\ +
-//afRotZ //- rotation around ZX axis of the attach Note: for the purposes of "​AddEntityCollideCallback",​ attached props will not call the callback function if they collide with a "​static_object"​ or a "​StaticProp"​ entity type!+
 <​code>​ <​code>​
 void RemoveAttachedPropFromProp(string&​ asPropName, string& asAttachName);​ void RemoveAttachedPropFromProp(string&​ asPropName, string& asAttachName);​
Line 1489: Line 1420:
 </​code>​ </​code>​
  
-Makes the prop play an animation and calls a function.\\ +Makes the prop play an animation and calls a function. \\ Callback syntax: **void MyFunc(string &in asProp)** 
-Callback syntax: **void MyFunc(string &in asProp)**+ 
 +//asProp //- internal name of the prop \\ //​asAnimation //- animation to play \\ //​afFadeTime //- ? \\ //abLoop //- determines whether the animation loops \\ //​asCallback //- function to call
  
-//asProp //- internal name of the prop\\ 
-//​asAnimation //- animation to play\\ 
-//​afFadeTime //- ?\\ 
-//abLoop //- determines whether the animation loops\\ 
-//​asCallback //- function to call 
 <​code>​ <​code>​
 void AddPropForce(string&​ asName, float afX, float afY, float afZ, string& asCoordSystem);​ void AddPropForce(string&​ asName, float afX, float afY, float afZ, string& asCoordSystem);​
Line 1504: Line 1431:
 </​code>​ </​code>​
  
-These functions push objects. Note that rather high values are needed when applying //forces// (on the order of ~100 (weak) to ~10000 (strong)), but not impulses (values less than 10 can be appropriate). Forces are external influences, and will have different effect depending on the mass of the object they are being applied to; impulses disregard mass, and can cause objects to break, as if hit. A "​Body"​ is a physics-related helper object, to which a force or an impulse can be applied. Entities can consist of several bodies, interconnected in various ways (you can create/​examine bodies in the model editor).+These functions push objects. Note that rather high values are needed when applying //​forces// ​ (on the order of ~100 (weak) to ~10000 (strong)), but not impulses (values less than 10 can be appropriate). Forces are external influences, and will have different effect depending on the mass of the object they are being applied to; impulses disregard mass, and can cause objects to break, as if hit. A "​Body"​ is a physics-related helper object, to which a force or an impulse can be applied. Entities can consist of several bodies, interconnected in various ways (you can create/​examine bodies in the model editor)
 + 
 +//asName //- the object to push; for bodies, use this format: "//​entityName//​_//​bodyName//"​ \\ //afX //- magnitude along the X-axis \\ //afY //- magnitude along the Y-axis \\ //afZ //- magnitude along the Z-axis \\ //​asCoordSystem //- determines which coordinate system is used, usually "​world"​ All of these functions are //​additive// ​ - when called consecutively,​ for each call, the vectors defined by (afX, afY, afZ) will be added together, and a resultant force/​impulse will be calculated //​before// ​ any physics simulation is applied to the target object.
  
-//asName //- the object to push; for bodies, use this format: "//​entityName//​_//​bodyName//"​\\ 
-//afX //- magnitude along the X-axis\\ 
-//afY //- magnitude along the Y-axis\\ 
-//afZ //- magnitude along the Z-axis\\ 
-//​asCoordSystem //- determines which coordinate system is used, usually "​world"​ All of these functions are //​additive//​ - when called consecutively,​ for each call, the vectors defined by (afX, afY, afZ) will be added together, and a resultant force/​impulse will be calculated //before// any physics simulation is applied to the target object. 
 === Connections === === Connections ===
  
Line 1519: Line 1443:
 Connects a prop with the movement of a rope (ie. turn wheel to move rope). Connects a prop with the movement of a rope (ie. turn wheel to move rope).
  
-//asName //- connection name\\ +//asName //- connection name \\ //​asPropName //- name of prop \\ //​asRopeName //- name of rope \\ //​abInteractOnly //- ? \\ //​afSpeedMul //- speed multiplier of how quickly the rope moves \\ //​afToMinSpeed //- the slowest the rope will move when moving the prop \\ //​afToMaxSpeed //- the fastest the rope will move when moving the prop \\ //abInvert //- whether to invert the direction the rope moves \\ //​alStatesUsed //- which states of the prop can interact with the rope? 
-//​asPropName //- name of prop\\ +
-//​asRopeName //- name of rope\\ +
-//​abInteractOnly //- ?\\ +
-//​afSpeedMul //- speed multiplier of how quickly the rope moves\\ +
-//​afToMinSpeed //- the slowest the rope will move when moving the prop\\ +
-//​afToMaxSpeed //- the fastest the rope will move when moving the prop\\ +
-//abInvert //- whether to invert the direction the rope moves\\ +
-//​alStatesUsed //- which states of the prop can interact with the rope?+
 <​code>​ <​code>​
 void InteractConnectPropWithMoveObject(string&​ asName, string& asPropName, string& asMoveObjectName,​ bool abInteractOnly,​ bool abInvert, int alStatesUsed);​ void InteractConnectPropWithMoveObject(string&​ asName, string& asPropName, string& asMoveObjectName,​ bool abInteractOnly,​ bool abInvert, int alStatesUsed);​
Line 1538: Line 1455:
 </​code>​ </​code>​
  
-Callback syntax: **void MyFunc(string &in asConnectionName,​ string &in asMainEntity,​ string &in asConnectEntity,​ int alState)** \\ +Callback syntax: **void MyFunc(string &in asConnectionName,​ string &in asMainEntity,​ string &in asConnectEntity,​ int alState)** ​ \\ State is what is sent to connection entity and will be inverted if abInvertStateSent = true!
-State is what is sent to connection entity and will be inverted if abInvertStateSent = true!+
  
 === Lamps === === Lamps ===
Line 1549: Line 1465:
 (Un)lits a lamp. (Un)lits a lamp.
  
-//asName //- Name of the lamp\\ +//asName //- Name of the lamp \\ //abLit //- Set true if you want the lamp to be lit, set to false if you want the lamp to be unlit \\ //abEffects //- If you want to have the lamp fade in/out when it gets (un)lit 
-//abLit //- Set true if you want the lamp to be lit, set to false if you want the lamp to be unlit\\ +
-//abEffects //- If you want to have the lamp fade in/out when it gets (un)lit+
 === Doors === === Doors ===
  
Line 1578: Line 1493:
 </​code>​ </​code>​
  
-Returns an integer depending on how far the door is opened.\\ +Returns an integer depending on how far the door is opened. \\ -1 = angle is close to 0°, 1 = angle is 70% or higher of max, 0 = inbetween -1 and 1.
--1 = angle is close to 0°, 1 = angle is 70% or higher of max, 0 = inbetween -1 and 1.+
  
 <​code>​ <​code>​
Line 1599: Line 1513:
 Displays a message when interacting with a locked level door. Displays a message when interacting with a locked level door.
  
-//asName //- internal name\\ +//asName //- internal name \\ //asTextCat //- the category in the .lang file \\ //​asTextEntry //- the entry in the .lang file 
-//asTextCat //- the category in the .lang file\\ +
-//​asTextEntry //- the entry in the .lang file+
 <​code>​ <​code>​
 void SetMoveObjectState(string&​ asName, float afState); void SetMoveObjectState(string&​ asName, float afState);
Line 1608: Line 1521:
 Moves an object to a certain state. Moves an object to a certain state.
  
-//asName //- internal name\\ +//asName //- internal name \\ //afState //- state of the object, 0 = closed, 1 = open, values inbetween (and above, for example, the bridge_metal_vert) are valid too! 
-//afState //- state of the object, 0 = closed, 1 = open, values inbetween (and above, for example, the bridge_metal_vert) are valid too!+
 <​code>​ <​code>​
 void SetMoveObjectStateExt(string&​ asName, float afState, float afAcc, float afMaxSpeed, float afSlowdownDist,​ bool abResetSpeed);​ void SetMoveObjectStateExt(string&​ asName, float afState, float afAcc, float afMaxSpeed, float afSlowdownDist,​ bool abResetSpeed);​
Line 1616: Line 1529:
 Moves an object to a certain state, extended method. Moves an object to a certain state, extended method.
  
-//asName //- internal name\\ +//asName //- internal name \\ //afState //- state of the object, 0 = closed, 1 = open, values inbetween are valid too! \\ //afAcc //- acceleration \\ //​afMaxSpeed //- maximum speed \\ //​afSlowdownDist //- Distance to the target state before decceleration occurs. \\ //​abResetSpeed //- Set to True if the prop's speed should be reset before performing the movement, else the prop will accelerate from it's current speed to afMaxSpeed. 
-//afState //- state of the object, 0 = closed, 1 = open, values inbetween are valid too!\\ +
-//afAcc //- acceleration\\ +
-//​afMaxSpeed //- maximum speed\\ +
-//​afSlowdownDist //- Distance to the target state before decceleration occurs.\\ +
-//​abResetSpeed //- Set to True if the prop's speed should be reset before performing the movement, else the prop will accelerate from it's current speed to afMaxSpeed.+
 === Levers, wheels and buttons === === Levers, wheels and buttons ===
  
Line 1632: Line 1541:
 Makes a prop<​nowiki>​\</​nowiki>​wheel<​nowiki>​\</​nowiki>​lever stuck in a certain state. Makes a prop<​nowiki>​\</​nowiki>​wheel<​nowiki>​\</​nowiki>​lever stuck in a certain state.
  
-//asName //- internal name\\ +//asName //- internal name \\ //alState //- 0 = not stuck, 1 = at max, -1 = at min \\ //abEffects //- use effects 
-//alState //- 0 = not stuck, 1 = at max, -1 = at min\\ +
-//abEffects //- use effects+
 <​code>​ <​code>​
 void SetWheelAngle(string&​ asName, float afAngle, bool abAutoMove);​ void SetWheelAngle(string&​ asName, float afAngle, bool abAutoMove);​
Line 1641: Line 1549:
 Moves a wheel to a certain angle. Moves a wheel to a certain angle.
  
-//asName //- internal name\\ +//asName //- internal name \\ //afAngle //- angle \\ //​abAutoMove //- determines whether the wheel should move on its own 
-//afAngle //- angle\\ +
-//​abAutoMove //- determines whether the wheel should move on its own+
 <​code>​ <​code>​
 void SetWheelInteractionDisablesStuck(string&​ asName, bool abX); void SetWheelInteractionDisablesStuck(string&​ asName, bool abX);
Line 1655: Line 1562:
 </​code>​ </​code>​
  
-Returns the state of the lever.\\ +Returns the state of the lever. \\ 0 = not stuck, 1 = at max, -1 = at min
-0 = not stuck, 1 = at max, -1 = at min+
  
 <​code>​ <​code>​
Line 1668: Line 1574:
 </​code>​ </​code>​
  
-Calls a function when state changes.\\ +Calls a function when state changes. \\ Callback syntax: **void MyFunc(string &in asEntity, int alState)** 
-Callback syntax: **void MyFunc(string &in asEntity, int alState)**+
 <​code>​ <​code>​
 void SetButtonSwitchedOn(string&​ asName, bool abSwitchedOn,​ bool abEffects); void SetButtonSwitchedOn(string&​ asName, bool abSwitchedOn,​ bool abEffects);
Line 1753: Line 1659:
 Adds a patrol node to the enemy'​s path. Adds a patrol node to the enemy'​s path.
  
-//asName //- internal name of the enemy\\ +//asName //- internal name of the enemy \\ //​asNodeName //- path node \\ //​afWaitTime //- time in seconds that the enemy waits at the path node before continuing \\ //​asAnimation //- the animation the enemy uses when reaching the path node 
-//​asNodeName //- path node\\ +
-//​afWaitTime //- time in seconds that the enemy waits at the path node before continuing\\ +
-//​asAnimation //- the animation the enemy uses when reaching the path node+
 <​code>​ <​code>​
 void ClearEnemyPatrolNodes(string&​ asEnemyName);​ void ClearEnemyPatrolNodes(string&​ asEnemyName);​
Line 1771: Line 1675:
 Enables/​disables whether an enemy activates the player'​s sanity drain when stared at. Enables/​disables whether an enemy activates the player'​s sanity drain when stared at.
  
-//asName //- Internal name of the enemy\\ +//asName //- Internal name of the enemy \\ //abX //- Enabled/​disabled 
-//abX //- Enabled/​disabled+
 <​code>​ <​code>​
 void TeleportEnemyToNode(string &in asEnemyName,​ string &in asNodeName, bool abChangeY); void TeleportEnemyToNode(string &in asEnemyName,​ string &in asNodeName, bool abChangeY);
Line 1781: Line 1685:
 Teleports an enemy to a specific PathNode. Teleports an enemy to a specific PathNode.
  
-//​asEnemyName //- Internal name of the enemy\\ +//​asEnemyName //- Internal name of the enemy \\ //​asNodeName //- Internal name of the node to teleport to \\ //abChangeY //- Whether the Y position of the node will be used when teleporting the enemy 
-//​asNodeName //- Internal name of the node to teleport to\\ +
-//abChangeY //- Whether the Y position of the node will be used when teleporting the enemy+
 <​code>​ <​code>​
 void TeleportEnemyToEntity(string &in asEnemyName,​ string &in asTargetEntity,​ string &in asTargetBody,​ bool abChangeY); void TeleportEnemyToEntity(string &in asEnemyName,​ string &in asTargetEntity,​ string &in asTargetBody,​ bool abChangeY);
Line 1792: Line 1695:
 Teleports an enemy to a specific entity. Teleports an enemy to a specific entity.
  
-//​asEnemyName //- Internal name of the enemy\\ +//​asEnemyName //- Internal name of the enemy \\ //​asTargetEntity //- Internal name of the entity to teleport to \\ //​asTargetBody//​- Internal name of the entity'​s body name to teleport to. If empty, the first body will be used (might be unstable, recommended to input a body anyway) \\ //abChangeY //- Whether the Y position of the node will be used when teleporting the enemy 
-//​asTargetEntity //- Internal name of the entity to teleport to\\ +
-//​asTargetBody//​- Internal name of the entity'​s body name to teleport to. If empty, the first body will be used (might be unstable, recommended to input a body anyway)\\ +
-//abChangeY //- Whether the Y position of the node will be used when teleporting the enemy+
 <code c> <code c>
 void ChangeManPigPose(string&​in asName, string&​in asPoseType);​ void ChangeManPigPose(string&​in asName, string&​in asPoseType);​
Line 1804: Line 1705:
 Changes the pose a specified ManPig. Changes the pose a specified ManPig.
  
-//asName //- Internal name of the enemy\\ +//asName //- Internal name of the enemy \\ //​asPoseType//​- Name of the ManPig pose to use. Can be "​Biped"​ or "​Quadruped"​ 
-//​asPoseType//​- Name of the ManPig pose to use. Can be "​Biped"​ or "​Quadruped"​+
 <code c> <code c>
 void SetTeslaPigFadeDisabled(string&​in asName, bool abX); void SetTeslaPigFadeDisabled(string&​in asName, bool abX);
Line 1814: Line 1715:
 Enables/​disables whether a specified TeslaPig should fade the player'​s view in and out. Enables/​disables whether a specified TeslaPig should fade the player'​s view in and out.
  
-//asName //- Internal name of the enemy\\ +//asName //- Internal name of the enemy \\ //abX//- Enabled/​disabled 
-//abX//- Enabled/​disabled+
 <code c> <code c>
 void SetTeslaPigSoundDisabled(string&​in asName, bool abX); void SetTeslaPigSoundDisabled(string&​in asName, bool abX);
Line 1824: Line 1725:
 Enables/​disables whether a specified TeslaPig should play the proximity sounds. Enables/​disables whether a specified TeslaPig should play the proximity sounds.
  
-//asName //- Internal name of the enemy\\ +//asName //- Internal name of the enemy \\ //abX//- Enabled/​disabled 
-//abX//- Enabled/​disabled+
 <code c> <code c>
 void SetTeslaPigEasyEscapeDisabled(string&​in asName, bool abX); void SetTeslaPigEasyEscapeDisabled(string&​in asName, bool abX);
Line 1834: Line 1735:
 Enables/​disables whether a specified TeslaPig should be easier to escape from when hunted. Enables/​disables whether a specified TeslaPig should be easier to escape from when hunted.
  
-//asName //- Internal name of the enemy\\ +//asName //- Internal name of the enemy \\ //abX//- Enabled/​disabled 
-//abX//- Enabled/​disabled+
 <code c> <code c>
 void ForceTeslaPigSighting(string&​in asName); void ForceTeslaPigSighting(string&​in asName);
Line 1845: Line 1746:
  
 //asName //- Internal name of the enemy //asName //- Internal name of the enemy
 +
 <code c> <code c>
 string& GetEnemyStateName(string &in asName); string& GetEnemyStateName(string &in asName);
hpl2/amnesia/script_functions.1568914889.txt.gz · Last modified: 2019/09/19 17:41 by darkfire