TechOFreak

Episode 25 Functions

Jan 8th, 2021
1,082
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. //From my Amnesia Rebirth Tutorial Series
  2. //Episode 25 Keys! Unlocking Doors!
  3. //https://www.youtube.com/playlist?list=PL4KkjlmOwLwwMVqedCNpi6caUxhgyf8Qr
  4. //-----------------------------------------------------------
  5.  
  6. ////////////////////////////
  7. //Single Door
  8. ////////////////////////////
  9.  
  10. bool CanUse_StorageKey(const tString &in asItemType, const tString &in asItemID, const tString &in asPickedEntity){
  11.     return asPickedEntity == "door_1";
  12. }
  13.  
  14. bool OnUse_StorageKey(const tString &in asItemType, const tString &in asItemID, const tString &in asTargetEntity, const tString &in asItemEntity, float afTimeElapsed, float afTimeStep){
  15.     SwingDoor_SetLocked("door_1", false, true);
  16.     Sound_CreateAtEntity("","level_entity_shared/doors/relic_door/relic_door_unlock","door_1",0,true);
  17.     Item_RemoveFromInventory(ItemType_GetFirstInInventory("StorageKey"));
  18.     return false;
  19. }
  20.  
  21. ////////////////////////////
  22. //Multiple Doors
  23. ////////////////////////////
  24.  
  25. bool CanUse_StorageKey(const tString& in asItemType, const tString& in asItemID, const tString& in asPickedEntity){
  26.     return asPickedEntity == "door_1" || asPickedEntity == "door_2";
  27. }
  28.  
  29. bool OnUse_StorageKey(const tString& in asItemType, const tString& in asItemID, const tString& in asTargetEntity, const tString& in asItemEntity, float afTimeElapsed, float afTimeStep){
  30.     if(asTargetEntity == "door_1"){
  31.         SwingDoor_SetLocked(asTargetEntity, false, true);
  32.         Sound_CreateAtEntity("", "level_entity_shared/doors/relic_door/relic_door_unlock", asTargetEntity, 0, true);
  33.         Item_RemoveFromInventory(ItemType_GetFirstInInventory(asItemType));
  34.     }else if(asTargetEntity == "door_2"){
  35.         SwingDoor_SetLocked(asTargetEntity, false, true);
  36.         Sound_CreateAtEntity("", "level_entity_shared/doors/relic_door/relic_door_unlock", asTargetEntity, 0, true);
  37.     }
  38.     return false;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment