1
Command Block Help / Detect Mob Death by Player
So, I am trying to make it so that when someone kills a custom mob they get a custom item. However, I want everyone in the area (they are given a tag if they are in it) to get one as well as it can be a team fight and I want the reward to be the same no matter how many participate.
I'd like to set up something that detects that the custom mob was killed by a player, and then another command gives everyone with the area tag a custom item.
I've come across this https://www.reddit.com/r/MinecraftCommands/comments/dqzqvd/how_to_detect_entity_death/ but I'm not sure how to make it work for custom mobs, and I need it to reset after activating once.
By the way, is there some sort of command block syntax and function bible? I've looked through some wikis and such, but a lot of the uses and syntax don't seem forthcoming.
Thank you for any help given and all help given so far Command Wizards.
I'd like to set up something that detects that the custom mob was killed by a player, and then another command gives everyone with the area tag a custom item.
I've come across this https://www.reddit.com/r/MinecraftCommands/comments/dqzqvd/how_to_detect_entity_death/ but I'm not sure how to make it work for custom mobs, and I need it to reset after activating once.
By the way, is there some sort of command block syntax and function bible? I've looked through some wikis and such, but a lot of the uses and syntax don't seem forthcoming.
Thank you for any help given and all help given so far Command Wizards.
5
I would:
1. Create a custom loot table that contains an item with a specific nbt tag and has the "killed_by_player" condition (This is a good site for making loot tables)
2. Have the custom mob use the loot table (using the {DeathLootTable:""} tag)
3. Have a command constantly checking for the item entity with the specific nbt tag
4. If it finds the item (meaning a player killed the custom mob and it dropped the item), execute at the item entity and tag all players in a certain distance of it
5. Run any other commands needed, then kill the item entity
This should work in theory, I haven't tested it though.
1. Create a custom loot table that contains an item with a specific nbt tag and has the "killed_by_player" condition (This is a good site for making loot tables)
2. Have the custom mob use the loot table (using the {DeathLootTable:""} tag)
3. Have a command constantly checking for the item entity with the specific nbt tag
4. If it finds the item (meaning a player killed the custom mob and it dropped the item), execute at the item entity and tag all players in a certain distance of it
5. Run any other commands needed, then kill the item entity
This should work in theory, I haven't tested it though.
You can just use the player_killed_entity advancement detect if any player kills a certain mob, and in the reward function give the player's team the item.
Less laggier as there is less nbt checks and less steps (make advancement to detect if player kills certain mob, in reward function give all team plyers the item, revoke advancement)
Less laggier as there is less nbt checks and less steps (make advancement to detect if player kills certain mob, in reward function give all team plyers the item, revoke advancement)
Awesome, I think this will suit my purposes. I was thinking of doing loot tables, but I'd prefer to not require people to download a datapack for it to function as intended.
For my solution, you still need a datapack (still uses external json files).
However, only the server owner needs to download the datapack, because it is part of the world and isnt part of the client side (unlike resource packs)
However, only the server owner needs to download the datapack, because it is part of the world and isnt part of the client side (unlike resource packs)
Commandblocks just use all the commands from the commandline. This is a good start: https://minecraft.fandom.com/wiki/Commands
Custom entities can be accessed the same way as minecraft-entities. For example: minecraft.cow refers to a cow, while mycustommod.beast refers to beast in 'myscustommod'. You need to know the name of the entity.
Custom entities can be accessed the same way as minecraft-entities. For example: minecraft.cow refers to a cow, while mycustommod.beast refers to beast in 'myscustommod'. You need to know the name of the entity.
