Difference between revisions of "HPL3/Amnesia: Rebirth/Scripting/Agents/Ghouls"
m (formatting) |
(→Modes vs Commands: clarified command usage.) |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | + | {{ConstructionNotice| Basic overview of agent + improve page readability}} | |
− | {{ConstructionNotice| Basic overview of agent}} | ||
= Basic Overview = | = Basic Overview = | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Modes vs Commands == | == Modes vs Commands == | ||
Line 20: | Line 8: | ||
Each mode contains a subset of behaviors. They define what the 'default' action for the agent should be and can be used to give different agents of the same type unique behaviors. | Each mode contains a subset of behaviors. They define what the 'default' action for the agent should be and can be used to give different agents of the same type unique behaviors. | ||
− | A command is an order issued to the agent independent of the current mode. They can be used to override the agents current action. | + | A command is an order issued to the agent independent of the current mode. They can be used to override the agents current action. The agent will resume any mode specific behavior after completing the command. |
− | Unlike previous HPL titles, agents should only be | + | Unlike previous HPL titles, agents should only be controlled through modes and commands, NOT through changing the agent state. |
== General Functions == | == General Functions == | ||
Line 34: | Line 22: | ||
{{CodeDocDetailParam|abForce|bool|If true the ghoul will switch the behavior instantly regardless of state, otherwise it will do so more naturally on the next best opportunity.}} | {{CodeDocDetailParam|abForce|bool|If true the ghoul will switch the behavior instantly regardless of state, otherwise it will do so more naturally on the next best opportunity.}} | ||
{{CodeDocDetailReturn|void|}} | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | |||
+ | {{note| Desipite the following functions having the <code>Agent_</code> prefix, they appear to only work on Ghoul Agents.}} | ||
+ | |||
+ | |||
+ | {{CodeDocDetailTop|Agent_SetDeafened}} | ||
+ | <syntaxhighlight lang="c++">void Agent_SetDeafened(const tString &in asAgentName, bool abDeafened, float afRecovery)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Set the agents hearing mul.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abDeafened|bool|If agent should be deafened.}} | ||
+ | {{CodeDocDetailParam|afRecovery|float|Time until recovery (set to < 0 for indefinite).}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Agent_SetDistanceCallback}} | ||
+ | <syntaxhighlight lang="c++">void Agent_SetDistanceCallback(const tString &in asAgentName, const tString &in asFunction, float afDistance)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets a callback for when the agent enters or exits a set range around the player.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the funtion, syntax <code>void Func(int)</code>.}} | ||
+ | {{CodeDocDetailParam|afDistance|float|When the agent enters this range, the callback function will be called with 1, when it exits with -1.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | == Configuration == | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetSuperHunt}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetSuperHunt(const tString &in asAgentName, bool abActive)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul can enter super hunt mode.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abActive|bool|If the ghoul should be able to enter super hunt mode.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetSmellingActive}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetSmellingActive(const tString &in asAgentName, bool abActive)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul should sniff or not.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abActive|bool|Whether the ghoul should sniff or not.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetInstantKill}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetInstantKill(const tString &in asAgentName, bool abInstantKill)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul's attacks kill instantly or not.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abInstantKill|bool|Whether the ghoul kills instantly or not.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetAdaptiveHuntSpeed}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetAdaptiveHuntSpeed(const tString &in asAgentName, bool abX, float afTarDist)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul's hunt speed will be adapting to a certain distance from the player, and the player's speed. Overrides <code>Ghoul_SetAdjustHuntSpeed</code>.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|value}} | ||
+ | {{CodeDocDetailParam|afTarDist|float|Desired distance to keep.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetAdjustHuntSpeed}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetAdjustHuntSpeed(const tString &in asAgentName, bool abX, float afMul=0.8f)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul should slow down when hunting if the player isn't looking at it. Overridden by <code>Ghoul_SetAdaptiveHuntSpeed</code>.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|value}} | ||
+ | {{CodeDocDetailParam|afMul|float|?}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetUseVoice}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetUseVoice(const tString &in asAgentName, bool abX)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul should should use map specific voice files.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|value}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetHoleNetwork}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetHoleNetwork(const tString &in asAgentName, const tString &in asNetwork, const tString &in asPlayerPath, const tString &in asHoleConnections)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets the ghoul hole network that the ghoul can use.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asNetwork|[[../../tString|tString]]|The name of the group of ghoul holes the ghoul should move between, use wildcard *.}} | ||
+ | {{CodeDocDetailParam|asPlayerPath|[[../../tString|tString]]|The name of the group of nodes that represent the general path the player will take, used to determine if a hole is ahead or behind the player, use wildcard *.}} | ||
+ | {{CodeDocDetailParam|asHoleConnections|[[../../tString|tString]]|The name of a group of areas that represent the connections between holes, the ghoul will move along these areas and make noise, use wildcard *.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetAllowPlayerThrow}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetAllowPlayerThrow(const tString &in asAgentName, bool abX)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets wether the ghoul can throw the player away instead of hitting them.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|value}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CancelPlayerThrow}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CancelPlayerThrow(const tString &in asAgentName, bool abX)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Get throw damage, but skip animation (useful for custom throw event).}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|value}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCanAttack}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCanAttack(const tString &in asAgentName, bool abX)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Enables or disables the ghoul's attack.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abX|bool|If the ghoul can attack.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetPlayerThrowForcedDirection}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetPlayerThrowForcedDirection(const tString &in asAgentName, int alDir)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|?}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|alDir|int|Throw direction (-1=all, 0/1/7=forward, 2/3=left, 4=back, 5/6=right.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetVisibile}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetVisibile(const tString &in asAgentName, bool abVisibility)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|?}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abVisibility|bool|?}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCustomWalkAnim}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCustomWalkAnim(const tString &in asAgent, const tString &in asAnim)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|?}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asAnim|[[../../tString|tString]]|?}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_IsSuspicious}} | ||
+ | <syntaxhighlight lang="c++">bool Ghoul_IsSuspicious(const tString &in asAgentName)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Returns true if the ghoul is in a suspicious state.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailReturn|bool|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_IsAggressive}} | ||
+ | <syntaxhighlight lang="c++">bool Ghoul_IsAggressive(const tString &in asAgentName)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Returns true if the ghoul is in an aggressive state.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailReturn|bool|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | |||
+ | {{warning| It is unknown if the following functions are functional.}} | ||
+ | |||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_EatMeat}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_EatMeat(const tString &in asAgentName, const tString &in asMeatEntity)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Puts a ghoul in the EatMeat state and destroys the specified meat.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asMeatEntity|[[../../tString|tString]]|Name of the meat to be destroyed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCanBeAttracted}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCanBeAttracted(const tString &in asAgentName, bool abCanBeAttracted)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets whether the ghoul can be attracted.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abCanBeAttracted|bool|Whether the ghoul can be attracted or not.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CanBeAttracted}} | ||
+ | <syntaxhighlight lang="c++">bool Ghoul_CanBeAttracted(const tString &in asAgentName)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Returns true if ghoul meets requirements to be attracted by a lure.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailReturn|bool|}} | ||
{{CodeDocDetailBottom}} | {{CodeDocDetailBottom}} | ||
Line 41: | Line 222: | ||
This is the ghouls default mode. In this mode the ghoul will remain stationary when not reacting to the player. | This is the ghouls default mode. In this mode the ghoul will remain stationary when not reacting to the player. | ||
− | |||
− | |||
== eGhoulMode_Patrol == | == eGhoulMode_Patrol == | ||
A ghoul in patrol mode will move to specified patrol path nodes when not reacting to the player. | A ghoul in patrol mode will move to specified patrol path nodes when not reacting to the player. | ||
− | |||
− | |||
{{CodeDocDetailTop|Ghoul_ModePatrol_Setup}} | {{CodeDocDetailTop|Ghoul_ModePatrol_Setup}} | ||
Line 94: | Line 271: | ||
A ghoul in the random wander area will move to random nodes within a specified area when not reacting to the player. | A ghoul in the random wander area will move to random nodes within a specified area when not reacting to the player. | ||
− | |||
− | |||
{{CodeDocDetailTop|Ghoul_ModeRandomWanderArea_Setup}} | {{CodeDocDetailTop|Ghoul_ModeRandomWanderArea_Setup}} | ||
Line 112: | Line 287: | ||
TODO - Guard mode overview | TODO - Guard mode overview | ||
TODO - Guard vs Enthralled | TODO - Guard vs Enthralled | ||
− | |||
− | |||
{{CodeDocDetailTop|Ghoul_ModeGuard_Setup}} | {{CodeDocDetailTop|Ghoul_ModeGuard_Setup}} | ||
Line 133: | Line 306: | ||
A ghoul in enthralled mode will move to a specified location when not reacting to the player. | A ghoul in enthralled mode will move to a specified location when not reacting to the player. | ||
− | |||
− | |||
{{CodeDocDetailTop|Ghoul_ModeEnthralled_Setup}} | {{CodeDocDetailTop|Ghoul_ModeEnthralled_Setup}} | ||
Line 150: | Line 321: | ||
A ghoul in hunt mode will be always hunting the player. | A ghoul in hunt mode will be always hunting the player. | ||
− | |||
− | |||
== eGhoulMode_StalkThroughHoles == | == eGhoulMode_StalkThroughHoles == | ||
Mode behavior and functionality currently unknown. | Mode behavior and functionality currently unknown. | ||
− | |||
− | |||
{{CodeDocDetailTop|Ghoul_ModeStalkThroughHoles_Setup}} | {{CodeDocDetailTop|Ghoul_ModeStalkThroughHoles_Setup}} | ||
Line 171: | Line 338: | ||
{{CodeDocDetailBottom}} | {{CodeDocDetailBottom}} | ||
− | = | + | = Commands = |
− | |||
− | |||
− | |||
− | |||
== General == | == General == | ||
Line 188: | Line 351: | ||
{{CodeDocDetailBottom}} | {{CodeDocDetailBottom}} | ||
− | == | + | {{CodeDocDetailTop|Ghoul_CommandRetreat_Execute}} |
+ | <syntaxhighlight lang="c++">void Ghoul_CommandRetreat_Execute(const tString &in asAgentName, bool abForce = false, bool abAutomaticRetreat = true, const cVector3f &in avPos = cVector3f_Zero, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the retreat command.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|abAutomaticRetreat|bool|If the ghoul should pick an appropriate node to retreat to, otherwise a position needs to be provided with the <code>avPos</code> argument.}} | ||
+ | {{CodeDocDetailParam|avPos|[[../../cVector3f|cVector3f]]|The position the ghoul should retreat to, will only be considered when <code>abAutomaticRetreat</code> is true.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CommandUseDoor_Execute}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CommandUseDoor_Execute(const tString &in asAgentName, const tString &in asDoorName, bool abBreak = false, bool abForce = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the command that makes the ghoul move to and interact with a door.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asDoorName|[[../../tString|tString]]|The name of the door the ghoul should interact with.}} | ||
+ | {{CodeDocDetailParam|abBreak|bool|If the ghoul should break the door, otherwise it will attempt to open it.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|aSpeed|eGhoulSpeed|The speed with which the ghoul will move.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CommandSmell_Execute}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CommandSmell_Execute(const tString &in asAgentName, bool abForce = false, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the smell command.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CommandWakeUp_Execute}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CommandWakeUp_Execute(const tString &in asAgentName, const tString &in asWakeUpAnim, bool abForce = false, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the wake up command.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asWakeUpAnim|[[../../tString|tString]]|Name of the wake up animation.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | == Patrol Commands == | ||
{{CodeDocDetailTop|Ghoul_CommandPatrol_AddNode}} | {{CodeDocDetailTop|Ghoul_CommandPatrol_AddNode}} | ||
Line 243: | Line 452: | ||
{{CodeDocDetailBottom}} | {{CodeDocDetailBottom}} | ||
− | == | + | {{CodeDocDetailTop|Ghoul_CommandSmellPatrol_Execute}} |
+ | <syntaxhighlight lang="c++">void Ghoul_CommandSmellPatrol_Execute(const tString &in asAgentName, bool abForce = false, int alLoopCount = 1, bool abRandom = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the smell patrol command, where the ghoul will patrol while sniffing. If the ghoul actually catches the player's scent and begins tracking them down, the smell patrol becomes a normal patrol.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|alLoopCount|int|How many times the ghoul should patrol the node set, only positive values are allowed, use the patrol mode for infinite loops.}} | ||
+ | {{CodeDocDetailParam|abRandom|bool|If nodes should be picked randomly, otherwise they will be picked in the order added.}} | ||
+ | {{CodeDocDetailParam|aSpeed|eGhoulSpeed|The speed with which the ghoul will move.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | == Ghoul Hole Commands == | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CommandGoToSpecificHole_Execute}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CommandGoToSpecificHole_Execute(const tString &in asAgentName, const tString &in asHole, bool abForce = false, bool abInstant = false, bool abDeactivateAfter = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the command that makes the ghoul move to and enter a specified ghoul hole.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asHole|[[../../tString|tString]]|The name of the hole the ghoul should retreat to.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|abInstant|bool|If the ghoul should start hiding in a hole instantly, being teleported then and hidden.}} | ||
+ | {{CodeDocDetailParam|abDeactivateAfter|bool|?}} | ||
+ | {{CodeDocDetailParam|aSpeed|eGhoulSpeed|The speed with which the ghoul will move.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_CommandGoToHole_Execute}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_CommandGoToHole_Execute(const tString &in asAgentName, const cVector3f &in avPos, bool abForce = false, bool abInstant = false, bool abDeactivateAfter = false, | ||
+ | bool abClosest = true, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, float afMinRadius = -1.0f, float afMaxRadius = -1.0f, bool abOnlyFree = false, | ||
+ | bool abOnlyOutOfPlayerSight = false, const tString &in asCompletedCallback = "")</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Executes the command that makes the ghoul move to and enter a hole based on certain parameters.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|avPos|[[../../cVector3f|cVector3f]]|The position to which distances will be calculated.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|abInstant|bool|If the ghoul should start hiding in a hole instantly, being teleported then and hidden.}} | ||
+ | {{CodeDocDetailParam|abDeactivateAfter|bool|?}} | ||
+ | {{CodeDocDetailParam|abClosest|bool|If the closest node to <code>avPos</code> should be picked, otherwise a random node that fits the other parameters will be chosen.}} | ||
+ | {{CodeDocDetailParam|aSpeed|eGhoulSpeed|The speed with which the ghoul will move.}} | ||
+ | {{CodeDocDetailParam|afMinRadius|float|The minimum distance from avPos that a ghoul hole can be at.}} | ||
+ | {{CodeDocDetailParam|afMaxRadius|float|The maximum distance from avPos that a ghoul hole can be at.}} | ||
+ | {{CodeDocDetailParam|abOnlyFree|bool|If only free holes (that aren't occupied by other ghouls) should be chosen.}} | ||
+ | {{CodeDocDetailParam|abOnlyOutOfPlayerSight|bool|If only holes that are out of the player's sight should be chosen.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
− | = | + | {{CodeDocDetailTop|Ghoul_CommandEmergeFromHole_Execute}} |
− | {{ | + | <syntaxhighlight lang="c++">void Ghoul_CommandEmergeFromHole_Execute(const tString &in asAgentName, const tString &in asHole, bool abForce = false, const tString &in asCompletedCallback = "", const tString &in asCustomAnim = "", const tString &in asCustomAnimEntity = "")</syntaxhighlight> |
+ | {{CodeDocDetailBody|Executes the command that makes the ghoul emerge from a hole. If the ghoul is not hiding, it will be teleported to the hole and play the emerge animation.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asHole|[[../../tString|tString]]|The name of the hole the ghoul should retreat to.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailParam|asCustomAnim|[[../../tString|tString]]|Name of the custom animation.}} | ||
+ | {{CodeDocDetailParam|asCustomAnimEntity|[[../../tString|tString]]|Entity to play the custom anim at.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
− | + | == Threaten Player Commands == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {{CodeDocDetailTop|Ghoul_CommandThreatenPlayer_Execute}} | |
− | {{ | + | <syntaxhighlight lang="c++">void Ghoul_CommandThreatenPlayer_Execute(const tString &in asAgentName, int afAggroLevel = 1, bool abThreatenGestures = true, bool abAdjustSpeed = false, float afMinSpeedDist = -1, float afMaxSpeedDist = -1, bool abForce = false, const tString &in asCompletedCallback = "")</syntaxhighlight> |
− | {{ | + | {{CodeDocDetailBody|?}} |
− | {{ | + | {{CodeDocDetailParamStart}} |
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|afAggroLevel|float|The level of aggressiveness, values 0-7 with 0 being stopped, and 7 being the most aggressive.}} | ||
+ | {{CodeDocDetailParam|abThreatenGestures|bool|If the ghoul should use threatening gestures.}} | ||
+ | {{CodeDocDetailParam|abAdjustSpeed|bool|If the ghoul should slow down as it appraoches the player.}} | ||
+ | {{CodeDocDetailParam|afMinSpeedDist|float|When using <code>abAdjustSpeed</code>, the distance at which the ghoul will reach minimum speed, -1 is default,}} | ||
+ | {{CodeDocDetailParam|afMaxSpeedDist|float|When using <code>abAdjustSpeed</code>, the distance at which the ghoul will have maximum speed, -1 is default.}} | ||
+ | {{CodeDocDetailParam|abForce|bool|If the command should be executed immediately, or at a more appropriate time.}} | ||
+ | {{CodeDocDetailParam|asCompletedCallback|[[../../tString|tString]]|The function that will be called after the command is completed, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
− | + | {{CodeDocDetailTop|Ghoul_CommandThreatenPlayer_SetAggressiveness}} | |
− | {{CodeDocDetailTop| | + | <syntaxhighlight lang="c++">void Ghoul_CommandThreatenPlayer_SetAggressiveness(const tString &in asAgentName, int afAggroLevel)</syntaxhighlight> |
− | <syntaxhighlight lang="c++">void | + | {{CodeDocDetailBody|?}} |
− | |||
− | {{CodeDocDetailBody| | ||
{{CodeDocDetailParamStart}} | {{CodeDocDetailParamStart}} | ||
− | {{CodeDocDetailParam| | + | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} |
− | {{CodeDocDetailParam| | + | {{CodeDocDetailParam|afAggroLevel|float|The level of aggressiveness, values 0-7 with 0 being stopped, and 7 being the most aggressive.}} |
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | = Callbacks = | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_EmergeCompleted}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_EmergeCompleted(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Set a callback in the map to be called once the ghoul has emerged from hole.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func(const tString &in asGhoul, const tString &in asHole)</code>.}} | ||
+ | {{CodeDocDetailParam|abAutoRemove|bool|If the callback should automatically be removed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_EnterHideInHole}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_EnterHideInHole(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Set a callback in the map to be called when the ghoul starts to hide in a hole.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func(const tString &in asEntity, const tString &in asHoleName)</code>.}} | ||
+ | {{CodeDocDetailParam|abAutoRemove|bool|If the callback should automatically be removed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_EnterHunt}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_EnterHunt(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets the name of the callback called when entering hunt.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func()</code>.}} | ||
+ | {{CodeDocDetailParam|abAutoRemove|bool|If the callback should automatically be removed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_ThrowAnimationOver}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_ThrowAnimationOver(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Sets the name of the callback called after throwing the player.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func()</code>.}} | ||
+ | {{CodeDocDetailParam|abAutoRemove|bool|If the callback should automatically be removed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_EnterIdle}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_EnterIdle(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Adds a callback for when the ghoul enters the idle state.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func()</code>.}} | ||
+ | {{CodeDocDetailParam|abAutoRemove|bool|If the callback should automatically be removed.}} | ||
+ | {{CodeDocDetailReturn|void|}} | ||
+ | {{CodeDocDetailBottom}} | ||
+ | |||
+ | {{CodeDocDetailTop|Ghoul_SetCallback_Alerted}} | ||
+ | <syntaxhighlight lang="c++">void Ghoul_SetCallback_Alerted(const tString &in asAgentName, const tString &in asFunction)</syntaxhighlight> | ||
+ | {{CodeDocDetailBody|Adds a callback for when the ghoul is alerted.}} | ||
+ | {{CodeDocDetailParamStart}} | ||
+ | {{CodeDocDetailParam|asAgentName|[[../../tString|tString]]|Name of the agent.}} | ||
+ | {{CodeDocDetailParam|asFunction|[[../../tString|tString]]|Name of the function, syntax: <code>void Func(const tString &in asEntity)</code>.}} | ||
{{CodeDocDetailReturn|void|}} | {{CodeDocDetailReturn|void|}} | ||
{{CodeDocDetailBottom}} | {{CodeDocDetailBottom}} |
Latest revision as of 05:12, 16 November 2020
Contents
- 1 Basic Overview
- 1.1 Modes vs Commands
- 1.2 General Functions
- 1.3 Configuration
- 1.3.1 Ghoul_SetSuperHunt
- 1.3.2 Ghoul_SetSmellingActive
- 1.3.3 Ghoul_SetInstantKill
- 1.3.4 Ghoul_SetAdaptiveHuntSpeed
- 1.3.5 Ghoul_SetAdjustHuntSpeed
- 1.3.6 Ghoul_SetUseVoice
- 1.3.7 Ghoul_SetHoleNetwork
- 1.3.8 Ghoul_SetAllowPlayerThrow
- 1.3.9 Ghoul_CancelPlayerThrow
- 1.3.10 Ghoul_SetCanAttack
- 1.3.11 Ghoul_SetPlayerThrowForcedDirection
- 1.3.12 Ghoul_SetVisibile
- 1.3.13 Ghoul_SetCustomWalkAnim
- 1.3.14 Ghoul_IsSuspicious
- 1.3.15 Ghoul_IsAggressive
- 1.3.16 Ghoul_EatMeat
- 1.3.17 Ghoul_SetCanBeAttracted
- 1.3.18 Ghoul_CanBeAttracted
- 2 Modes
- 3 Commands
- 4 Callbacks
Basic Overview
Modes vs Commands
Each mode contains a subset of behaviors. They define what the 'default' action for the agent should be and can be used to give different agents of the same type unique behaviors.
A command is an order issued to the agent independent of the current mode. They can be used to override the agents current action. The agent will resume any mode specific behavior after completing the command.
Unlike previous HPL titles, agents should only be controlled through modes and commands, NOT through changing the agent state.
General Functions
Ghoul_Mode_Set
void Ghoul_Mode_Set(const tString &in asAgentName, eGhoulMode aMode, bool abForce = false)
Puts the ghoul into a mode, which determines its behavior when it's not reacting to the player's presence.
Parameters
- asAgentName (tString) — Name of the agent.
- aMode (tString) — Which mode to put the ghoul in.
- abForce (bool) — If true the ghoul will switch the behavior instantly regardless of state, otherwise it will do so more naturally on the next best opportunity.
Returns:
- void
![Note icon.png](/nsfr_img_auth.php/d/d5/Note_icon.png)
Agent_
prefix, they appear to only work on Ghoul Agents.
Agent_SetDeafened
void Agent_SetDeafened(const tString &in asAgentName, bool abDeafened, float afRecovery)
Set the agents hearing mul.
Parameters
- asAgentName (tString) — Name of the agent.
- abDeafened (bool) — If agent should be deafened.
- afRecovery (float) — Time until recovery (set to < 0 for indefinite).
Returns:
- void
Agent_SetDistanceCallback
void Agent_SetDistanceCallback(const tString &in asAgentName, const tString &in asFunction, float afDistance)
Sets a callback for when the agent enters or exits a set range around the player.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the funtion, syntax
void Func(int)
. - afDistance (float) — When the agent enters this range, the callback function will be called with 1, when it exits with -1.
Returns:
- void
Configuration
Ghoul_SetSuperHunt
void Ghoul_SetSuperHunt(const tString &in asAgentName, bool abActive)
Sets whether the ghoul can enter super hunt mode.
Parameters
- asAgentName (tString) — Name of the agent.
- abActive (bool) — If the ghoul should be able to enter super hunt mode.
Returns:
- void
Ghoul_SetSmellingActive
void Ghoul_SetSmellingActive(const tString &in asAgentName, bool abActive)
Sets whether the ghoul should sniff or not.
Parameters
- asAgentName (tString) — Name of the agent.
- abActive (bool) — Whether the ghoul should sniff or not.
Returns:
- void
Ghoul_SetInstantKill
void Ghoul_SetInstantKill(const tString &in asAgentName, bool abInstantKill)
Sets whether the ghoul's attacks kill instantly or not.
Parameters
- asAgentName (tString) — Name of the agent.
- abInstantKill (bool) — Whether the ghoul kills instantly or not.
Returns:
- void
Ghoul_SetAdaptiveHuntSpeed
void Ghoul_SetAdaptiveHuntSpeed(const tString &in asAgentName, bool abX, float afTarDist)
Sets whether the ghoul's hunt speed will be adapting to a certain distance from the player, and the player's speed. Overrides Ghoul_SetAdjustHuntSpeed
.
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — value
- afTarDist (float) — Desired distance to keep.
Returns:
- void
Ghoul_SetAdjustHuntSpeed
void Ghoul_SetAdjustHuntSpeed(const tString &in asAgentName, bool abX, float afMul=0.8f)
Sets whether the ghoul should slow down when hunting if the player isn't looking at it. Overridden by Ghoul_SetAdaptiveHuntSpeed
.
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — value
- afMul (float) — ?
Returns:
- void
Ghoul_SetUseVoice
void Ghoul_SetUseVoice(const tString &in asAgentName, bool abX)
Sets whether the ghoul should should use map specific voice files.
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — value
Returns:
- void
Ghoul_SetHoleNetwork
void Ghoul_SetHoleNetwork(const tString &in asAgentName, const tString &in asNetwork, const tString &in asPlayerPath, const tString &in asHoleConnections)
Sets the ghoul hole network that the ghoul can use.
Parameters
- asAgentName (tString) — Name of the agent.
- asNetwork (tString) — The name of the group of ghoul holes the ghoul should move between, use wildcard *.
- asPlayerPath (tString) — The name of the group of nodes that represent the general path the player will take, used to determine if a hole is ahead or behind the player, use wildcard *.
- asHoleConnections (tString) — The name of a group of areas that represent the connections between holes, the ghoul will move along these areas and make noise, use wildcard *.
Returns:
- void
Ghoul_SetAllowPlayerThrow
void Ghoul_SetAllowPlayerThrow(const tString &in asAgentName, bool abX)
Sets wether the ghoul can throw the player away instead of hitting them.
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — value
Returns:
- void
Ghoul_CancelPlayerThrow
void Ghoul_CancelPlayerThrow(const tString &in asAgentName, bool abX)
Get throw damage, but skip animation (useful for custom throw event).
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — value
Returns:
- void
Ghoul_SetCanAttack
void Ghoul_SetCanAttack(const tString &in asAgentName, bool abX)
Enables or disables the ghoul's attack.
Parameters
- asAgentName (tString) — Name of the agent.
- abX (bool) — If the ghoul can attack.
Returns:
- void
Ghoul_SetPlayerThrowForcedDirection
void Ghoul_SetPlayerThrowForcedDirection(const tString &in asAgentName, int alDir)
?
Parameters
- asAgentName (tString) — Name of the agent.
- alDir (int) —
Returns:
- void
Ghoul_SetVisibile
void Ghoul_SetVisibile(const tString &in asAgentName, bool abVisibility)
?
Parameters
- asAgentName (tString) — Name of the agent.
- abVisibility (bool) — ?
Returns:
- void
Ghoul_SetCustomWalkAnim
Ghoul_IsSuspicious
bool Ghoul_IsSuspicious(const tString &in asAgentName)
Returns true if the ghoul is in a suspicious state.
Parameters
- asAgentName (tString) — Name of the agent.
Returns:
- bool—
Ghoul_IsAggressive
bool Ghoul_IsAggressive(const tString &in asAgentName)
Returns true if the ghoul is in an aggressive state.
Parameters
- asAgentName (tString) — Name of the agent.
Returns:
- bool—
![Alert icon.png](/nsfr_img_auth.php/6/6d/Alert_icon.png)
Ghoul_EatMeat
Ghoul_SetCanBeAttracted
void Ghoul_SetCanBeAttracted(const tString &in asAgentName, bool abCanBeAttracted)
Sets whether the ghoul can be attracted.
Parameters
- asAgentName (tString) — Name of the agent.
- abCanBeAttracted (bool) — Whether the ghoul can be attracted or not.
Returns:
- void
Ghoul_CanBeAttracted
bool Ghoul_CanBeAttracted(const tString &in asAgentName)
Returns true if ghoul meets requirements to be attracted by a lure.
Parameters
- asAgentName (tString) — Name of the agent.
Returns:
- bool—
Modes
eGhoulMode_Idle
This is the ghouls default mode. In this mode the ghoul will remain stationary when not reacting to the player.
eGhoulMode_Patrol
A ghoul in patrol mode will move to specified patrol path nodes when not reacting to the player.
Ghoul_ModePatrol_Setup
void Ghoul_ModePatrol_Setup(const tString &in asAgentName, bool abRandom = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk)
Sets up the basic parameters for the ghoul's patrol mode.
Parameters
- asAgentName (tString) — Name of the agent.
- abRandom (bool) — If nodes should be picked randomly, otherwise they will be picked in the order added.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
Returns:
- void
Ghoul_ModePatrol_AddNode
void Ghoul_ModePatrol_AddNode(const tString &in asAgentName, const tString&in asNodeName, float afMinWaitTime = 0, float afMaxWaitTime= - 1,
const tString &in asAnimName = "", bool abLoopAnim = false)
Adds a node to the list of nodes to patrol in patrol mode.
Parameters
- asAgentName (tString) — Name of the agent.
- asNodeName (tString) — Name of the node.
- afMinWaitTime (float) — The minimum amount of time how long the ghoul should wait at this node.
- afMaxWaitTime (float) — The maximum amount of time how long the ghoul should wait at this node.
- asAnimName (tString) — Name of the animation that should play when the ghoul reaches this node.
- abLoopAnim (bool) — If the animation should loop.
Returns:
- void
Ghoul_ModePatrol_ClearNodes
void Ghoul_ModePatrol_ClearNodes(const tString &in asAgentName)
Removes all the nodes from the patrol mode list.
Parameters
- asAgentName (tString) — Name of the agent.
Returns:
- void
Ghoul_ModePatrol_SetSpeed
eGhoulMode_RandomWanderArea
A ghoul in the random wander area will move to random nodes within a specified area when not reacting to the player.
Ghoul_ModeRandomWanderArea_Setup
void Ghoul_ModeRandomWanderArea_Setup(const tString &in asAgentName, const cVector3f &in avAreaCenter, float afMinRadius, float afMaxRadius)
Makes the ghoul randomly wander inside a specified area.
Parameters
- asAgentName (tString) — Name of the agent.
- avAreaCenter (cVector3f) — The center of the area.
- afMinRadius (float) — The closest distance the nodes can be picked from.
- afMaxRadius (float) — The furthest distance the nodes can be picked from.
Returns:
- void
eGhoulMode_Guard
TODO - Guard mode overview TODO - Guard vs Enthralled
Ghoul_ModeGuard_Setup
void Ghoul_ModeGuard_Setup(const tString &in asAgentName, const tString &in asLookAtEntity, const tString &in asStandPosEntity, const tString &in asIdleAnim,
const tString &in asIdleSound, const tString &in asDisturbAnim, eGhoulSpeed aSpeedState = eGhoulSpeed_FastWalk)
Makes the ghoul enter the Guard state.
Parameters
- asAgentName (tString) — Name of the agent.
- asLookAtEntity (tString) — Name of the entity to be turned toward.
- asStandPosEntity (tString) — Name of the entity to stand at.
- asIdleAnim (tString) — Name of the idle animation.
- asIdleSound (tString) — Name of the sound entity placed in the map that will be played when guarding.
- asDisturbAnim (tString) — Name of the disturbed animation.
- aSpeedState (eGhoulSpeed) — Speed state of the ghoul when moving to the stand pos.
Returns:
- void
eGhoulMode_Enthralled
A ghoul in enthralled mode will move to a specified location when not reacting to the player.
Ghoul_ModeEnthralled_Setup
void Ghoul_ModeEnthralled_Setup(const tString &in asAgentName, const tString &in asLookAtEntity, const tString &in asStandPosEntity, const tString &in asIdleAnim)
Puts the ghoul in the enthralled state.
Parameters
- asAgentName (tString) — Name of the agent.
- asLookAtEntity (tString) — Name of the entity to be turned toward.
- asStandPosEntity (tString) — Name of the entity to stand at.
- asIdleAnim (tString) — Name of the idle animation.
Returns:
- void
eGhoulMode_Hunt
A ghoul in hunt mode will be always hunting the player.
eGhoulMode_StalkThroughHoles
Mode behavior and functionality currently unknown.
Ghoul_ModeStalkThroughHoles_Setup
void Ghoul_ModeStalkThroughHoles_Setup(const tString &in asAgentName, const tString &in asHoleNetwork, const tString &in asPlayerPath = "", const tString &in asHoleConnections = "", bool abHideUntilDisturbed = false)
Sets up the basic parameters for the StalkThroughHoles mode.
Parameters
- asAgentName (tString) — Name of the agent.
- asHoleNetwork (tString) — The name of the group of ghoul holes the ghoul should move between, use wildcard *.
- asPlayerPath (tString) — The name of the group of nodes that represent the general path the player will take, used to determine if a hole is ahead or behind the player, use wildcard *.
- asHoleConnections (tString) — The name of a group of areas that represent the connections between holes, the ghoul will move along these areas and make noise, use wildcard *.
- abHideUntilDisturbed (bool) — If the ghoul shouldn't emerge unless the player makes noise.
Returns:
- void
Commands
General
Ghoul_Command_Remove
void Ghoul_Command_Remove(const tString &in asAgentName, bool abForce = true)
Removes the current command that is set for the ghoul to execute.
Parameters
- asAgentName (tString) — Name of the agent.
- abForce (bool) — If the ghoul should abandond the command immediately, or wait to finish what it's doing.
Returns:
- void
Ghoul_CommandRetreat_Execute
void Ghoul_CommandRetreat_Execute(const tString &in asAgentName, bool abForce = false, bool abAutomaticRetreat = true, const cVector3f &in avPos = cVector3f_Zero, const tString &in asCompletedCallback = "")
Executes the retreat command.
Parameters
- asAgentName (tString) — Name of the agent.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- abAutomaticRetreat (bool) — If the ghoul should pick an appropriate node to retreat to, otherwise a position needs to be provided with the
avPos
argument. - avPos (cVector3f) — The position the ghoul should retreat to, will only be considered when
abAutomaticRetreat
is true. - asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandUseDoor_Execute
void Ghoul_CommandUseDoor_Execute(const tString &in asAgentName, const tString &in asDoorName, bool abBreak = false, bool abForce = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")
Executes the command that makes the ghoul move to and interact with a door.
Parameters
- asAgentName (tString) — Name of the agent.
- asDoorName (tString) — The name of the door the ghoul should interact with.
- abBreak (bool) — If the ghoul should break the door, otherwise it will attempt to open it.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandSmell_Execute
void Ghoul_CommandSmell_Execute(const tString &in asAgentName, bool abForce = false, const tString &in asCompletedCallback = "")
Executes the smell command.
Parameters
- asAgentName (tString) — Name of the agent.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandWakeUp_Execute
void Ghoul_CommandWakeUp_Execute(const tString &in asAgentName, const tString &in asWakeUpAnim, bool abForce = false, const tString &in asCompletedCallback = "")
Executes the wake up command.
Parameters
- asAgentName (tString) — Name of the agent.
- asWakeUpAnim (tString) — Name of the wake up animation.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Patrol Commands
Ghoul_CommandPatrol_AddNode
void Ghoul_CommandPatrol_AddNode(const tString &in asAgentName, const tString&in asNodeName, float afMinWaitTime = 0, float afMaxWaitTime= - 1,
const tString &in asAnimName = "", bool abLoopAnim = false)
Adds a node to the list of patrol nodes for a patrol command.
Parameters
- asAgentName (tString) — Name of the agent.
- asNodeName (tString) — Name of the node.
- afMinWaitTime (float) — The minimum amount of time how long the ghoul should wait at this node.
- afMaxWaitTime (float) — The maximum amount of time how long the ghoul should wait at this node.
- asAnimName (tString) — Name of the animation that should play when the ghoul reaches this node.
- abLoopAnim (bool) — If the animation should loop.
Returns:
- void
Ghoul_CommandPatrol_ClearNodes
void Ghoul_CommandPatrol_ClearNodes(const tString &in asAgentName)
Removes all the nodes from the patrol command list.
Parameters
- asAgentName (tString) — Name of the agent.
Returns:
- void
Ghoul_CommandPatrol_SetSpeed
void Ghoul_CommandPatrol_SetSpeed(const tString &in asAgentName, eGhoulSpeed aSpeed = eGhoulSpeed_Walk)
Sets the speed of movement for the current patrol command.
Parameters
- asAgentName (tString) — Name of the agent.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
Returns:
- void
Ghoul_CommandPatrol_SetSpeed
void Ghoul_CommandPatrol_SetSpeed(const tString &in asAgentName, eGhoulSpeed aSpeed = eGhoulSpeed_Walk)
Sets the speed of movement for the current patrol command.
Parameters
- asAgentName (tString) — Name of the agent.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
Returns:
- void
Ghoul_CommandPatrol_Execute
void Ghoul_CommandPatrol_Execute(const tString &in asAgentName, bool abForce = false, int alLoopCount = 1, bool abRandom = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")
Executes the patrol command.
Parameters
- asAgentName (tString) — Name of the agent.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- alLoopCount (int) — How many times the ghoul should patrol the node set, only positive values are allowed, use the patrol mode for infinite loops.
- abRandom (bool) — If nodes should be picked randomly, otherwise they will be picked in the order added.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandSmellPatrol_Execute
void Ghoul_CommandSmellPatrol_Execute(const tString &in asAgentName, bool abForce = false, int alLoopCount = 1, bool abRandom = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")
Executes the smell patrol command, where the ghoul will patrol while sniffing. If the ghoul actually catches the player's scent and begins tracking them down, the smell patrol becomes a normal patrol.
Parameters
- asAgentName (tString) — Name of the agent.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- alLoopCount (int) — How many times the ghoul should patrol the node set, only positive values are allowed, use the patrol mode for infinite loops.
- abRandom (bool) — If nodes should be picked randomly, otherwise they will be picked in the order added.
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul Hole Commands
Ghoul_CommandGoToSpecificHole_Execute
void Ghoul_CommandGoToSpecificHole_Execute(const tString &in asAgentName, const tString &in asHole, bool abForce = false, bool abInstant = false, bool abDeactivateAfter = false, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, const tString &in asCompletedCallback = "")
Executes the command that makes the ghoul move to and enter a specified ghoul hole.
Parameters
- asAgentName (tString) — Name of the agent.
- asHole (tString) — The name of the hole the ghoul should retreat to.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- abInstant (bool) — If the ghoul should start hiding in a hole instantly, being teleported then and hidden.
- abDeactivateAfter (bool) — ?
- aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandGoToHole_Execute
void Ghoul_CommandGoToHole_Execute(const tString &in asAgentName, const cVector3f &in avPos, bool abForce = false, bool abInstant = false, bool abDeactivateAfter = false,
bool abClosest = true, eGhoulSpeed aSpeed = eGhoulSpeed_Walk, float afMinRadius = -1.0f, float afMaxRadius = -1.0f, bool abOnlyFree = false,
bool abOnlyOutOfPlayerSight = false, const tString &in asCompletedCallback = "")
Executes the command that makes the ghoul move to and enter a hole based on certain parameters.
Parameters
- asAgentName (tString) — Name of the agent.
- avPos (cVector3f) — The position to which distances will be calculated.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- abInstant (bool) — If the ghoul should start hiding in a hole instantly, being teleported then and hidden.
- abDeactivateAfter (bool) — ?
- abClosest (bool) — If the closest node to
avPos
should be picked, otherwise a random node that fits the other parameters will be chosen. - aSpeed (eGhoulSpeed) — The speed with which the ghoul will move.
- afMinRadius (float) — The minimum distance from avPos that a ghoul hole can be at.
- afMaxRadius (float) — The maximum distance from avPos that a ghoul hole can be at.
- abOnlyFree (bool) — If only free holes (that aren't occupied by other ghouls) should be chosen.
- abOnlyOutOfPlayerSight (bool) — If only holes that are out of the player's sight should be chosen.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandEmergeFromHole_Execute
void Ghoul_CommandEmergeFromHole_Execute(const tString &in asAgentName, const tString &in asHole, bool abForce = false, const tString &in asCompletedCallback = "", const tString &in asCustomAnim = "", const tString &in asCustomAnimEntity = "")
Executes the command that makes the ghoul emerge from a hole. If the ghoul is not hiding, it will be teleported to the hole and play the emerge animation.
Parameters
- asAgentName (tString) — Name of the agent.
- asHole (tString) — The name of the hole the ghoul should retreat to.
- abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
. - asCustomAnim (tString) — Name of the custom animation.
- asCustomAnimEntity (tString) — Entity to play the custom anim at.
Returns:
- void
Threaten Player Commands
Ghoul_CommandThreatenPlayer_Execute
void Ghoul_CommandThreatenPlayer_Execute(const tString &in asAgentName, int afAggroLevel = 1, bool abThreatenGestures = true, bool abAdjustSpeed = false, float afMinSpeedDist = -1, float afMaxSpeedDist = -1, bool abForce = false, const tString &in asCompletedCallback = "")
?
Parameters
- asAgentName (tString) — Name of the agent.
- afAggroLevel (float) — The level of aggressiveness, values 0-7 with 0 being stopped, and 7 being the most aggressive.
- abThreatenGestures (bool) — If the ghoul should use threatening gestures.
- abAdjustSpeed (bool) — If the ghoul should slow down as it appraoches the player.
- afMinSpeedDist (float) — When using
abAdjustSpeed
, the distance at which the ghoul will reach minimum speed, -1 is default, - afMaxSpeedDist (float) — When using
abAdjustSpeed
, the distance at which the ghoul will have maximum speed, -1 is default. - abForce (bool) — If the command should be executed immediately, or at a more appropriate time.
- asCompletedCallback (tString) — The function that will be called after the command is completed, syntax:
void Func(const tString &in asEntity)
.
Returns:
- void
Ghoul_CommandThreatenPlayer_SetAggressiveness
void Ghoul_CommandThreatenPlayer_SetAggressiveness(const tString &in asAgentName, int afAggroLevel)
?
Parameters
- asAgentName (tString) — Name of the agent.
- afAggroLevel (float) — The level of aggressiveness, values 0-7 with 0 being stopped, and 7 being the most aggressive.
Returns:
- void
Callbacks
Ghoul_SetCallback_EmergeCompleted
void Ghoul_SetCallback_EmergeCompleted(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)
Set a callback in the map to be called once the ghoul has emerged from hole.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the function, syntax:
void Func(const tString &in asGhoul, const tString &in asHole)
. - abAutoRemove (bool) — If the callback should automatically be removed.
Returns:
- void
Ghoul_SetCallback_EnterHideInHole
void Ghoul_SetCallback_EnterHideInHole(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)
Set a callback in the map to be called when the ghoul starts to hide in a hole.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the function, syntax:
void Func(const tString &in asEntity, const tString &in asHoleName)
. - abAutoRemove (bool) — If the callback should automatically be removed.
Returns:
- void
Ghoul_SetCallback_EnterHunt
void Ghoul_SetCallback_EnterHunt(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)
Sets the name of the callback called when entering hunt.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the function, syntax:
void Func()
. - abAutoRemove (bool) — If the callback should automatically be removed.
Returns:
- void
Ghoul_SetCallback_ThrowAnimationOver
void Ghoul_SetCallback_ThrowAnimationOver(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)
Sets the name of the callback called after throwing the player.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the function, syntax:
void Func()
. - abAutoRemove (bool) — If the callback should automatically be removed.
Returns:
- void
Ghoul_SetCallback_EnterIdle
void Ghoul_SetCallback_EnterIdle(const tString &in asAgentName, const tString &in asFunction, bool abAutoRemove = false)
Adds a callback for when the ghoul enters the idle state.
Parameters
- asAgentName (tString) — Name of the agent.
- asFunction (tString) — Name of the function, syntax:
void Func()
. - abAutoRemove (bool) — If the callback should automatically be removed.
Returns:
- void