Need a procedure when a mob attacks the player !

Started by GendarmyY on

Topic category: Help with MCreator software

Active 1 year ago
Joined May 2019
Points:
745

User statistics:

  • Modifications: 0
  • Forum topics: 13
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 25
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)

Active 1 year ago
Joined May 2019
Points:
745

User statistics:

  • Modifications: 0
  • Forum topics: 13
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 25
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 ! ;)

Active 4 years ago
Joined Feb 2021
Points:
600

User statistics:

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

Thanks man you helped me alot!

Active 9 months ago
Joined Jun 2015
Points:
847

User statistics:

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

Please upload an image.

 

Active 4 years ago
Joined Jul 2017
Points:
721

User statistics:

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

Thank you so much!

Active 10 months ago
Joined Mar 2021
Points:
755

User statistics:

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

thanks, i hope this works...

Active 10 months ago
Joined Mar 2021
Points:
755

User statistics:

  • Modifications: 0
  • Forum topics: 21
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 113
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

 

Active 2 years ago
Joined Jul 2021
Points:
710

User statistics:

  • Modifications: 0
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 44
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

Active 2 years ago
Joined Oct 2022
Points:
385

User statistics:

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