Need a procedure when a mob attacks the player !

Started by GendarmyY on Thu, 07/02/2020 - 12:10

Topic category: Help with MCreator software

Last seen on 17:25, 19. Apr 2021
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Need a procedure when a mob attacks the player !
Thu, 07/02/2020 - 12:10

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)

Last seen on 17:25, 19. Apr 2021
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 ! ;)

Last seen on 08:08, 25. Feb 2021
Joined Feb 2021
Points:

User statistics:

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

Thanks man you helped me alot!

Last seen on 05:51, 7. Dec 2021
Joined Jun 2015
Points:

User statistics:

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

Please upload an image.

 

Last seen on 23:42, 30. Mar 2021
Joined Jul 2017
Points:

User statistics:

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

Thank you so much!

Last seen on 03:46, 9. Dec 2021
Joined Mar 2021
Points:

User statistics:

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

thanks, i hope this works...

Last seen on 03:46, 9. Dec 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

 

Last seen on 17:25, 19. Apr 2021
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Here's an image of the…
Mon, 04/19/2021 - 14:00

Here's an image of the procedure if anyone didn't understand :)

https://imgur.com/a/z87NvF2

Last seen on 01:29, 2. Dec 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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