1

Execute Function Link Help

Bricius_The_First 7/17/23 4:05 am history
237
7/27/2023 8:43 am
This is a bit of a longshot as Ive looked through the different mobs and chests and things to check first. But is there a way to make mobs that die execute a command or function? I would thing with how Java works there would be a way to do this, even if its through a function substitute or something, but I'm not sure. I could have swore Ive seen other datapacks that do this, but with mob summoning instead.



For example, if when a mob dies, it executes a command to say a random death message from 1 of 10 different messages. Or if a mob is squished from cramming or fire, it drops a different item (sorta like how meat drops cooked).
Posted by
Bricius_The_First
Level 1 : New Miner
0

  Have something to say?

JoinSign in

2

imalittlhigh
07/27/2023 8:43 am
Level 67 : High Grandmaster Sweetheart Stack
you can do that with loot tables (the drops atleast) you can specify how the mob has to die (very detailed, like biome, type of death, killer, etc, even coords)

So you can modify the look like that, and technically you could add specific loot to specific deaths, detect that loot, then execute the death message, and delete the loot (if u have to) [You can add nbt tags to identify the loot without actually changing the functionality or look of the item)

Thats a bit more work then what the first comment suggested, but you can customize it waaaay more
1
ThePatriotsCommandXS
07/22/2023 3:35 pm
Level 68 : High Grandmaster Programmer Cyborg
Set up a scoreboard

/scoreboard objectives add health dummy


Save the health to that scoreboard

execute as @e store result score @s health run data get entity @s Health

Run a command based on the health value being zero

execute as @e[scores={health=0}] at @s run <COMMAND>
2

Welcome