#how to make it so when hit a mob, run command on the player that hit.
1 messages · Page 1 of 1 (latest)
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "360:mapchooser1",
"is_spawnable": true,
"is_summonable": true,
"is_experimental": false
},
"component_groups": {},
"components": {
"minecraft:physics": {
"has_collision": true,
"has_gravity": true
},
"minecraft:knockback_resistance": {
"value": 100,
"max": 100
},
"minecraft:damage_sensor": {
"triggers": {
"cause": "attack",
"deals_damage": false,
"on_damage": {
"event": "360:test",
"target": "player"
}
}
}
},
"events": {
"360:test": {
"run_command": {
"command": [
"say testing 123!"
]
}
}
}
}
}```
this not work?
i dont want damage sound and effect to play too
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "360:mapchooser1",
"is_spawnable": true,
"is_summonable": true,
"is_experimental": false
},
"component_groups": {},
"components": {
"minecraft:physics": {
"has_collision": true,
"has_gravity": true
},
"minecraft:knockback_resistance": {
"value": 100,
"max": 100
},
"minecraft:interact": {
"interactions": [
{
"cooldown": 0.5,
"use_item": false,
"hurt_item": 0,
"on_interact": {
"filters": {
"all_of": [
{
"test": "is_family",
"subject": "other",
"value": "player"
}
]
},
"event": "360:test",
"target": "player"
},
"swing": true
}
]
}
},
"events": {
"360:test": {
"run_command": {
"command": [
"say testing123!"
]
}
}
}
}
}```
I try this method and it work when set to self, but not for punch only interact (right click)
i need the event to run on player
yay! I figure it out by myself
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "360:mapchooser1",
"is_spawnable": true,
"is_summonable": true,
"is_experimental": false
},
"component_groups": {},
"components": {
"minecraft:physics": {
"has_collision": true,
"has_gravity": true
},
"minecraft:knockback_resistance": {
"value": 100,
"max": 100
},
"minecraft:damage_sensor": {
"triggers": {
"cause": "all",
"deals_damage": false,
"on_damage": {
"event": "360:test"
}
}
},
"minecraft:interact": {
"interactions": [
{
"cooldown": 0.5,
"use_item": false,
"hurt_item": 0,
"on_interact": {
"filters": {
"all_of": [
{
"test": "is_family",
"subject": "other",
"value": "player"
}
]
},
"event": "360:test",
"target": "self"
},
"swing": true
}
]
}
},
"events": {
"360:test": {
"run_command": {
"target": "other",
"command": [
"say testing123!"
]
}
}
}
}
}```
This is what I do, and when interacting it run on the player! Hopefully it help anyone else
i need to add punch still but yes
(I edit it, it now have the functionality.
when a player interact or hit the entity it run a command as the player)
ok so now I learn that run command is being removed
so I need help moving this to animation controller
that? :0, where? and since when?
Is run_command being removed?
No, it'll just get replaced by queue_command.
Do we know the versions?
yeah, what version?
1.20.60.20
nooo