Started by
GyokuroKunso
on
Topic category: Help with MCreator software
Guys, I'm a beginner with Mcreator and I wanted to know how I can do certain events as the mob's health drops in Mcreator? I would be very grateful if someone could explain and show an example of the code in an image
It really depends on what specifically you want to do, but I'm willing to provide examples.
Generally speaking, you'll want to create a procedure with the 'before entity is hurt' global trigger. (Whenever an entity takes damage, your procedure will trigger on the same tick, before the damage is dealt.) You can then use the 'current health' function in the entity data tab to check the current health of the entity, and if you wanted to, you could divide this by the 'maximum health' of the entity and multiply by 100 to get a percentage value. (This way you could make a procedure that, for example, triggers whenever an entity falls below 50% health, regardless of what their maximum health is.
But there's a lot of stuff you could do with this. What did you have in mind?
I wanted him to do certain types of attacks, for example attacking from far away, summoning servants and other types of movements that could be done
...That could be more difficult. You could try coding in different attack behaviors with conditions based on the mob's health, but if you want seriously different texture/model/behavior for lower health, (like for a bossfight), you might be better off just spawning in another version of the entity and despawning the old one whenever the health falls below a certain point. Making behavioral changes to a single entity is kind of limited.
Okay , thank you bro