#How can i make the player have a mob effect when it's health is under 3 hearts

1 messages ยท Page 1 of 1 (latest)

lime hatch
#

pls help

weary bronze
#

I unfortunately don't know how to help you but you can look at the wither's json and warden's json for reference. I assume your json should be like that

(Mob effect component)

If filter
All of (or any of)
Health < 3 (or 6 if you want because it means 3 hearts)

(Put effect stuff here)

lime hatch
#

ok i am going to try that. thank you :)

lime hatch
#

i removed the part i added and i replace it by this :

"minecraft:mob_effect": {
        "effect_range": 0.1,
        "effect_time": 1,
        "mob_effect": "slowness",
        "cooldown_time": 1,
        "entity_filter": 
            { "test": "actor_health", "subject": "self","operator" : "<=", "value": 6 }
      },

and it still doesn't work

weary bronze
#

Then you could replace the effect with an event trigger which triggers an event with a command that gives you infinite slowness. And when it's above 6, it triggers another event with a command that clears your slowness

#

Idk how to exactly do that

weary bronze
lime hatch
#

i think the actor_health is not working

lime hatch
#

nvm

lime hatch
mild pebble
#

Or even just the tick.json I'm pretty sure

lime hatch
mild pebble
mild pebble
lime hatch
#

I will try tomorrow thanks, thx for helping me tho

mild pebble
#

No problem

#

If you have issues, come back and I'll see how I can help

fresh vault
mild pebble
#

I knew this could be done with scripts, but I have no clue about how to do it

lime hatch
lime hatch
#

the problem is that the animation controller that don't seem to play in game because whenever i get under the health required the effect doesn't appear

mild pebble
#

The command you made gives the player the effect for 0 seconds

#

Which means no effect appears

#

Try again with an amount of time that is more than at least one

lime hatch
lime hatch
#

and once i am at a certains number of hp it trigger the effect but once i get under the hp needed that animation doesn't get back to default

#

nvm i used and statement instead of or statment

#

ok everything work but how do i make it loop because if i use the /effect clear comment gapple and potion that heal will be disabled once we hit a a new health step

lime hatch
#

i think i might have to make animation files for it to loop instead of doing with the /clear

mild pebble
#

Change them to animations in the controller or just on their own

lime hatch
#
{
    "format_version": "1.10.0",
    "animations": {
        "animation.slowness": {
            "loop": true,
            "timeline": {
                "0.0": [
                    "/effect @s slowness 0 1 true"
                ]
            },
            "animation_length": 0
        },
        "animation.nausea": {
            "loop": true,
            "timeline": {
                "0.0": [
                    "/effect @s slowness 1 0 true",
                    "/effect @s nausea 1 0 true"
                ]
            },
            "animation_length": 0
        },
        "animation.blindness": {
            "loop": true,
            "timeline": {
                "0.0": [
                    "/effect @s slowness 1 0 true",
                    "/effect @s nausea 1 0 true",
                    "/effect @s blindness 1 0 true"
                ]
            },
            "animation_length": 0
        }
    }
}
#

here is the animation

urban tendon
#

I'd personally use scripts for this, also you can avoid modifications to player json/animations (for compatibility reasons)

mild pebble
#

In the controller, add another object in all the states called animations

#

Then define the animation you want to play