How to make a zombie killing detection scoreboard work for a certain gamemode?



  • I'm trying to make it so that when it becomes night, a zombie spawns no matter what at a certain coordinate (which I've managed to do with the simple help of the player having to press a button to change the time to night, and using a chain command block to summon a couple zombies at the same time), and that when the player kills ONE zombie, the scoreboard LostJournalZombie goes off, setting the coordinates 1559 52 -1603 to a redstone block, which will then set off another chain of commands, one of which deletes the scoreboard so that the player cannot receive the message twice. I need this to only affect players in adventure mode, so as of now I'm using the command

    /execute if score @p[gamemode=adventure] LostJournalZombie = 1.. LostJournalZombie run setblock 1559 52 -1603 minecraft:redstone_block.
    

    in a repeating command block that is set to always active and unconditional. I've tried changing this to /execute if score @p[gamemode=adventure] LostJournalZombie = 1 LostJournalZombie run setblock 1559 52 -1603 minecraft:redstone_block and /execute if score @p[gamemode=adventure] LostJournalZombie >= 1 LostJournalZombie run setblock 1559 52 -1603 minecraft:redstone_block and a bunch of others, but none worked.



  • Edit, the command was not showing correctly because apparently without the dots I just added it hides the score part. It is fixed now.

    First of all, when I tried the command it says objective names cannot be longer than 16 characters.

    Second, @p only checks the nearest player, so the way you have it now, it checks if the nearest player is in adventure mode and has the score.

    I am also noticing a syntax error likely causing the issue. The score part checks if the score of one entity equals (or greater/less than etc) the score of another entity. As of now you are checking if a player named "1.."'s LostJournalZombie value is equal to the nearest player's (and only if they are in adventure mode).

    A fixed version would be something to the effect of:

    /execute as @a[gamemode=adventure] if score @s = Aceplante run summon zombie 1559 52 -1603

    Since your goal is to summon a zombie though, I added the last part instead of setting a redstone block. Also you will have to replace with a new scoreboard that is less than 16 characters



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2