Right now I'm trying to make a map in 1.16.2 where once someone dies, the other wins. I've been struggling with the command that detects if someone dies. Also, I assigned that person with the tag of "killer". I also have a scoreboard called "hasDied" that just detects when the player has died. Lastly, it is running in a repeating, always active command block if that helps.
This is what I have that I can't get to work:
execute as @a[tag=killer] run execute if score @s hasDied >= 1 hasDied run scoreboard players add Killer Points 1
Right now I'm trying to make a map in 1.16.2 where once someone dies, the other wins. I've been struggling with the command that detects if someone dies. Also, I assigned that person with the tag of "killer". I also have a scoreboard called "hasDied" that just detects when the player has died. Lastly, it is running in a repeating, always active command block if that helps.
This is what I have that I can't get to work:
execute as @a[tag=killer] run execute if score @s hasDied <strong><span style="color: #ff0000;">>= 1</span></strong> hasDied run scoreboard players add Killer Points 1
I'm not good at scoreboards, its almost a year since i first and last touched that.
So if you the start game the hasDied variable is suppost to be zero right?
>= 1 sounds like a if comparison that checks if the hasDied is equal or higher then 1.
If you start with zero while using that command nothing should happen.
I might be totally wrong here but i hope this was helpful.
Yes, when the game starts the hasDied variable is 0 and it doesn't do anything. But I was hoping that once it got up to or past 1 the game would end causing a victory for one team.
Right now I'm trying to make a map in 1.16.2 where once someone dies, the other wins. I've been struggling with the command that detects if someone dies. Also, I assigned that person with the tag of "killer". I also have a scoreboard called "hasDied" that just detects when the player has died. Lastly, it is running in a repeating, always active command block if that helps.
This is what I have that I can't get to work:
I'm not good at scoreboards, its almost a year since i first and last touched that.
So if you the start game the hasDied variable is suppost to be zero right?
>= 1 sounds like a if comparison that checks if the hasDied is equal or higher then 1.
If you start with zero while using that command nothing should happen.
I might be totally wrong here but i hope this was helpful.
Edit:
Is this part of a victory/loose condition?
I think i got that stuff wrong...
My projects:
-are abandoned for now. I might pick 'em up in the future.
For now i'm working on a private modpack that suit's my own playstyle.
I am gonna stay in modded 1.12.2 untill my potato dies. No mercy! :Q
Yes, when the game starts the hasDied variable is 0 and it doesn't do anything. But I was hoping that once it got up to or past 1 the game would end causing a victory for one team.
Ok, that is the problem:
You start with hasDied = 0.
Your comparison
-trys to detect if the hasDied is begger then 1 or equal to 1.
The comparison you use is ment to detect if a player has more then 1 or 1 live left, wich is in your example the requirment to add Killer Points +1.
So unless you change >=1 to >=0 nothing will hapen because the condition is not fullfilled.
That alone however is not a full victory/defeat condition. It's just the integer handling of lifes and kills.
I hope someone can assist you further with this, because i am very poor at handling scoreboards in minecraft.
Setting up algorithms with blocks in a 3d world isn't easy. Especcially the variable handling is weird to me.
Edit:
I suggest downloading and using an nbt explorer. With this you can edit the scoreboards outside minecraft.
I don't know if you can edit commandblocks that way.
My projects:
-are abandoned for now. I might pick 'em up in the future.
For now i'm working on a private modpack that suit's my own playstyle.
I am gonna stay in modded 1.12.2 untill my potato dies. No mercy! :Q
Sorry for the doppelpost, i think this might be useful.
This is how i understand a victory / defeat mechanic in a game where everyone is your enemy.
Initialization (Start or game reset)
Add player (player array) to playergroup
Set player_live (player array) = 3
Set player_kill (player array) = 0
Event: player kills player
-increase player_Kill (triggering player) +1
-decrease player_live (dying player) -1
Event: Player Dies
If player_live (triggering player) = 0
then do:
remove player from playergroup
message player: You succ!
Victory condition also has player dies as event
If number of players in playergroup = 1
then do:
message player: yadayada
Note that i use arrays to keep the wannabe code simple and compact.
I don't know if you can do this with minecraft scoreboard. If so, you can save a lot of work.
Edit: with triggering player the one that triggers the event is meant.
My projects:
-are abandoned for now. I might pick 'em up in the future.
For now i'm working on a private modpack that suit's my own playstyle.
I am gonna stay in modded 1.12.2 untill my potato dies. No mercy! :Q