marked for death effect

Started by scrumbert on

Topic category: Help with modding (Java Edition)

Last seen on 01:41, 15. Apr 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
marked for death effect

so i was trying to make a new mob that functions like an alarm system and can attack you from a distance and apply a debuff that makes all hostile mobs target you regardless of whether they can see you or not

i was going to make it function by making it a entity tick update that ticks on all hostile mobs that checks for the nearest entity with that effect
the issue is that it only checks for the nearest entity, THEN checks if it has the effect, and i dont want it to only check for players because i want it to be appliable to mobs and cause4 them to be targetted by their own cohorts

if it doesnt work i can just make it only apply to players :(

im gonna go take a nap nowwww 

Last seen on 00:42, 30. May 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yep, this should be possible…
Mon, 04/08/2024 - 10:57

Yep, this should be possible. You will want to use an entity iterator instead of nearest entity though. (This will run code on all entities in a radius, not just the nearest one, and won't crash the game if there aren't any entities nearby.) 

To do this, for your effect's update tick, you will need an entity iterator bracket, with a radius set to however large you want the area of effect to be. Inside the bracket, check if the entity iterator is a living entity. If it is, set the attack target of the entity iterator to the event/target entity. Should be simple as that, and should work for both players and mobs. 

(Might cause issues if multiple entities have the effect though. You might want to also check that the entity iterator isn't already targeting an entity with this potion effect.)

Last seen on 01:41, 15. Apr 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you! however, the…
Mon, 04/08/2024 - 23:08

thank you!

however, the entity this is applied to also targets itself?

if there is a way to exclude the target from being the event entity within the entity iterator bracket

Last seen on 01:41, 15. Apr 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nevermind! i just made it…
Mon, 04/08/2024 - 23:33

nevermind!

i just made it chck if the entity iterator had the effect or not and stopped it if it did
thank you so much!

Last seen on 00:19, 30. May 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have a solution. place the…
Mon, 04/08/2024 - 23:34

I have a solution.

place the check for entity iterator being a living entity into an 'and' block, next, place a 'not' block in the other side of the 'and' block, then add the '=' block that is color coded to work with entity type blocks to the 'not' block. Finally, place event/target entity on one side of the '=' block, and entity iterator on the other.

This whole things checks that event/target entity is not entity iterator, and it can be placed in an and block with the already existing check.