TechOFreak

Episode 12 Functions

Nov 27th, 2020
633
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //From my Amnesia Rebirth Tutorial Series
  2. //Episode 12 Enemies Pt.2! Agent Functions!
  3. //https://www.youtube.com/playlist?list=PL4KkjlmOwLwwMVqedCNpi6caUxhgyf8Qr
  4. //-----------------------------------------------------------
  5.  
  6. //Force an agent to look at an entity instantly
  7. Agent_FaceEntity("ghoul_hallway", "player");
  8. //agentName (String)- name of agent(an enemy for example).
  9. //entityName (String)- name of entity as it appears in your level editor.
  10.  
  11. //Checks to see if the player was detected
  12. Agent_PlayerDetected("ghoul_hallway");
  13. //agentName (String)- name of agent(an enemy for example).
  14.  
  15. //Resets the detection state, agent will no longer know where the player is
  16. Agent_ResetPlayerDetectionState("ghoul_hallway");
  17. //agentName (String)- name of agent(an enemy for example).
  18.  
  19. //Reveals the player position to the agent
  20. Agent_RevealPlayerPosition("ghoul_hallway", false);
  21. //agentName (String)- name of agent(an enemy for example).
  22. //forceRedetect (bool)- should the agent redetect if player is already detected (will replay detection cutscenes).
  23.  
  24. //Will disable agent when outside of the specified range
  25. Agent_SetAutoDisableWhenOutOfSightActive("ghoul_hallway", true, 15.0f);
  26. //agentName (String)- name of agent(an enemy for example).
  27. //autoDisableActive (bool)- should auto disable be activated(true or false).
  28. //distance (float)- what distance should trigger the auto disable.
  29.  
  30. //Will prevent the agent from being able to see
  31. Agent_SetBlinded("ghoul_hallway", true, 5.0f);
  32. //agentName (String)- name of agent(an enemy for example).
  33. //blindActive (bool)- should the agent be blinded (true or false.
  34. //timeBlinded (float)- the amount of time this effect should last.
  35.  
  36. //Will prevent the agent from being able to hear
  37. Agent_SetDeafened("ghoul_hallway", true, 5.0f);
  38. //agentName (String)- name of agent(an enemy for example).
  39. //blindActive (bool)- should the agent be deafened (true or false).
  40. //timeDeafened (float)- the amount of time this effect should last, if <0 this effect is infinite until disabled.
  41.  
  42. //Will disable the agents senses meaning he will ignore the player entirely
  43. Agent_SetSensesActive("ghoul_hallway", false);
  44. //agentName (String)- name of agent(an enemy for example).
  45. //enabled (bool)- whether or not this effect should be enabled.
  46.  
  47. //If Agent_SetAutoDisableWhenOutOfSightActive is enabled this will set the function to run
  48. Agent_SetAutoDisableCallback("ghoul_hallway", "OnDespawn_GhoulHallway");
  49. //agentName (String)- name of agent(an enemy for example).
  50. //functionName (String)- name of the function you want to be called.
  51.  
  52. //Syntax for AutoDisableCallback
  53. void OnDespawn_GhoulHallway(const tString &in asEntity){
  54.     cLux_AddDebugMessage("Ghoul despawned");
  55. }
  56.  
  57. //Performs a callback when ghoul enters or exits radius of player
  58. Agent_SetDistanceCallback("ghoul_hallway", "OnDistance_Player_GhoulHallway", 15.0f);
  59. //agentName (String)- name of agent(an enemy for example).
  60. //functionName (String)- name of the function you want to be called.
  61. //distance (float)- what distance the callback should occur.
  62.  
  63. //Syntax for DistanceCallback
  64. void OnDistance_Player_GhoulHallway(int alState){
  65.     if(alState == 1){
  66.         //Agent entered range
  67.         cLux_AddDebugMessage("Ghoul entered range");
  68.     }else{
  69.         //Agent left range
  70.         cLux_AddDebugMessage("Ghoul left range");
  71.     }
  72. }
RAW Paste Data