Started by
Xargnif
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a mob that have a chance to spawn by killing other mobs but I don't want it to spawn every time a mob is killed and not when it is killed, my ultimate goal is for them to only spawn when a certain weapon is used, I also want them to have a low chance to drop an item.
Here's how you would do it:
(If it's not loading in mcreator, try clicking on it)
I put different variables in than you probably would be looking for. In general, substitute:
The value '10' in the pick random integer to how rare you want to item to be to be dropped. (If you want it in a percentage, divide the first value [1] by the second value [whatever you want], and then multiply it by 100 to get the percentage. For example, 1 / 10 = 0.1. 0.1 * 100 = 10%)
I hope this answers your question!
It seems like the image is not working. I'll try explaining the code in text form then.
Global trigger [Entity dies]
If ((is [Event/target Entity] (sub)type [Cow]) AND (Item in main hand of [Source entity] = Iron sword))
Spawn entity [Pig] at [x], [y], [z]
Else if is ((is [Event/target Entity] (sub)type [Pig]) AND (Random integer between min: [1] and max: [10] included = 1))
Spawn dropped item [Diamond] at [x], [y], [z] pickup delay: [10] despawn: [true]