How do I change chance values for custom mobs

Started by Xargnif on

Topic category: Help with modding (Java Edition)

Last seen on 05:15, 1. May 2024
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I change chance values for custom mobs

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.

Last seen on 23:28, 4. May 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here's how you would do it: …
Thu, 04/25/2024 - 00:12

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:

  • 'Cow' for the entity the spawns the custom mob.
  • 'Pig' for the custom mob that gets spawned.
  • The iron sword for the weapon needed to spawn the mob.
  • The diamond for the item dropped
  • 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!

Last seen on 23:28, 4. May 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It seems like the image is…
Thu, 04/25/2024 - 00:19

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]