How can I make a command be triggered when an item is throwed?
//ads -- adsterra.com -- native banner
?>
I would like to have a command that makes a item that when I throw it will freeze mobs for 100 s in a 200 block area (trigger a command). how can I do this?
Best Answer
Have the following commands repeating, in this order:
/scoreboard players tag @e[type=Item] add FreezeItem {Item:{id:"minecraft:ice",tag:{display:{Name:"Freeze"}}}}
/execute @e[type=Item,tag=FreezeItem] ~ ~ ~ /effect @e[type=!Player,r=200] slowness 100 50
/kill @e[type=Item,tag=FreezeItem]
You can change {Item:{id:"minecraft:ice",tag:{display:{Name:"Freeze"}}}} to the tags you want to identify the item by. Currently, it's a block of ice renamed "Freeze".
You can also change /effect @e[type=!Player,r=200] slowness 100 50 to whatever command you want to activate when the item is thrown.
Pictures about "How can I make a command be triggered when an item is throwed?"



How do you trigger a command block with an item?
You can use the /trigger command to create a trigger that sets or adds values to scoreboard objectives that trigger enabled in Minecraft....DefinitionsHow to trigger commands dropping items in Minecraft Bedrock
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Monstera, Elijah O'Donnell, Julia Avamotive
