Minecraft Blogs

An Explanation of a Complex Scoreboard Gametype

  • 7
  • 3
  • 5
avatar skipper587
Level 34 : Artisan Dragon
72
With the release of my upcoming arena gametype fast approaching, I figured that I'd post a tutorial/explanation about how I got it to work. So, sit back, grab a cup of coffee, and try to keep up!

There's a complex web of /scoreboard, /effect, and /testfor commands that let this arena function properly. They took me forever to figure out, and I had some mishaps with the /testfor command (turns out you can't add spaces between parameters contained in the brackets after @p or @a), but I finally got it working this afternoon. Below you will find a flowchart (paint, ftw!) for the basic game progression.

LogicFlowFigpng


On initial spawn, players are teamless and stat-less. They are funneled into two team selection portals, with the Survivor team allowing infinite players, while the Predator team only allows 1 through the use of a flip-flop (for easy reset). As the players are moved to their team specific holding room, I set their respawn point to the main lobby using /spawnpoint. There are 2 team lobbies, one for the Survivors, and one for the Predator. The Survivors are given a choice of 3 classes in their pregame lobby: Noble, Stealth, and Brute. Each /give command set is preceded by a /clear command, so that the player can only take 1 set of gear. 4 /effect effects are applied to the Predator as they enter their pregame lobby: Strength, Jump Boost, Speed, and Invisibility. This is achieved through the use of 4 command blocks attached to a redstone clock in a chunk that will always be loaded. There is also a command block attached to an inverted daylight sensor that triggers a Night Vision effect at night. The Predator is held in their lobby until the Survivors enter the arena (also by use of a flip-flop, controlled by the Survivor /tp pressure plate). When the players enter the arena, they are forced to leave the spawn by a command block attached to a simple redstone clock that applies the nausea affect.


Gameplay proceeds, and here's where you're going to need to know my variables. I have 3.


death ~ Of type deathCount, player specific

player_Count ~ Of type dummy, incremented to the Predator as Survivors enter the arena

deathTotal ~ Of type dummy, incremented as Survivors are killed

game ~ Of type dummy, turned on or off when the game is in progress or over


I will now discuss the logic behind the gameplay section in the figure above. I have a redstone clock high above the arena that has 3 command blocks attached to it. They all are running the /testfor command, seeking certain conditions.


The first condition is when a Survivor dies. Using the comand /testfor @a[team=survivor,score_death=1,score_death_min=1], I send a signal through a comparator to 3 other command blocks. The first uses the command /tp @a[team=survivor,score_death=1,score_death_min=1] to the spectator arena, high above the ground. The second, slightly delayed resets the death count to 0 (so that they don't continuously get teleported to the spectator arena) using the command /scoreboard player set @a[team=survivor,score_death=1,score_death_min=1] Death 0. And the third increments deathTotal, a score attached to the Predator, by 1 using the command /scoreboard players add @a[team=predator] deathTotal 1.


The second condition is when the Predator is killed. Using the command /testfor @a[team=predator,score_death=1,score_death_min=1], I send a signal through a comparator to 5 other command blocks. The first announces that the Survivors won using /say Survivors win! The second and third, slightly delayed, empty both teams using the commands /scoreboard teams empty predator and /scoreboard teams empty survivor. The fourth resets 'game' to 0 by running the command /scoreboard players @a[team=predator] game 0. Finally, all players are teleported back to the spawn room using /tp.


The third, and final condition is that all the Survivors have been killed. Using the command /testfor @a[team=predator,deathTotal=player_Count], I send a signal through a comparator to 5 other command blocks. The first announces that the Predator won using /say The Predator wins! The second and third, slightly delayed, empty both teams using the commands /scoreboard teams empty predator and /scoreboard teams empty survivor. The fourth block, like previously mentioned, runs the command /scoreboard players @a[team=predator] game 0 to reset 'game' to 0. Finally, all players are teleported back to the spawn room using /tp.


If you recall, both the variables deathTotal and player_Count were attached to the Predator. This /testfor condition command displays why. I'm not actually 100% sure if it works (as I'm not sure if you can compare variables) but in theory it should.


UPDATE: This does not work, so I've countered it by creating an admin commands room in the spawn that allows the admin to manually change the player count.


Also recently added was the variable 'game', which is used for auto reset logic. Using the a command block attached to a clock that passes the command /testfor @a[team=predator,score_game=0,score_game_min=0], I pass a current to a flip-flop that allows for reset of several secrets in the map, all centered around the /give command. The value of 'game' is set to 1 when the game is in progress, and set to 0 when the game finishes, demonstrated by the endgame logic above.


So there you have it! Every detail in how this map functions! If you plan on using this gametype elsewhere, please ask first.


If you like this, be sure to diamond, favourite, and subscribe!


Cheers,

~Skipp
CreditGeneralSparkzz
Tags

2 Update Logs

Update #2 : 03/15/2013 8:43:09 amMar 15th, 2013

- Added an explanation of the secret reset.
LOAD MORE LOGS

1
03/14/2013 11:18 pm
Level 19 : Journeyman Caveman
GeneralSparkzz
Your Gameplay thing is partly like every other team VS team with scoreboards but done a little diffrently and only its Team VS one All you say seems like it will work but i have concerns for some areas but all around great job at explaining it
1
03/14/2013 11:22 pm
Level 34 : Artisan Dragon
skipper587
It actually works great. I've done extensive testing tonight with a group of people. There are some definite shortcomings with the stock commands, and there's some map details that you have to manually reset, but overall it's very enjoyable.
1
03/14/2013 10:46 pm
Level 36 : Artisan Steve
BigDaddy
*brainexplosion*
1
03/14/2013 10:46 pm
Level 34 : Artisan Dragon
skipper587
That happens :P
1
03/14/2013 8:55 pm
Level 1 : New Mountaineer
grifftek
I can't wait until it comes out!
Planet Minecraft Logo

Website

© 2010 - 2020
www.planetminecraft.com

Welcome