Advertisement
xeRicker

Untitled

Jul 15th, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. # UHC Minigame Skript
  2.  
  3. # Variables
  4. variables:
  5. {uhc::players::*} = 0
  6. {uhc::min_players} = 2
  7. {uhc::max_players} = 20
  8. {uhc::game_running} = false
  9. {uhc::countdown} = 30
  10.  
  11. # Join Command
  12. command /uhcjoin:
  13. trigger:
  14. if {uhc::game_running} is true:
  15. send "A game is already in progress. Please wait for the next round."
  16. else if size of {uhc::players::*} >= {uhc::max_players}:
  17. send "The game is full. Please wait for the next round."
  18. else:
  19. add player to {uhc::players::*}
  20. send "You have joined the UHC game. Waiting for more players..."
  21. broadcast "%player% has joined the UHC game. (%size of {uhc::players::*}%/%{uhc::max_players}%)"
  22. if size of {uhc::players::*} >= {uhc::min_players}:
  23. start game countdown
  24.  
  25. # Quit Command
  26. command /uhcquit:
  27. trigger:
  28. if {uhc::players::*} contains player:
  29. remove player from {uhc::players::*}
  30. send "You have left the UHC game."
  31. broadcast "%player% has left the UHC game. (%size of {uhc::players::*}%/%{uhc::max_players}%)"
  32. else:
  33. send "You are not in the UHC game."
  34.  
  35. # Game Countdown
  36. function start game countdown:
  37. set {uhc::countdown} to 30
  38. loop 30 times:
  39. broadcast "UHC game starting in %{uhc::countdown}% seconds!"
  40. remove 1 from {uhc::countdown}
  41. wait 1 second
  42. start game
  43.  
  44. # Start Game
  45. function start game:
  46. set {uhc::game_running} to true
  47. broadcast "The UHC game has begun! Good luck!"
  48. teleport all players in {uhc::players::*} to random locations
  49. apply effects to players
  50. start border shrink
  51.  
  52. # Apply Effects
  53. function apply effects to players:
  54. loop {uhc::players::*}:
  55. clear loop-player's inventory
  56. set loop-player's gamemode to survival
  57. heal loop-player
  58. feed loop-player
  59.  
  60. # Border Shrink
  61. function start border shrink:
  62. set {_world} to world "world"
  63. set {_initial_size} to 1000
  64. set {_final_size} to 100
  65. set {_duration} to 20 minutes
  66.  
  67. set world border of {_world} to {_initial_size}
  68.  
  69. while size of world border of {_world} > {_final_size}:
  70. set {_current_size} to size of world border of {_world}
  71. set {_new_size} to {_current_size} - 10
  72. if {_new_size} < {_final_size}:
  73. set {_new_size} to {_final_size}
  74. set world border of {_world} to {_new_size} with duration 1 minute
  75. wait 1 minute
  76.  
  77. # Player Death
  78. on death of player:
  79. if {uhc::players::*} contains victim:
  80. remove victim from {uhc::players::*}
  81. set victim's gamemode to spectator
  82. broadcast "%victim% has been eliminated! (%size of {uhc::players::*}% players remaining)"
  83. check for winner
  84.  
  85. # Check for Winner
  86. function check for winner:
  87. if size of {uhc::players::*} is 1:
  88. set {_winner} to first element of {uhc::players::*}
  89. broadcast "%{_winner}% has won the UHC game!"
  90. end game
  91. else if size of {uhc::players::*} is 0:
  92. broadcast "The UHC game has ended with no winner."
  93. end game
  94.  
  95. # End Game
  96. function end game:
  97. set {uhc::game_running} to false
  98. clear {uhc::players::*}
  99. broadcast "The UHC game has ended. Use /uhcjoin to join the next game!"
  100. loop all players:
  101. teleport loop-player to spawn point of world "world"
  102. set loop-player's gamemode to survival
  103. heal loop-player
  104. feed loop-player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement