#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)
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)
ok i am going to try that. thank you :)
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
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
But this method should work, idk why it doesn't
i think the actor_health is not working
nvm
i already tried this but i am going to try and add it via component group
You can just go the really simple way and make a behaviour pack animation
Or even just the tick.json I'm pretty sure
Yeah but how would I check for health
Nevermind this
But the animation/animation controller could work
I will try tomorrow thanks, thx for helping me tho
I can do this but for scripts if you want it for scripts
I knew this could be done with scripts, but I have no clue about how to do it
for now i am trying to do with animation controller and if i really can't get it to work i'll call you okay ?
okay so i have tried to do the animation controller but it somehow doesn't work so i ask if you have a clue
controller animation
player behaviour
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
The controller works
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
oh shoot i got the amplifiers and duration crossed my bad ๐
okay now it does work but it doesn't loop
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
here is the new version
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
i think i might have to make animation files for it to loop instead of doing with the /clear
Yeah, on entry only lets it play once
Change them to animations in the controller or just on their own
okay i made the animation but how do i had them to the controller ?
{
"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
I'd personally use scripts for this, also you can avoid modifications to player json/animations (for compatibility reasons)
I agree
But to answer your question
In the controller, add another object in all the states called animations
Then define the animation you want to play