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

Topic category: Help with MCreator software

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

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 14:30, 2. Aug 2022
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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