Make Entity give itself a potion effect when hit.

Started by lanto on

Topic category: Help with modding (Java Edition)

Last seen on 22:06, 27. May 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make Entity give itself a potion effect when hit.
Fri, 05/13/2022 - 16:33 (edited)

Hi! I'm trying to make a mob become invisible for a few seconds after receiving damage.

I made the entity run a procedure when hurt, inside the procedure I added effect give @s invisibility 1 1 true but it doesn't do anything. I tried using other commands in its place as a test and they work, so i concluded that the problem is the targeting.

If @s doesn't work, what do i use? 

Edited by lanto on Fri, 05/13/2022 - 16:33
Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity Management tab ->    …
Fri, 05/13/2022 - 17:23

Entity Management tab ->

       Add potion with level [0]  for [60]  ticks to [event/target entity]  type [invisibility]

Last seen on 01:18, 28. Mar 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could also, instead of…
Fri, 05/13/2022 - 21:55

You could also, instead of using a command, in the search bar type → potion and then select the one that says Add potion, and then select the Invisibility effect. The first number is the strength of the potion, which doesn't really matter when it comes to invisibility, and the second number is how long is will last for.

Last seen on 01:18, 28. Mar 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Whoops I didn't see …
Fri, 05/13/2022 - 22:04

Whoops I didn't see @Valirane reply, If you absolutely want to use a command then make sure you use the one thats labeled "Execute command in the name of" under entity managment, if the trigger is "When entity is hurt" make sure to use EventEntity and not SourceEntity.

 

Help