Advertisement
Mudbill

Amnesia Crowbar-Door Script

Jan 12th, 2013
1,638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. void OnStart()
  2. {
  3. AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);
  4. AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
  5. }
  6.  
  7. void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
  8. {
  9. RemoveItem(asItem);
  10. PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
  11. AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
  12. }
  13.  
  14. void TimerPlaceCrowbar(string &in asTimer)
  15. {
  16. SetEntityActive("Joint", true);
  17. PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
  18. }
  19.  
  20. void BreakDoor(string &in asParent, string &in asChild, int alState)
  21. {
  22. SetEntityActive("Joint", false);
  23. SetEntityActive("Broken", true);
  24.  
  25. SetSwingDoorLocked("Door", false, false);
  26. SetSwingDoorClosed("Door", false, false);
  27. SetSwingDoorDisableAutoClose("Door", true);
  28.  
  29. AddPropImpulse("Door", 0, 0, 3, "world");
  30.  
  31. CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
  32. PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
  33.  
  34. GiveSanityBoostSmall();
  35.  
  36. PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
  37.  
  38. AddTimer("", 0.1, "TimerPushDoor");
  39. }
  40.  
  41. void TimerPushDoor(string &in asTimer)
  42. {
  43. AddPropImpulse("Door", -4, 2, 1, "world");
  44. AddTimer("", 1.1, "TimerDoorCanClose");
  45. }
  46.  
  47. void TimerDoorCanClose(string &in asTimer)
  48. {
  49. SetSwingDoorDisableAutoClose("Door", false);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement