Advertisement
Baoulettes

Overwatch - respawn while keeping position

Nov 3rd, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. variables {
  2. global:
  3. 7: Texts
  4. 15: Seeking_Phase
  5. 26: Settings_General
  6.  
  7. player:
  8. 21: isReady
  9. 34: HeroChangePress
  10. 38: PlayerPositions
  11. }
  12.  
  13. subroutines {
  14. 8: ResetCharacterPressOverTime
  15. }
  16.  
  17. rule("Change Hero system - Seeker") {
  18. event {
  19. Ongoing - Each Player;
  20. Team 2;
  21. All;
  22. }
  23.  
  24. conditions {
  25. Is Alive(Event Player) == True;
  26. Is Button Held(Event Player, Button(Reload)) == True;
  27. }
  28.  
  29. actions {
  30. "isReady is used to check if it need respawn or not so we set it back to 0 each press. (fail check)"
  31. Event Player.isReady = 0;
  32.  
  33. "HeroChangePress is variable to tell the number of press a player did."
  34. Event Player.HeroChangePress += 1;
  35.  
  36. "Hero we check if our Press count is lower than setting \"Number of press require to change hero.\""
  37. If(Round To Integer(Event Player.HeroChangePress, Up) < Global.Settings_General[6]);
  38.  
  39. "Since that lower we print a tiny message on player screen to tell the count left before being force to change hero."
  40. Small Message(Event Player, Custom String("{2} {0} {1}", Global.Texts[44], Global.Texts[36],
  41.  
  42. "Now we temporary edit what the Settings will return for the next if."
  43. Global.Settings_General[6] - Round To Integer(Event Player.HeroChangePress, Up)));
  44.  
  45. "This subroutine is the pretty self explaining with name, it reset HeroChangePress back to 0 over time."
  46. Call Subroutine(ResetCharacterPressOverTime);
  47. End;
  48.  
  49. "Now we check if our number of press is same or higher that the settings \"Number of press require to change hero.\""
  50. If(Round To Integer(Event Player.HeroChangePress, Up) >= Global.Settings_General[6]);
  51.  
  52. "Now we save current positon of the Hero before puting him in spawn (that how the game does it.)"
  53. Event Player.PlayerPositions[0] = Position Of(Event Player);
  54.  
  55. "Now we save current eye positon of the Hero before puting him in spawn (that how the game does it, it will be used in the futur to reset back the camera where it was.)"
  56. Event Player.PlayerPositions[1] = Eye Position(Event Player);
  57.  
  58. "We forbid the currently selected hero so the game force the player to change hero."
  59. Set Player Allowed Heroes(Event Player, Remove From Array(Allowed Heroes(Event Player), Hero Of(Event Player)));
  60.  
  61. "Now we reset available hero following Rules, meaning allowing back our previously forbidden hero."
  62. Reset Player Hero Availability(Event Player);
  63.  
  64. "Now we wait for the player to select an hero and actually spawn."
  65. Wait Until(Has Spawned(Event Player), 99999);
  66.  
  67. "A little Delay for user with low end pc or switch to actually load fine."
  68. Wait(0.500, Ignore Condition);
  69.  
  70. "We reset our number of press."
  71. Event Player.HeroChangePress = 0;
  72.  
  73. "Settings_General[5] is the workshop settings "retain hero position on hero change feature (not spawn press H one !)"
  74. If(Global.Settings_General[5] == True);
  75.  
  76. "now we set ready as 7 to be eligible to another rule"
  77. Event Player.isReady = 7;
  78.  
  79. End;
  80. End;
  81. Wait(0.250, Ignore Condition);
  82. }
  83. }
  84.  
  85. rule("Change Hero system - Hider") {
  86. event {
  87. Ongoing - Each Player;
  88. Team 1;
  89. All;
  90. }
  91.  
  92. conditions {
  93. Is Alive(Event Player) == True;
  94. Is Button Held(Event Player, Button(Primary Fire)) == True;
  95. Global.Seeking_Phase == False;
  96. }
  97.  
  98. actions {
  99. "For variable comments check Seeker system, here only the method of press is different something different will be done in the futur to merge them."
  100. Event Player.HeroChangePress += 1;
  101. Event Player.isReady = 1;
  102. If(Round To Integer(Event Player.HeroChangePress, Up) < Global.Settings_General[6]);
  103. Small Message(Event Player, Custom String("{2} {0} {1}", Global.Texts[44], Global.Texts[36],
  104. Global.Settings_General[6] - Round To Integer(Event Player.HeroChangePress, Up)));
  105. Call Subroutine(ResetCharacterPressOverTime);
  106. End;
  107. If(Round To Integer(Event Player.HeroChangePress, Up) >= Global.Settings_General[6]);
  108. Event Player.PlayerPositions[0] = Position Of(Event Player);
  109. Event Player.PlayerPositions[1] = Eye Position(Event Player);
  110. Set Player Allowed Heroes(Event Player, Remove From Array(Allowed Heroes(Event Player), Hero Of(Event Player)));
  111. Reset Player Hero Availability(Event Player);
  112. Wait(Has Spawned(Event Player), Ignore Condition);
  113. Wait(0.500, Ignore Condition);
  114. If(Global.Settings_General[5] == True);
  115. Event Player.isReady = 7;
  116. End;
  117. Event Player.HeroChangePress = 0;
  118. End;
  119. Wait(0.250, Ignore Condition);
  120. }
  121. }
  122.  
  123. rule("Change Hero system - Teleport Player back") {
  124. event
  125. {
  126. Ongoing - Each Player;
  127. All;
  128. All;
  129. }
  130.  
  131. conditions {
  132. Is Alive(Event Player) == True;
  133. Has Spawned(Event Player) == True;
  134. "Here you variable that is set to 7 once we reach proper press count and feature turned On"
  135. Event Player.isReady == 7;
  136. }
  137.  
  138. actions {
  139. "Here we set back the number of time player press to 0 to reset the system"
  140. Event Player.HeroChangePress = 0;
  141. "We teleport back our player to previously saved position"
  142. Teleport(Event Player, Event Player.PlayerPositions[0]);
  143. "Team 1 = Hider"
  144. If(Team Of(Event Player) == Team 1);
  145. "We remove Knocked down status for Hider that fake-death"
  146. Clear Status(Event Player, Knocked Down);
  147. "We now remove 3rd person camera from Hider"
  148. Stop Camera(Event Player);
  149. End;
  150. Event Player.isReady = 1;
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement