Help with mob health and variables

Started by Withie The Cryptid on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with mob health and variables

I have a mob that I want to change into another form and then change back with the same health. I know what I need to do, which is set the mob's health as a variable and then spawn the mob again, having the variable then change the mob's health. But every time I try it, it always says something's wrong and won't let me save. Does anyone know how to do this properly?

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could you screenshot the…
Mon, 01/09/2023 - 03:46

Could you screenshot the procedure?

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Despawing a local varible…
Mon, 01/09/2023 - 13:14

Despawing a local varible wont work because the local varible is not the entity.

I am trying to recreate a working procedure but i need a bit more context for it.

Are you trying to make the entity lose max health after it is hit by an arrow? Like, tell me more in detail exactly what you want the entity to do and i might be able to fix it.

 

 

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Basically I have 2 mobs,…
Mon, 01/09/2023 - 21:30

Basically I have 2 mobs, that are going to be 2 seperate forms. First there's the regular form, and then there's the protected form, which is immune to damage. Whenever it's hit with a projectile, I want it to change into it's protected form for a few seconds, and then switch back into it's regular form. However, I also don't want it's health to reset every time it goes back to it's regular form from it's protected form.

 

That's more or less what I'm trying to do.

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I see, another way to do…
Mon, 01/09/2023 - 22:07

I see, another way to do this is just to add a potion effect if the player hits the entity, and when this potion effect is active it cancels attack events. Unless you actually want the model to change.

Here is a tutorial on how to swap models:

https://www.youtube.com/watch?v=lYxj-7MnaUQ

I could help you with the potion procedure if you dont know how to make it

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried what the video said,…
Wed, 01/11/2023 - 04:16

I tried what the video said, but the mob just despawned and the second one didn't spawn in

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Its a very long procedure so…
Wed, 01/11/2023 - 11:58

Its a very long procedure so doubble chech that everything is correct, if i remember correctly you can download it on his website aswell.

 

But was my potion idea any use for your mod or does the model change actualy swap how it looks?

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I imported the procedure…
Wed, 01/11/2023 - 18:58

I imported the procedure from the link and it worked perfectly! Thank you!

 

And yes the model actually changes it's look

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Awesome! Good luck with the…
Thu, 01/12/2023 - 12:11

Awesome! Good luck with the mod