User Tools

Site Tools


hpl3:community:scripting:script_functions

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:community:scripting:script_functions [2015/10/26 13:17]
mudbill Entity_AddCollideCallback
hpl3:community:scripting:script_functions [2015/10/29 07:26] (current)
romulator
Line 1: Line 1:
 ====== Engine Scripts ====== ====== Engine Scripts ======
  
 +<​note>​This page is no longer being maintained, as all the Engine functions which this page was aiming to document have since been created. If you wish to view them, they can be found in HPL3 Documentation/​game/​Scripting/​function_reference by using the sidebar, or you can use [[hpl3:​game:​scripting:​function_reference:​hps_api|this link]] to access the hps_api functions and view them from there. ​
 +
 +This page will eventually be removed. (10-29-2015,​ Romulator)</​note> ​
 +
 +This page is here as a reference documentation available online covering the main script functions within HPL3. The Basic Code section contains scripts that are available by default and found within the **hps_api.hps** file located in the SOMA game directory. Under "​Helper Files" you will find the functions referenced in the specific helper files which require a script import from the script folder.
 +
 +{{:​hpl3:​community:​scripting:​wip-icon.png?​nolink&​}}**Note:​ This is a work-in-progress page. In time, it will contain much more, including all built-in functions, helper files and possibly more.**
 ===== Basic Code ===== ===== Basic Code =====
  
-This page is here as reference documentation available online covering ​the main script functions within ​HPL3These are the ones included ​by default ​and are found within ​the **hps_api.hps** file located ​in the SOMA game directory.+The code referenced ​here is included by default in the game, and can be accessed without the use of #include statement, contrary to the helper scripts. Each function is followed by a short description,​ argument explanations and callback syntax (if used). 
 + 
 +==== Main ==== 
 + 
 +<code =c++>#​include <​helper.hps>​ 
 +</​code>​ 
 + 
 +Used to include scripts and referencing from various helper files created outside of the Base Scripts. (Eventually) All the helper files as found in SOMA/script/helpers/ will be included below the main scripts. 
 + 
 +<code =c++> 
 +class cScrMap : iScrMap { } 
 +</​code>​ 
 + 
 +A declaration of a class where the map (cScrMap) is able to access ​functions ​and reference material from scripts (iScrMap). Your code for your map should go within ​the braces of this declaration. 
 + 
 +<code =c++>​void Setup(){ } 
 +</​code>​ 
 + 
 +Used when the map is being loaded/​prepared/​set up for the player. Called before OnStart();. Useful for setting up variables in the level. 
 + 
 +<code =c++>​void OnStart(){ } 
 +</​code>​ 
 + 
 +Called when the player first enters the map, and only on this first occasion. Useful for setting up callbacks. 
 + 
 +<code =c++>​void OnEnter(){ } 
 +</​code>​ 
 + 
 +Called when the player enters and re-enters the map. Useful for setting up variables and "​hub"​ levels ("​hub"​ meaning, levels that branch off into others). 
 + 
 +<code =c++>​void OnLeave(){ } 
 +</​code>​ 
 + 
 +Called when the player exits the level. Useful for ending certain events which occurred in the previous level (Using Music_Stop() for example). 
 + 
 +<code =c++>​void OnAction(){ } 
 +</​code>​ 
 + 
 +Called when an action is completed. Often used by Frictional Games to debug and test certain events. 
 + 
 +Other callbacks which can be used to perform certain actions [[:​hpl3:​game:​scripting|can be found here]]. 
 + 
 +==== Billboard ==== 
 + 
 +<code =c++>​void Billboard_SetVisible(const tString &in asBillboardName, ​ bool abVisible);​ 
 +</​code>​ 
 + 
 +Sets whether a billboard should be rendered or not. 
 + 
 +//​asBillboardName//​ - name of the billboardWildcards %%*%% supported.\\ 
 +//​abVisible//​ - true = visible, false = invisible. 
 +==== Body ==== 
 + 
 +<code =c++>​void Body_AddForce(const tString &in asBodyName, ​ const cVector3f &in avForce, ​ bool abLocalSpace);​ 
 +</​code>​ 
 + 
 +Adds push force to a body. 
 + 
 +//​asBodyName//​ - the name of the body.\\ 
 +//avForce// - the push force to apply.\\ 
 +//​abLocalSpace//​ - true = local force, false = global force. 
 +==== Button ==== 
 + 
 +<code =c++>​void Button_SetSwitchedOn(const tString&​ in asName, ​ bool abState, ​ bool abEffects);​ 
 +</​code>​ 
 + 
 +Switches a button on or off. 
 + 
 +//asName// - name of the button.\\ 
 +//abState// - true = on, false = off.\\ 
 +//​abEffects//​ - whether the change should use effects associated with it. If false, the player will not be apparent to the change. 
 +==== EnergySource ==== 
 + 
 +<code =c++>​void EnergySource_SetEnergy(const tString &in asName, ​ float afX); 
 +</​code>​ 
 + 
 +Sets the energy level of an energy source.
  
-<​note>​This is a work-in-progress page. In time, it will contain much more than just the helpers.</note>+//​asName// ​name of the energy source.\\ 
 +//afX// - the energy amount.
 ==== Entity ==== ==== Entity ====
  
Line 24: Line 108:
 Set whether an entity is active (visible and functioning) or not. Set whether an entity is active (visible and functioning) or not.
  
-//asName //- the name of the entity (wildcards * are supported).\\+//asName //- the name of the entity (wildcards ​%%*%% are supported).\\
 //abActive //- if active or not. //abActive //- if active or not.
 <code =c++> <code =c++>
Line 32: Line 116:
 Check if an entity is active (visible and functioning) or not. Check if an entity is active (visible and functioning) or not.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++>​void Entity_SetInteractionDisabled(const tString &in asEntityName, ​ bool abX); <code =c++>​void Entity_SetInteractionDisabled(const tString &in asEntityName, ​ bool abX);
 </​code>​ </​code>​
Line 38: Line 122:
 Sets whether an entity can be interacted with by the player or not. Sets whether an entity can be interacted with by the player or not.
  
-//​asEntityName//​ - the name of the entity (wildcards * are supported).\\+//​asEntityName//​ - the name of the entity (wildcards ​%%*%% are supported).\\
 //abX// - true = interaction disabled | false = interaction enabled. //abX// - true = interaction disabled | false = interaction enabled.
 <code =c++>​void Entity_SetMaxInteractionDistance(const tString &in asEntityName, ​ float afDistance);​ <code =c++>​void Entity_SetMaxInteractionDistance(const tString &in asEntityName, ​ float afDistance);​
Line 45: Line 129:
 Override the default max distance an entity can be interacted with. Override the default max distance an entity can be interacted with.
  
-//​asEntityName//​ - the name of the entity (wildcards * are supported).\\+//​asEntityName//​ - the name of the entity (wildcards ​%%*%% are supported).\\
 //​afDistance//​ - the distance (in meters) the entity can be interacted with from. //​afDistance//​ - the distance (in meters) the entity can be interacted with from.
 <code =c++> <code =c++>
Line 59: Line 143:
 Forces the entity to sleep. This disables Update and PostUpdate. Has no effect if entity is already sleeping. Forces the entity to sleep. This disables Update and PostUpdate. Has no effect if entity is already sleeping.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++>​void Entity_WakeUp(const tString &in asName); <code =c++>​void Entity_WakeUp(const tString &in asName);
 </​code>​ </​code>​
Line 65: Line 149:
 Wakes a sleeping entity. This enabled Update and PostUpdate. Has no effect if entity is already awake. Wakes a sleeping entity. This enabled Update and PostUpdate. Has no effect if entity is already awake.
  
-//asName// - the name of the entity (wildcards * are supported).+//asName// - the name of the entity (wildcards ​%%*%% are supported).
 <code =c++> <code =c++>
 bool Entity_IsSleeping(const tString &in asName); bool Entity_IsSleeping(const tString &in asName);
Line 78: Line 162:
 Sets whether an entity should automatically sleep when it doesn'​t require updates. Sets whether an entity should automatically sleep when it doesn'​t require updates.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //abX// - enabled or disabled. //abX// - enabled or disabled.
 <code =c++> <code =c++>
Line 92: Line 176:
 Set whether an entity is an occluder. Set whether an entity is an occluder.
  
-//asName// - the name of the entity (wildcards ​(<​nowiki>​*</​nowiki>​) ​are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​abOccluder//​ - enabled or disabled. //​abOccluder//​ - enabled or disabled.
 <code =c++> <code =c++>
Line 112: Line 196:
 Sets a value of an entity variable. Sets a value of an entity variable.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​asVarName//​ - the name of the variable for the entity.\\ //​asVarName//​ - the name of the variable for the entity.\\
 //aX// - the value of the variable. //aX// - the value of the variable.
Line 123: Line 207:
 Increments a value of an entity variable. Increments a value of an entity variable.
  
-//asName// - the name of the entity (wildcards * are supported).\\+//asName// - the name of the entity (wildcards ​%%*%% are supported).\\
 //​asVarName//​ - the name of the variable for the entity.\\ //​asVarName//​ - the name of the variable for the entity.\\
 //aX// - the value to add. //aX// - the value to add.
Line 140: Line 224:
 //asName// - the name of the entity.\\ //asName// - the name of the entity.\\
 //​asVarName//​ - the name of the variable for the entity. //​asVarName//​ - the name of the variable for the entity.
- +<code =c++>
-<​code=c++>​+
 bool Entity_AddCollideCallback(const tString &in asParentName, ​ const tString &in asChildName, ​ const tString &in asFunction);​ bool Entity_AddCollideCallback(const tString &in asParentName, ​ const tString &in asChildName, ​ const tString &in asFunction);​
 </​code>​ </​code>​
  
-Adds a callback between two entities (objects, areas, player etc) when they collide with each other. Collisions include when "​uncolliding"​ as well. Wildcards * are supported in names.+Adds a callback between two entities (objects, areas, player etc) when they collide with each other. Collisions include when "​uncolliding"​ as well. Wildcards ​%%*%% are supported in names.
  
 //​asParentName//​ - the first entity (for player collisions, this is always the player)\\ //​asParentName//​ - the first entity (for player collisions, this is always the player)\\
Line 152: Line 235:
  
 Callback syntax:\\ Callback syntax:\\
-**FunctionName(const tString &in asParent, const tString &in asChild, int alState)**\\ +**FunctionName(const tString &in asParent, const tString &in asChild, int alState)** \\ 
-//alState// - 1 = colliding, -1 = uncolliding,​ 0 = both.\\+//alState// - 1 = colliding, -1 = uncolliding,​ 0 = both.
  
-**Returns** whether the callback is repeated upon completetion. If true, callback can be called again. If false, callback is removed.\\+**Returns** ​a boolean of whether the callback is repeated upon completetion. If true, callback can be called again. If false, callback is removed.\\
 Abbreviation syntax for the callback function code snippet: **clbCollide** Abbreviation syntax for the callback function code snippet: **clbCollide**
 +<code =c++>
 +bool Entity_RemoveCollideCallback(const tString &in asParentName, ​ const tString &in asChildName);​
 +</​code>​
 +
 +Removes a callback for entity collisions. Wildcards %%*%% supported in names.
 +
 +//​asParentName//​ - the first entity (for player collisions, this is always player)\\
 +//​asChildName//​ - the second entity.
 +<code =c++>
 +bool Entity_GetCollide(const tString &in asEntityA, ​ const tString &in asEntityB);
 +</​code>​
 +
 +Check whether two entities are already colliding. Wildcards %%*%% are NOT supported.
 +
 +//​asEntityA//​ - the first entity.\\
 +//​asEntityB//​ - the second entity.
 +
 +Returns true if colliding, else false.
 +
 +<code =c++>​void Entity_SetCollideCharacter(const tString &in asEntityName, ​ bool abActive);
 +</​code>​
 +
 +Enable/​disable an entity'​s collision with a character for all bodies in the entity.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//​abActive//​ - true = collision on, false = collision off.
 +<code =c++>​void Entity_SetCollide(const tString &in asEntityName, ​ bool abActive);
 +</​code>​
 +
 +Enable/​disable an entity'​s collision for all bodies in the entity.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//​abActive//​ - true = collision on, false = collision off.
 +<code =c++>​void Entity_SetEffectsActive(const tString &in asEntityName, ​ bool abActive, ​ bool abFadeAndPlaySounds);​
 +</​code>​
 +
 +Enables/​disables whether an entity uses effects.
 +
 +//​asEntityName//​ - name of the entity/​prop. Wildcards %%*%% are supported.\\
 +//​abActive//​ - true = activates effects, false = deactivates effects.\\
 +//​abFadeAndPlaySounds//​ - if effects should fade in/out and play sounds.
 +<code =c++>​void Entity_SetReflectionVisibility(const tString &in asEntityName, ​ bool abVisibleInReflection, ​ bool abVisibleInWorld);​
 +</​code>​
 +
 +Sets whether an entity is drawn in reflections or not, and/or in the real world or not.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//​abVisibleInReflection//​ - whether the entity is drawn in reflections.\\
 +//​abVisibleInWorld//​ - whether the entity is drawn in the real world.
 +<code =c++>​void Entity_SetEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor);
 +</​code>​
 +
 +Sets the base color for the entity'​s effects.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//aColor// - the color all effects will be multiplied with.
 +<code =c++>​void Entity_FadeEffectBaseColor(const tString &in asEntityName,​ const cColor&​in aColor, ​ float afTime);
 +</​code>​
 +
 +Fades the base color for the entity'​s effects.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//aColor// - the color all effects will be faded to.\\
 +//afTime// - the time in seconds the fade takes to finish.
 +<code =c++>​void Entity_SetColorMul(const tString &in asEntityName, ​ const cColor&​in aColor);
 +</​code>​
 +
 +Sets the color multiplier of the entity.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//aColor// - the color to set the multiplier to.
 +<code =c++>​void Entity_AddForce(const tString &in asEntityName, ​ const cVector3f &in avForce, ​ bool abLocalSpace, ​ bool abOnlyMainBody);​
 +</​code>​
 +
 +Adds a push force to the entity.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//avForce// - the force to add.\\
 +//​abLocalSpace//​ - true = local force is added relative to the rotation of the entity, false = global force is added in a world space\\
 +//​abOnlyMainBody//​ - true = force is added only to the main body of the entity, false = force is added to all bodies of the entity.
 +<code =c++>​void Entity_AddForceFromEntity(const tString &in asEntityName, ​ const tString &in asForceEntityName, ​ float afForce, ​ bool abOnlyMainBody);​
 +</​code>​
 +
 +Adds a push force to the entity away from another entity.
 +
 +//​asEntityName//​ - the name of the entity. Wildcards %%*%% are supported.\\
 +//​asForceEntityName//​ - the name of the entity to push away from.\\
 +//afForce// - magnitude of the force. Negative values attract the entity to the force entity.
 +==== FogArea ====
 +
 +<code =c++>​void FogArea_SetVisible(const tString &in asFogAreaName, ​ bool abActive);
 +</​code>​
 +
 +Sets whether a fog area is visible or not.
 +
 +//​asFogAreaName//​ - name of the fog area.\\
 +//​abActive//​ - true = active, false = inactive.
 +==== Grab ====
 +
 +<code =c++>​void Grab_SetForceMul(const tString&​ in asName, ​ float afForceMul);​
 +</​code>​
 +
 +Sets the force multiplier of a grab prop.
 +
 +//asName// - name of the grab prop.\\
 +//​afForceMul//​ - the new multiplier.
 +==== IrradianceSet ====
 +
 +<code =c++>​void IrradianceSet_FadeIn(const tString &in asSet, ​ float afTime);
 +</​code>​
 +
 +Fades in the specified set on all probes belonging to it. This also fades out the currently active set for these probes.
 +
 +//asSet// - the set to fade in.\\
 +//afTime// - how long it should take until the fade is done.
 +==== Joint ====
 +
 +<code =c++>
 +bool Joint_IsBroken(const tString &in asJointName);​
 +</​code>​
 +
 +Checks whether the specified joint is broken.
 +
 +//​asJointName//​ - the name of the joint.
 +==== Lamp ====
 +
 +<code =c++>​void Lamp_SetLit(const tString&​ in asName, ​ bool abLit, ​ bool abEffects);
 +</​code>​
 +
 +Sets the lit state of a lamp.
 +
 +//asName// - name of the lamp.\\
 +//abLit// - true = lamp is lit, false = lamp is unlit.\\
 +//​abEffects//​ - whether the change should use effects associated with it. If false, the change will not be apparent to the player.
 +==== LensFlare ====
 +
 +<code =c++>​void LensFlare_SetVisible(const tString &in asLensFlareName, ​ bool abVisible);
 +</​code>​
 +
 +Sets if a lens flare should be rendered or not.
 +
 +//​asLensFlareName//​ - name of lens flare. Wildcards %%*%% supported.\\
 +//​abVisible//​ - true = visible, false = invisible.
 +==== LevelDoor ====
 +
 +<code =c++>​void LevelDoor_SetLocked(const tString&​ in asName, ​ bool abState);
 +</​code>​
 +
 +Sets a LevelDoor to be locked or unlocked.
 +
 +//asName// - name of the level door.\\
 +//abState// - true = locked, false = unlocked.
 +==== Lever ====
 +
 +<code =c++>int Lever_GetState(const tString&​ in asName);
 +</​code>​
 +
 +Gets the state of a lever.
 +
 +//asName// - name of the lever.
 +
 +Returns -1 for minimum, 0 for middle, 1 for maximum state.
 +
 +==== Light ====
 +
 +<code =c++>​void Light_FadeTo(const tString &in asLightName, ​ const cColor &in acColor, ​ float afRadius, ​ float afTime);
 +</​code>​
 +
 +Fades one or more light objects to a specified color and radius.
 +
 +//​asLightName//​ - name of the light(s). Wildcards %%*%% supported.\\
 +//acColor// - the color to fade to.\\
 +//​afRadius//​ - the radius to fade to. If lower than 0, the current radius is used.\\
 +//afTime// - how long it should take until the fade is done.
 +==== Map ====
 +
 +<code =c++>
 +bool Map_GetParticleSystemArray(const tString &in asName, ​ array<​cParticleSystem@>​ &inout avOutParticles);​
 +</​code>​
 +
 +Creates an array of particle systems with a given name.
 +
 +//asName// - name of particle systems. Wildcards %%*%% supported.\\
 +//​avOutParticles//​ - reference to array that will be filled with particle systems.
 +==== Material ====
 +
 +<code =c++>​void Material_Preload(const tString &in asFile);
 +</​code>​
 +
 +Preloads a material
 +
 +//asFile// - the .mat material file to preload.
 +==== Meter ====
 +
 +<code =c++>​void Meter_SetState(const tString&​ in asName, ​ float afState, ​ bool abFadeToState = true);
 +</​code>​
 +
 +Sets the state of the needle object in a meter, which then makes the needle move to the specified state.
 +
 +//asName// - name of meter object.\\
 +//afState// - percentage of where the needle should be. 0-1 (minimum position - maximum position). //​abFadeToState//​ - if true, then the needle will fade to the state instead of skipping to it.
 +==== MoveObject ====
 +
 +<code =c++>​void MoveObject_SetState(const tString&​ in asName, ​ float afState);
 +</​code>​
 +
 +Sets the state of a move object. This makes it move to a certain position between its minimum and maximum position (or beyond if set to <0 or >1).
 +
 +//asName// - name of the move object.\\
 +//afState// - the state to set the move object to at speeds defined in the entity file.
 +==== MovingButton ====
 +
 +<code =c++>​void MovingButton_SetSwitchedOn(const tString&​ in asName, ​ bool abState, ​ bool abEffects);
 +</​code>​
 +
 +Switches a MovingButton on or off.
 +
 +//asName// - name of the button.\\
 +//abState// - true = on, false = off.\\
 +//​abEffects//​ - whether the change should use effects associated with it. If false, the player will not be apparent to the change.
 +==== ParticleSystem ====
 +
 +<code =c++>
 +cParticleSystem@ ParticleSystem_CreateAtEntity(const tString &in asPSName, ​ const tString &in asPSFile, ​ const tString &in asEntity, ​ bool abAttach);
 +</​code>​
 +
 +Create a particle system at an entity or area.
 +
 +//​asPSName//​ - name of the particle system to be created.\\
 +//​asPSFile//​ - the .ps file to create the particle system from.\\
 +//​asEntity//​ - the entity to create the particle system at. Can be "​Player"​.\\
 +//​abAttach//​ - whether the particle system should attach to the entity it is created at.
 +
 +Returns: The created particle system, or null if the function fails.
 +
 +==== PhysicsSlideDoor ====
 +
 +<code =c++>
 +bool PhysicsSlideDoor_GetClosed(const tString&​ in asName);
 +</​code>​
 +
 +Returns true if the door is closed, else false.
 +
 +//asName// - name of the door.
 +==== Prop ====
 +
 +<code =c++>​void Prop_SetHealth(const tString &in asPropName, ​ float afHealth);
 +</​code>​
 +
 +Sets the health of a prop. Can be used to destroy objects.
 +
 +//​asPropName//​ - name of the prop. Wildcards %%*%% supported.\\
 +//​afHealth//​ - the health to set.
 +==== Readable ====
 +
 +<code =c++>​void Readable_SetCloseCallback(const tString &in asName, ​ const tString &in asCallback);​
 +</​code>​
 +
 +Sets the close callback of a readable prop.
 +
 +//asName// - name of the readable prop.\\
 +//​asCallback//​ - name of the callback function.
 +
 +Callback syntax: **void Function(const tString &in asEntity)**
 +==== Slide ====
 +
 +<code =c++>​void Slide_SetSlideAmount(const tString&​ in asName, ​ float afAmount);
 +</​code>​
 +
 +Sets the slide amount of a Slide prop, 0 being its minimum position and 1 being its maximum.
 +
 +//asName// - name of the prop.\\
 +//​afAmount//​ - the slide amount.
 +==== SlideDoor ====
 +
 +<code =c++>​void SlideDoor_SetClosed(const tString&​ in asName, ​ bool abClosed, ​ bool abInstant = false);
 +</​code>​
 +
 +Sets the close state of a SlideDoor. Simplified version of SlideDoor_SetOpenAmount.
 +
 +//asName// - name of the door.\\
 +//​abClosed//​ - true = close, false = open.\\
 +//​abInstant//​ (optional) - whether the door should slide to the correct state or just have the new position set instantly.
 +==== SwingDoor ====
 +
 +<code =c++>​void SwingDoor_SetOpenAmount(const tString&​ in asName, ​ float afOpenAmount);​
 +</​code>​
 +
 +Sets a swing door to a specific open state instantly.
 +
 +//asName// - name of the prop. Wildcards %%*%% supported.\\
 +//​afOpenAmount//​ - 0 = closed, 1 = completely open. 0.5f = half state.
 +==== Terminal ====
 +
 +<code =c++>​void Terminal_SetAllowInteraction(const tString&​ in asName, ​ bool abX);
 +</​code>​
 +
 +Sets whether the terminal should allow interactions from the player.
 +
 +//asName// - name of the terminal. Wildcards %%*%% are supported.\\
 +//abX// - true = allowed, false = denied.
 +==== Tool ====
 +
 +<code =c++>​void Tool_SetAutoHideAfterPickup(const tString &in asName, ​ bool abX);
 +</​code>​
 +
 +Sets if a tool should be hidden automatically after getting picked up and being displayed for a brief moment.
 +
 +//asName// - name of the tool.\\
 +//abX// - true = hide automatically,​ false = do not hide.
 +==== Wheel ====
 +
 +<code =c++>int Wheel_GetState(const tString&​ in asName);
 +</​code>​
 +
 +Gets the state of a wheel.
 +
 +//asName// - name of the wheel.
 +
 +Returns -1 for minimum, 0 for middle, 1 for maximum state.
  
 ===== Helper Files ===== ===== Helper Files =====
Line 229: Line 632:
 //​asAgentName//​ - name of the entity to teleport.\\ //​asAgentName//​ - name of the entity to teleport.\\
 //​asTargetName//​ - name of the entity to teleport to. //​asTargetName//​ - name of the entity to teleport to.
 +<code =c++>​void BarkMachine_SetActive(const tString&​in asEntityName,​ bool abActive);
 +</​code>​
 +
 +Sets if the barkmachine is active (this will only affect random sounds)
 +
 +//​asEntityName//​ - name of the entity with the barkmachine.\\
 +//​abActive//​ - if active or not.
 +<code =c++>​void BarkMachine_PlayVoice(const tString&​in asEntityName,​ const tString&​in asSubject, int alPrio, float afMinDistance=-1,​ float afMaxDistance=-1,​ float afMaxPlayerListeningRange=-1);​
 +</​code>​
 +
 +Plays a voice from the barkmachine tied to the entity.
 +
 +//​asEntityName//​ - name of the entity with the barkmachine.\\
 +//​asSubject//​ - the name of the voice subject.\\
 +//alPrio// - the prio of the voice, if there is already one playing in the same scene prio must be higher for this to play.\\
 +//​afMinDistance//​ - The distance where volume starts getting quiet. If below 0, default is used.\\
 +//​afMaxDistance//​ - The maximum hearing range. If below 0, default is used.\\
 +//​afMaxPlayerListeningRange//​ - The maximum that subtitles are displayed. If below 0, default is used.
 +<code =c++>​void HeadTracker_SetActive(const tString&​in asEntityName,​ bool abX);
 +</​code>​
 +
 +Turns on and off head tracking.
 +
 +//​asEntityName//​ - name of the entity with the HeadTracker.\\
 +//abX// - if headtracking is enabled or not
 +<code =c++>
 +bool HeadTracker_IsActive(const tString&​in asEntityName);​
 +</​code>​
 +
 +If head tracking is active or not.
 +
 +//​asEntityName//​ - name of the entity with the HeadTracker.
 +<code =c++>​void HeadTracker_SetAngleOffset(const tString&​in asEntityName,​ float afX);
 +</​code>​
 +
 +Sets the offset of the headtracker angle. Useful if the character is not facing in the direction of the meshentity forward vector.
 +
 +//​asEntityName//​ - name of the entity with the HeadTracker.\\
 +//afX// - The angle offset, in degrees.
 +<code =c++>​void HeadTracker_SetTargetEntity(const tString&​in asEntityName,​ const tString&​in asTargetEntityName);​
 +</​code>​
 +
 +Sets the target of the head tracking.
 +
 +//​asEntityName//​ - name of the entity with the HeadTracker.\\
 +//​asTargetEntityName//​ - The target of the tracking.
 +<code =c++>​void NPC_SetVoiceName(const tString &in asNpcName, const tString &in asVoiceName);​
 +</​code>​
 +
 +Sets the voice name for an NPC. This also automatically sets the source of the voice as the npc.
 +
 +//​asNpcName//​ - name of the NPC.\\
 +//​asVoiceName//​ - name of the voice as defined in the voicehandler file.
 +<code =c++>
 +bool NPC_IsTalking(const tString &in asNpcName);
 +</​code>​
 +
 +Checks if the NPC is being talked to.
 +
 +//​asNpcName//​ - name of the NPC.
 +<code =c++>​void NPC_SetCanBeTalkedTo(const tString &in asNpcName, bool abX);
 +</​code>​
 +
 +Sets if the NPC can be talked to (interacted with)
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//abX// - if can be talked to.
 +<code =c++>​void NPC_SetMainAnimation(const tString &in asNpcName, const tString&​ in asAnim, bool abPlayTransition = true, const tString &in asCallbackFunc="",​ float afFadeTime=0.5,​ bool abGlobalSpace=false);​
 +</​code>​
 +
 +Sets if the NPC can be talked to (interacted with)
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//asAnim// - The name of the animation.\\
 +//​abPlayTransition//​ - If a transition animation should be played.\\
 +//​asCallbackFunc//​ - name of callback function. Only used if there is a transition animation.\\
 +//​afFadeTime//​ - time it takes to fade to the animation.\\
 +//​abGlobalSpace//​ - if the animation takes place in global space\\
 +**Callback syntax:** void Func(const tString &in asEntityName,​ const tString &in asAnimName)
 +<code =c++>​void NPC_PlayExtraAnimation(const tString &in asNpcName, const tString&​ in asAnim, float afFadeTime=0.3,​ const tString &in asCallbackFunc="",​ bool abGlobalSpace=false);​
 +</​code>​
 +
 +Plays an extra animation for the NPC. Will return to main animation (see NPC_SetMainAnimation) when done.
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//asAnim// - The name of the animation.\\
 +//​afFadeTime//​ - The time it takes to fade in the animation.\\
 +//​asCallbackFunc//​ - name of callback function.\\
 +**Callback syntax:** void Func(tString &in asEntityName,​ tString &in asAnimName)
 +<code =c++>​void NPC_StopAllAnimations(const tString &in asNpcName, float afFadeTime=0.0f);​
 +</​code>​
 +
 +Stops all animations for the NPC.
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//​afFadeTime//​ - The time it takes to fade out.
 +<code =c++>​void NPC_PlayEmotion(const tString &in asNpcName, const tString&​ in asEmotion, float afDuration, float afWeight = 1.0f, float afFadeTime = 0.25f);
 +</​code>​
 +
 +Stops all animations for the NPC.
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//​asEmotion//​ - name of the emotion, "​Smile/​Sad/​Happy/​Surprised/​Wink/​Wondering/​Angry/​Worried/​Scared"​\\
 +//​afDuration//​ - how long the emotion should be active\\
 +//​afWeight//​ - how strong the emotion should be\\
 +//​afFadeTime//​ - fade in and out time for the emotion
 +<code =c++>​void NPC_MoveToNode(const tString &in asNpcName, const tString&​ in asNodeName, const tString&​ in asCallbackFunc);​
 +</​code>​
 +
 +Moves the NPC to a path node.
 +
 +//​asNpcName//​ - name of the NPC. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//​asNodeName//​ - The name of the path node.\\
 +//​asCallbackFunc//​ - The name of callback called when end is reach.\\
 +**Callback syntax:** void Func(const tString&​ in asEntityName,​ bool abReachedEnd)
 +<code =c++>​void Critter_SetGroupEntity(const tString &in asCritter, const tString &in asGroupEntity);​
 +</​code>​
 +
 +Sets the entity the critter should flock around
 +
 +//​asCritter//​ - name of the Critter. Wildcard supported.\\
 +//​asGroupEntity//​ - The name of the group entity.
 +<code =c++>​void Critter_AddExtraEscapeEntity(const tString &in asCritter, const tString &in asEscapeEntity);​
 +</​code>​
 +
 +Adds an entity that the critter should try to avoid the same way it does with the player.
 +
 +//​asCritter//​ - name of the Critter. Wildcard (<​nowiki>​*</​nowiki>​) supported.\\
 +//​asEscapeEntity//​ - The name of the entity to escape from.
  
hpl3/community/scripting/script_functions.1445865424.txt.gz · Last modified: 2015/10/26 13:17 by mudbill