1
I have been working on an adventure map for maybe a month now and I had recently run into an issue where I had a simple boss enemy, a zombie with a guardian riding on its head. My issue was that I needed a way of detecting when the player had killed either of these two mobs so that the other one would die and a cutscene would play.
I have found a crude solution by giving both entities an item the player would not normally obtain during the map (barrier blocks, in this case) and having it so that once one mob was killed, a repeating command block would detect the item and activate a string of other commands, with one killing the mob that was still alive and triggering my cutscene. I also have a second repeating command block that automatically kills this specific item type when it detects it, so I don't have to worry about players picking it up.
Here's the execute command if you're needing it:
/execute if entity @e[type=INSERTMOBHERE,distance=..INSERTNUMBERHERE] run INSERTCOMMANDHERE
There is probably a better way of doing this via scoreboards, but I have yet to find a good tutorial for it. If you do know how to make this work, please let me know.
I have found a crude solution by giving both entities an item the player would not normally obtain during the map (barrier blocks, in this case) and having it so that once one mob was killed, a repeating command block would detect the item and activate a string of other commands, with one killing the mob that was still alive and triggering my cutscene. I also have a second repeating command block that automatically kills this specific item type when it detects it, so I don't have to worry about players picking it up.
Here's the execute command if you're needing it:
/execute if entity @e[type=INSERTMOBHERE,distance=..INSERTNUMBERHERE] run INSERTCOMMANDHERE
There is probably a better way of doing this via scoreboards, but I have yet to find a good tutorial for it. If you do know how to make this work, please let me know.
Create an account or sign in to comment.
1
4
give the mobs a tag each and when it no longer detects one of these tags, triggers cutscene.