Need a procedure when a mob attacks the player !

Started by GendarmyY on

Topic category: Help with MCreator software

Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need a procedure when a mob attacks the player !

I created a aggresive mob and I want it to give the player an effect when it attacks him. I just want to know if that's possible because it doesn't seems like there is a procedure for "when the mob attacks you" and the closest I found is " when player collides with mob " but the problem is that it gives the effect even when the mob doesn't attack the player, it just need the player to be close. :/

 

If there is any way to do that it would be really appreciated ! :)

( Excuse my english if I've made mistakes, english isn't my main language)

Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually, I've found how to…
Thu, 07/02/2020 - 20:47

Actually, I've found how to do it. If anyone wants to know how;

You create a procedure (not a procedure with the mob, when you create a new elements you normally have "procedure") you make global trigger: "Entity attacked". Then after that you can use a procedure already made in the template library which is "check if current entity is player". Then you duplicate the line in if that says: "Is [Event/ target entity] (sub)type of [EntityPlayer]" and you take it off the "if" line. You now need to have a "__ AND __" which can be found in "Logic Operations", it's the first one with the equals sign, you can change the equals sign to "AND". You put it at the "if" line. In the first hole of "__AND__" you put the "Is [Event/ target entity] (sub)type of [EntityPlayer]" in it. In the second one, you take your duplicate and you change [Event/ target entity] to [Source entity] which can be found in "Minecraft components" and also replace [EntityPlayer] with the entity you created. In the "do" line, you simply put the "Add Potions" procedure that can be found in "Entity procedure. An dif you've done everything wright, normally an effect should be applied to the player when he get hit by the mob ! ;)

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks man you helped me…
Fri, 02/05/2021 - 17:29

Thanks man you helped me alot!

Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please upload an image.  
Sat, 03/20/2021 - 20:44

Please upload an image.

 

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much!
Mon, 03/29/2021 - 14:06

Thank you so much!

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks, i hope this works...
Thu, 04/01/2021 - 09:36

thanks, i hope this works...

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
update: mine didn't work…
Thu, 04/01/2021 - 09:44

update:
mine didn't work apparently. i followed the steps, is it bc of the game version, im using 1.12.2 generator in 2020.5

 

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This really helped actually,…
Wed, 07/28/2021 - 05:53

This really helped actually, not in the fact that i wanted to do that too, i just didnt know you could change the = into an "AND", so uhh, my bad i guess

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Good afternoon, I want to…
Thu, 11/10/2022 - 15:28

Good afternoon, I want to ask a question, but I don't know how to do it individually, so I'll do it here. Does anyone know how to make my character transform into a mod that I create? For example, create a zombie and I want my character to transform into that zombie