Advertisement
Guest User

Untitled

a guest
Feb 9th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. script "fearMonitor" (int threshold, int maxFear, int fallOff, int checkRate)
  2. {
  3. int currentFear = 0;
  4. while(true)
  5. {
  6. //Get how afraid we are
  7. currentFear = CheckActorInventory(0, "FearToken");
  8.  
  9. //Make sure we haven't passed the maximum fear level
  10. if(currentFear > maxFear)
  11. {
  12. //Adjust the fear level to the max if we exceeed it
  13. TakeActorInventory(0, "FearToken", currentFear - maxFear);
  14. }
  15.  
  16. //If we're too afraid but not already running away, run
  17. if(currentFear >= threshold && !CheckActorInventory(0, "Afraid"))
  18. {
  19. GiveActorInventory(0, "Afraid", 1);
  20. SetActorState(0, "Fear");
  21. }
  22.  
  23. //Reduce our fear level by fallOff
  24. TakeActorInventory(0, "FearToken", fallOff);
  25.  
  26. delay(checkRate);
  27. }
  28. }
  29. ---------------------------------------
  30. Spawn:
  31. TNT1 A 0
  32. POSS A 1 ACS_NamedExecuteWithResult("fearMonitor", 2, 5, 1, 1)
  33. Look:
  34. POSS A 10 A_Look
  35. TNT1 A 0 A_TakeInventory("PossFireSignal", 0)
  36. POSS B 10 A_Look
  37. TNT1 A 0 A_TakeInventory("PossFireSignal", 0)
  38. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement