How can i make a living entity apply a custom effect by hitting the player?

Started by draggo on

Topic category: Help with modding (Java Edition)

Last seen on 21:37, 14. Nov 2023
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can i make a living entity apply a custom effect by hitting the player?

Ive tried many ways and tried to find help i cant seem to find any info on it if anyone knows please help out

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a procedure with the…
Tue, 11/14/2023 - 20:44

Make a procedure with the global trigger 'before entity is hurt.' In that procedure, use an if bracket to check that the event/target entity, (the one being hurt), is a player, and the source entity, (the one attacking), is the desired type of mob. (You can do this using the 'is entity subtype of ' function in the logic tab.) Then, inside the if bracket, use the 'apply potion effect' function to apply your custom effect to the event/target entity.

Last seen on 21:37, 14. Nov 2023
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i make a apply potion…
Tue, 11/14/2023 - 20:56

how do i make a apply potion effect function?

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you make a procedure, you…
Tue, 11/14/2023 - 23:17

If you make a procedure, you can find the 'apply potion effect' function in the 'entity management' tab. It's a blue code-block that asks for an entity, a duration, and a potion effect, and applies the effect to the entity you provide it with.

If you're really new to making procedures, it may be worth looking into some of NorthWestTree's tutorials on youtube to get a better idea of how they work.