I'm trying to make a custom game on my server, but even with documentation, I can't really understand what works, what dosen't and why!
I'm looking for people to help me building it, but by learning, not blindly reproducing something. So here we go :
How I want it to work :
2 players in a tennis court like arena fight eachother with bows. Damage dealt is added to a scoreboard, and when the score limit is reached, the game ends.
How I think I should do it with Command Blocks :
-Creating 2 scorboard teams, coloring them and adding a player to each
-Creating a scoreboard objective with damage dealt and display it in sidebar so both player can see it.
-Rapid Clock testing the damage dealt and a comparator linked to it, ending the game when limit has been reached
Before talking about commands and what I've done so far, is this already right ?
Well you can't exactly test for damage dealt. I think a better idea would be to simply increase the score by 1 each successful hit. Here is a little idea of how that could work:
Setup a scoreboard objective tracking player health:
/scoreboard objectives add health health
Setup a scoreboard objective to keep the score:
/scoreboard objectives add score dummy Score
Now when a player does not have 20 health we know they got hit and we need to add 1 point to the other team (this should be running on your clock):
What this will do is add 1 point to a fake player named either Team1 or Team2 (you can call them whatever you want) when someone from the other team has a maximum of 19 health, meaning 0-19, but not 20. We then immediately fully reheal that player.
Now to check when a team's score has reached the limit we can use "test":
/scoreboard players test Team1 score 21
/scoreboard players test Team2 score 21
These will both test for a score of at least 21 and you can use a comparator to receive an output signal to power something else. These two commands will also need to be on that same clock we used above.
This system will also work for more than only one person on each team. It allows for as many people on either team as you like.
Well, it's a good thing that I began to talk about the theory before even mentionning command blocks I've already done!
I was trying to use somthing like :using a scoreboard objective stat.damageTaken, tracking it with a "/testfor @p[score_*ScoreboardName*=min100]" but it didn't work. Wasn't testfor usable in this context ?
This system will also work for more than only one person on each team. It allows for as many people on either team as you like.
Good to know for learning, but in this case, it's a personnal server for a friend and I, so never more than 2 people on it
For now, I'll test with your advices, and see if it works. I'll come back for more soon, because there are some things I wanna add, like a Title when game's end, and making it start and end with a trigger because on a survival based map
Oh you know, I actually forgot all about the stat.damageTaken and stat.damageDealt. They could work too, it would probably be a very similar circuit with the same number of commands. And this really isn't a place for testfor, plus it is always best to avoid using testfor when possible as scoreboards allow exact precise targeting of the tested entities.
Thanks to you, I've made some progress building it !
I've put a "execute @a[score_ScBName_min=xx] ~ ~ ~" that can detect when the score is reached to make it go to the next step! I know the command isn't complete as there is nothing to execute, but I haven't decided yet what to put in, tested it with say for now, and it worked!
It works with damage taken as bow can be a bit random (depending on distance) to make it more tense, but I'm sure it's not over and I'll be back with more questions soon!
I still have to make it work with two players, because I've tested only for one adapting my pre-existing work, have a decent display, and a way to reboot the game or stop the clock while not playing.
Hello everybody!
I'm trying to make a custom game on my server, but even with documentation, I can't really understand what works, what dosen't and why!
I'm looking for people to help me building it, but by learning, not blindly reproducing something. So here we go :
How I want it to work :
2 players in a tennis court like arena fight eachother with bows. Damage dealt is added to a scoreboard, and when the score limit is reached, the game ends.
How I think I should do it with Command Blocks :
-Creating 2 scorboard teams, coloring them and adding a player to each
-Creating a scoreboard objective with damage dealt and display it in sidebar so both player can see it.
-Rapid Clock testing the damage dealt and a comparator linked to it, ending the game when limit has been reached
Before talking about commands and what I've done so far, is this already right ?
Thanks in advance !
Well you can't exactly test for damage dealt. I think a better idea would be to simply increase the score by 1 each successful hit. Here is a little idea of how that could work:
Setup a scoreboard objective tracking player health:
/scoreboard objectives add health health
Setup a scoreboard objective to keep the score:
/scoreboard objectives add score dummy Score
Now when a player does not have 20 health we know they got hit and we need to add 1 point to the other team (this should be running on your clock):
/execute @a[score_health=19,team=team1] ~ ~ ~ scoreboard players add Team2 score 1
/execute @a[score_health=19,team=team2] ~ ~ ~ scoreboard players add Team1 score 1
/effect @a[score_health=19] minecraft:instant_health 1 255
What this will do is add 1 point to a fake player named either Team1 or Team2 (you can call them whatever you want) when someone from the other team has a maximum of 19 health, meaning 0-19, but not 20. We then immediately fully reheal that player.
Now to check when a team's score has reached the limit we can use "test":
/scoreboard players test Team1 score 21
/scoreboard players test Team2 score 21
These will both test for a score of at least 21 and you can use a comparator to receive an output signal to power something else. These two commands will also need to be on that same clock we used above.
This system will also work for more than only one person on each team. It allows for as many people on either team as you like.
Well, it's a good thing that I began to talk about the theory before even mentionning command blocks I've already done!
I was trying to use somthing like :using a scoreboard objective stat.damageTaken, tracking it with a "/testfor @p[score_*ScoreboardName*=min100]" but it didn't work. Wasn't testfor usable in this context ?
Good to know for learning, but in this case, it's a personnal server for a friend and I, so never more than 2 people on it
For now, I'll test with your advices, and see if it works. I'll come back for more soon, because there are some things I wanna add, like a Title when game's end, and making it start and end with a trigger because on a survival based map
Oh you know, I actually forgot all about the stat.damageTaken and stat.damageDealt. They could work too, it would probably be a very similar circuit with the same number of commands. And this really isn't a place for testfor, plus it is always best to avoid using testfor when possible as scoreboards allow exact precise targeting of the tested entities.
Thanks to you, I've made some progress building it !
I've put a "execute @a[score_ScBName_min=xx] ~ ~ ~" that can detect when the score is reached to make it go to the next step! I know the command isn't complete as there is nothing to execute, but I haven't decided yet what to put in, tested it with say for now, and it worked!
It works with damage taken as bow can be a bit random (depending on distance) to make it more tense, but I'm sure it's not over and I'll be back with more questions soon!
I still have to make it work with two players, because I've tested only for one adapting my pre-existing work, have a decent display, and a way to reboot the game or stop the clock while not playing.