i want to make an iron golem drop an item only when its killed by a hostile mob, how do i do that

Started by LeftyAtHeart on Sun, 10/04/2020 - 16:50

Topic category: Help with MCreator software

Last seen on 19:12, 4. Oct 2020
Joined Oct 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i want to make an iron golem drop an item only when its killed by a hostile mob, how do i do that
Sun, 10/04/2020 - 16:50

my mod is about avenging your iron golem friends, where basically when they die, they drop an item you can combine with iron armor or weapons, and they become golem weapons/armor, i have a script where it drops the item, but it drops it whenever its killed, what is a script to make it drop only when its killed by a zombie, skeleton, spider, or a few others?

 

Last seen on 11:10, 23. Nov 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If you use the global …
Sat, 10/10/2020 - 12:56

If you use the global "entity dies" trigger it gives you the entity that died as the "Event/target Entity" and the entity that killed it as the "Source Entity". You just need to check if the "Event/target Entity" is an Iron Golem and if the "Source Entity" is a zombie, skeleton, spider, or something else, then spawn an item at the provided xyz coordinates.

https://drive.google.com/file/d/1qnFOiQ4jw6Yqe-f90Ct8MvyBB0LZz7kv/view?usp=sharing