Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # UHC Minigame Skript
- # Variables
- variables:
- {uhc::players::*} = 0
- {uhc::min_players} = 2
- {uhc::max_players} = 20
- {uhc::game_running} = false
- {uhc::countdown} = 30
- # Join Command
- command /uhcjoin:
- trigger:
- if {uhc::game_running} is true:
- send "A game is already in progress. Please wait for the next round."
- else if size of {uhc::players::*} >= {uhc::max_players}:
- send "The game is full. Please wait for the next round."
- else:
- add player to {uhc::players::*}
- send "You have joined the UHC game. Waiting for more players..."
- broadcast "%player% has joined the UHC game. (%size of {uhc::players::*}%/%{uhc::max_players}%)"
- if size of {uhc::players::*} >= {uhc::min_players}:
- start game countdown
- # Quit Command
- command /uhcquit:
- trigger:
- if {uhc::players::*} contains player:
- remove player from {uhc::players::*}
- send "You have left the UHC game."
- broadcast "%player% has left the UHC game. (%size of {uhc::players::*}%/%{uhc::max_players}%)"
- else:
- send "You are not in the UHC game."
- # Game Countdown
- function start game countdown:
- set {uhc::countdown} to 30
- loop 30 times:
- broadcast "UHC game starting in %{uhc::countdown}% seconds!"
- remove 1 from {uhc::countdown}
- wait 1 second
- start game
- # Start Game
- function start game:
- set {uhc::game_running} to true
- broadcast "The UHC game has begun! Good luck!"
- teleport all players in {uhc::players::*} to random locations
- apply effects to players
- start border shrink
- # Apply Effects
- function apply effects to players:
- loop {uhc::players::*}:
- clear loop-player's inventory
- set loop-player's gamemode to survival
- heal loop-player
- feed loop-player
- # Border Shrink
- function start border shrink:
- set {_world} to world "world"
- set {_initial_size} to 1000
- set {_final_size} to 100
- set {_duration} to 20 minutes
- set world border of {_world} to {_initial_size}
- while size of world border of {_world} > {_final_size}:
- set {_current_size} to size of world border of {_world}
- set {_new_size} to {_current_size} - 10
- if {_new_size} < {_final_size}:
- set {_new_size} to {_final_size}
- set world border of {_world} to {_new_size} with duration 1 minute
- wait 1 minute
- # Player Death
- on death of player:
- if {uhc::players::*} contains victim:
- remove victim from {uhc::players::*}
- set victim's gamemode to spectator
- broadcast "%victim% has been eliminated! (%size of {uhc::players::*}% players remaining)"
- check for winner
- # Check for Winner
- function check for winner:
- if size of {uhc::players::*} is 1:
- set {_winner} to first element of {uhc::players::*}
- broadcast "%{_winner}% has won the UHC game!"
- end game
- else if size of {uhc::players::*} is 0:
- broadcast "The UHC game has ended with no winner."
- end game
- # End Game
- function end game:
- set {uhc::game_running} to false
- clear {uhc::players::*}
- broadcast "The UHC game has ended. Use /uhcjoin to join the next game!"
- loop all players:
- teleport loop-player to spawn point of world "world"
- set loop-player's gamemode to survival
- heal loop-player
- feed loop-player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement