Help with mob health and variables

Started by Withie The Cryptid on

Topic category: Help with Minecraft modding (Java Edition)

Active 4 months ago
Joined Nov 2022
Points:
465

User statistics:

  • Modifications: 4
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
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?

Active 3 weeks ago
Joined Jan 2021
Points:
714

User statistics:

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

Could you screenshot the procedure?

Active 3 weeks ago
Joined Jan 2021
Points:
714

User statistics:

  • Modifications: 2
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 199
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.

 

 

Active 4 months ago
Joined Nov 2022
Points:
465

User statistics:

  • Modifications: 4
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
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.

Active 3 weeks ago
Joined Jan 2021
Points:
714

User statistics:

  • Modifications: 2
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 199
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

Active 4 months ago
Joined Nov 2022
Points:
465

User statistics:

  • Modifications: 4
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
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

Active 3 weeks ago
Joined Jan 2021
Points:
714

User statistics:

  • Modifications: 2
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 199
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?

Active 4 months ago
Joined Nov 2022
Points:
465

User statistics:

  • Modifications: 4
  • Forum topics: 31
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 22
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

Active 3 weeks ago
Joined Jan 2021
Points:
714

User statistics:

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

Awesome! Good luck with the mod