#how do i make an anmation controller that tests for armor

1 messages · Page 1 of 1 (latest)

obtuse shoal
#

so i have been working at this for 2whole days buti cant seem to figure it out. I want to make an animation controller that tests if a player has a full set of armor, they get a effect say health boost. Note: the armor set is custom. I would really appreciate any help that i get.

#

and yes it includes the use of molang

haughty locust
obtuse shoal
obtuse shoal
#

this is my code

#

{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.armor_effects": {
"states": {
"default": {
"transitions": [
{
"vampire": "query.is_item_name_any('slot.armor.head') == cube:vampire_hat && query.is_item_name_any('slot.armor.chest') == cube:vampire_chest && query.is_item_name_any('slot.armor.legs') == cube:vampire_leg && query.is_item_name_any('slot.armor.feet') == cube:vampire_boots"
}
]
},
"vampire": {
"transitions": [
{
"default": "!query.is_item_name_any('slot.armor.head') == cube:vampire_hat || !query.is_item_name_any('slot.armor.chest') == cube:vampire_chest || !query.is_item_name_any('slot.armor.legs') == cube:vampire_leg || !query.is_item_name_any('slot.armor.feet') == cube:vampire_boots"
}
],
"on_entry": [ "/effect @s health_boost 10 7 true" ]
}
}
}
}
}

haughty locust
#

The use is query.is_item_name_any('<str: location', <int: slot>, '<str: namespace:item_name>')
For example, query.is_item_name_any('slot.armor.head', 0, 'minecraft:diamond_helmet') will return true when the player is wearing a diamond helmet

#

You can surround the query in (), using && to join the queries then use an ! on the return to default transition.

obtuse shoal
#

{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.armor_effects": {
"states": {
"default": {
"transitions": [
{
"vampire": "query.is_item_name_any('slot.armor.head',0,'cube:vampire_hat') && query.is_item_name_any('slot.armor.chest,0,'cube:vampire_chest') && query.is_item_name_any('slot.armor.legs',0,'cube:vampire_leg') && query.is_item_name_any('slot.armor.feet',0,'cube:vampire_boots')"
}
]
},
"vampire": {
"transitions": [
{
"default": "!query.is_item_name_any('slot.armor.head',0,'cube:vampire_hat') || !query.is_item_name_any('slot.armor.chest,0,'cube:vampire_chest') || !query.is_item_name_any('slot.armor.legs',0,'cube:vampire_leg)' || !query.is_item_name_any('slot.armor.feet',0,'cube:vampire_boots')"
}
],
"on_entry": ["/effect @s health_boost 10 9 true"]
}
}
}
}
}

#

is there anything i need to do in the manifest file or version changes or anything like tht?

bleak wren
obtuse shoal
#

tried and still not working

haughty locust
#

You also need to add an initial state value

#

I would recommend using a higher format version like 1.19.50

#

Also 'slot.armor.chest is incorrect as it is missing a closing '

granite sky