Advertisement
TechOFreak

The Wake Episode 9

Nov 20th, 2020
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.30 KB | None | 0 0
  1. #include "interfaces/Map_Interface.hps"
  2. #include "base/Inputhandler_Types.hps"
  3.  
  4. #include "helpers/helper_map.hps"
  5. #include "helpers/helper_props.hps"
  6. #include "helpers/helper_effects.hps"
  7. #include "helpers/helper_audio.hps"
  8. #include "helpers/helper_imgui.hps"
  9. #include "helpers/helper_sequences.hps"
  10. #include "helpers/helper_game.hps"
  11. #include "helpers/helper_modules.hps"
  12. #include "helpers/helper_ai.hps"
  13. #include "player.hps"
  14.  
  15. //From my Amnesia Rebirth Tutorial Series
  16. //Episode 9 Hints and Some Scripting
  17. //https://www.youtube.com/channel/UCHEzyhMw1EALBcJEKVJFmwA
  18. //-----------------------------------------------------------
  19.  
  20. class cScrMap : iScrMap
  21. {
  22.     void Setup()
  23.     {
  24.         PlayerBody_SetActive(true);
  25.         Player_SetCanRun(false);
  26.     }
  27.    
  28.     void OnStart()
  29.     {
  30.         if(cLux_ScriptDebugOn())
  31.         {
  32.         }
  33.     }
  34.  
  35.     void OnEnter()
  36.     {  
  37.         Game_AutoSave();
  38.     }
  39.  
  40.     void OnLeave()
  41.     {
  42.     }    
  43.    
  44.     void OnPlayerKilled(int alRecentDeaths, const tString&in asSource)
  45.     {
  46.     }
  47.    
  48.     bool OnDeath(const tString &in asSource)
  49.     {
  50.         cLux_AddTodoMessage("DEAD : SOURCE = " + asSource);
  51.        
  52.         if (asSource == "SomeReason")
  53.         {
  54.             Effect_Fade_Out(1.0f);
  55.             return true;
  56.         }
  57.         return false;
  58.     }
  59.  
  60.     bool OnRespawn(const tString &in asSource)
  61.     {      
  62.         return false;
  63.     }
  64.  
  65.     void OnAction(int alAction, bool abPressed)
  66.     {
  67.         if(abPressed==false) return;
  68.        
  69.         if(alAction == eAction_Test1)
  70.         {
  71.         }
  72.     }
  73.  
  74.     float DrawDebugOutput(cGuiSet @apSet,iFontData @apFont,float afY)
  75.     {
  76.         return afY;
  77.     }
  78.    
  79.     //My global variables
  80.     int storageDoorTimesInteracted = 0;
  81.    
  82.     //Our functions------------------------------------------------------------
  83.    
  84.     bool OnCollide_Player_Trigger_1(const tString &in asParent, const tString &in asChild, int alState)
  85.     {
  86.         //asParent is the name of the object that has the callback
  87.         //asChild is the name of the object that collided with the parent
  88.         if(alState == 1){
  89.             //This stuff will happen when the player enters the trigger area
  90.             cLux_AddDebugMessage("Enabling players running");
  91.             Player_SetCanRun(true);
  92.             return false;
  93.         }else{
  94.             //This stuff will happen when the player leaves trigger area
  95.             return false;
  96.         }
  97.     }
  98.    
  99.     void OnBreak_Bottle_1(const tString &in asEntity)
  100.     {
  101.         //asEntity is the name of the object that broke
  102.         cLux_AddDebugMessage("The bottle broke");
  103.     }
  104.    
  105.     void OnLookAt_Door_1(const tString &in asEntity, int alState)
  106.     {
  107.         //asEntity is the name of the object that is being looked at or not looked at
  108.         if(alState == 1){
  109.             //This stuff will happen when the player is looking at the door
  110.             cLux_AddDebugMessage("Player is looking at the door");
  111.         }else{
  112.             //This stuff will happen when the player is not looking at the door
  113.             cLux_AddDebugMessage("Player is not looking at the door");
  114.         }
  115.     }
  116.    
  117.     void OnInteract_Player_Door_1(const tString &in asEntity)
  118.     {
  119.         //asEntity is the name of the object that is being interacted with
  120.         cLux_AddDebugMessage("Player interacted with the door");
  121.         if(SwingDoor_GetLocked(asEntity)){
  122.             if(!Hint_IsGiven("Hints", "HintStorageDoor")){
  123.                 Hint_ShowHint("Hints", "HintStorageDoor", false, 1.5f, true);
  124.             }
  125.             if(storageDoorTimesInteracted > 4){
  126.                 storageDoorTimesInteracted = 0;
  127.                 Hint_RemoveFromGiven("Hints", "HintStorageDoor");
  128.             }else{
  129.                 storageDoorTimesInteracted += 1;
  130.             }
  131.         }
  132.     }
  133.    
  134.     void OnConnectionStateChange_Candle_1(const tString &in asEntity, int alState)
  135.     {
  136.         //asEntity is the name of the object that had its state changed
  137.         if(alState == 1){
  138.             //This stuff will happen when the candle is turned on
  139.             cLux_AddDebugMessage("Candle just turned on");
  140.         }
  141.         if(alState == 0){
  142.             //This stuff will happen when the candle is switching between on and off
  143.             cLux_AddDebugMessage("Candle just changed states");
  144.         }
  145.         if(alState == -1){
  146.             //This stuff will happen when the candle is turned off
  147.             cLux_AddDebugMessage("Candle just turned off");
  148.         }
  149.     }
  150.    
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement