I'm working on a little game just for fun, and I have it so that whenever you kill a mob, you gain 1 "Coin" everything works fine but was wondering if to improve it even more, there was a way for me to add different amounts of "Coins" depending on what you kill. For example: you would get 1 Coin for killing a zombie, and 3 coins if you kill a creeper. My best guess was to create other scoreboard objectives that are specific to each mob, but I don't know how I would get them to add value to "Coins" (because as far as I know you cant do math in Minecraft without making something really complex).
If you can help, thanks a lot. If not, that's okay too
EDIT: I have given this a lot of thought and I have come up with (what I thought) would be a solution:
/execute as @p[scores={SkeletonsKilled=1..}] run scoreboard players add @s Coins 1
Followed by another command (chained together):
/scoreboard players reset @p SkeletonsKilled
Note: Using @p isn't going to be the issue since I am just making this to be played by myself. Also the reason it only adds 1 "Coins" is because Coins is already calculated as Total number killed so its technically adding 2 Coins for each skeleton
What I was hoping this would do is detect when the scoreboard stat "SkeletonsKilled" has a minimum of 1? I think.
The second command resets the "SkeletonsKilled" back to zero so that it doesn't create an endless loop. The problem I am having is that it isn't detecting when I kill a skeleton. I think the issue is that I need clarity on the "SkeletonsKilled=1.." part. I don't know if that is right. Instead of the "1.." I have tried "1", "..1", "1..10" and "..10". None of those seemed to work either. I'm completely out of ideas of what to try, and I have very little experience with Minecraft commands.
EDIT AGAIN: I had another idea that didn't work out for me. I realized that you can do /scoreboard players operations. When I first saw this I thought it was the answer to my payers and you could finally do simple math. I'm sure you can but my puny noob brain couldn't figure it out, but I only had about 15 minutes to try different things. I didn't really come up with anything remotely close to a solution but I thought I should let you know everything I have tried
I'm replying to my own post because I found the solution what I was talking about as the first solution. From what I found out, I think was a bug.
In one command block I typed this and it didn't work: (it was repeat, unconditional, always active)
/execute if entity @p[scores={SkeletonsKilled=1..}] run say hi
THEN: In a different command block I copy and pasted from a google doc: (it was ALSO repeat, unconditional, always active)
/execute if entity @p[scores={SkeletonsKilled=1..}] run say hi
AND THE SECOND ONE WORKS!!!! WHAT THE HECK MINECRAFT?!?!?!? THERE WAS NO DIFFERENCE EXCEPT THAT I COPY AND PASTED FROM AN OUTIDE SOURCE!!!! That is really annoying.
Just in case anyone is trying to do a similar thing to me, if you look in the post, use the two commands there and it should work fine. If anyone know of a bug like this I would like to know if my hypothesis is correct and it is just copy and pasted I have no idea, and I have kind of gone insane trying to figure out what is wrong.
Rollback Post to RevisionRollBack
People tell lies on the internet?
To post a comment, please login or register a new account.
I'm working on a little game just for fun, and I have it so that whenever you kill a mob, you gain 1 "Coin" everything works fine but was wondering if to improve it even more, there was a way for me to add different amounts of "Coins" depending on what you kill. For example: you would get 1 Coin for killing a zombie, and 3 coins if you kill a creeper. My best guess was to create other scoreboard objectives that are specific to each mob, but I don't know how I would get them to add value to "Coins" (because as far as I know you cant do math in Minecraft without making something really complex).
If you can help, thanks a lot. If not, that's okay too
EDIT: I have given this a lot of thought and I have come up with (what I thought) would be a solution:
/execute as @p[scores={SkeletonsKilled=1..}] run scoreboard players add @s Coins 1Followed by another command (chained together):
Note: Using @p isn't going to be the issue since I am just making this to be played by myself. Also the reason it only adds 1 "Coins" is because Coins is already calculated as Total number killed so its technically adding 2 Coins for each skeleton
What I was hoping this would do is detect when the scoreboard stat "SkeletonsKilled" has a minimum of 1? I think.
The second command resets the "SkeletonsKilled" back to zero so that it doesn't create an endless loop. The problem I am having is that it isn't detecting when I kill a skeleton. I think the issue is that I need clarity on the "SkeletonsKilled=1.." part. I don't know if that is right. Instead of the "1.." I have tried "1", "..1", "1..10" and "..10". None of those seemed to work either. I'm completely out of ideas of what to try, and I have very little experience with Minecraft commands.
EDIT AGAIN: I had another idea that didn't work out for me. I realized that you can do /scoreboard players operations. When I first saw this I thought it was the answer to my payers and you could finally do simple math. I'm sure you can but my puny noob brain couldn't figure it out, but I only had about 15 minutes to try different things. I didn't really come up with anything remotely close to a solution but I thought I should let you know everything I have tried
This is starting to turn into a blog lol.
People tell lies on the internet?
I'm replying to my own post because I found the solution what I was talking about as the first solution. From what I found out, I think was a bug.
In one command block I typed this and it didn't work: (it was repeat, unconditional, always active)
/execute if entity @p[scores={SkeletonsKilled=1..}] run say hiTHEN: In a different command block I copy and pasted from a google doc: (it was ALSO repeat, unconditional, always active)
/execute if entity @p[scores={SkeletonsKilled=1..}] run say hiAND THE SECOND ONE WORKS!!!! WHAT THE HECK MINECRAFT?!?!?!? THERE WAS NO DIFFERENCE EXCEPT THAT I COPY AND PASTED FROM AN OUTIDE SOURCE!!!! That is really annoying.
Just in case anyone is trying to do a similar thing to me, if you look in the post, use the two commands there and it should work fine. If anyone know of a bug like this I would like to know if my hypothesis is correct and it is just copy and pasted I have no idea, and I have kind of gone insane trying to figure out what is wrong.
People tell lies on the internet?