If the player damages Structure, attack it

Started by WELLOTHEHERO on Tue, 06/22/2021 - 14:56

Topic category: Help with modding (Java Edition)

Last seen on 09:11, 1. Jul 2021
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If the player damages Structure, attack it
Tue, 06/22/2021 - 14:56

I have a mob I'm making, if the player damages the Structure where this mob is located, I want the mob to attack her, how can I do that?

Last seen on 14:44, 18. Sep 2021
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
There is no way to do this;…
Fri, 07/09/2021 - 15:21

There is no way to do this; MCreator does not provide a way for the game to detect which blocks are part of a custom structure.

Last seen on 12:43, 17. Sep 2021
Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You could try to create…
Mon, 07/19/2021 - 11:48

You could try to create every block as new, and then use "on block destroyed" for every single block Would be  time consuming tho

Last seen on 16:11, 18. Sep 2021
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If you created structure…
Mon, 08/16/2021 - 17:56

If you created structure with only custom blocks (from your mod), you can add command after breaking each, adding effect with range (range should be high enough to reach whole structure). Let's call the effect "structure_break" and give it range of 50 blocks:

effect give @e[distance=..50] your_mod_id:structure_break 3

Then, let's make additional procedure returning true if that effect is applied on mob you want to attack, and put that procedure as "trigger" for this mob to become aggressive ^^
I hope it helps!