Procedure for mob drops when player kill detected

Started by mememem on

Topic category: Help with modding (Java Edition)

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Procedure for mob drops when player kill detected

I am making a mob that is supposed to drop 1-2 diamonds if it got killed by a player, I don't know how to write a procedure for that please help.

Last seen on 21:08, 16. Jun 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is the quickest way I…
Sat, 05/25/2024 - 17:34

This is the quickest way I could think of with procedures. (change pig to your mob and the random chance to desired number)

https://imgur.com/a/m6JCvfU

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried out your procedure…
Sun, 05/26/2024 - 00:15

I tried out your procedure but the mob drop up to 4 diamonds when player killed, I deleted everything in the "else" tail part and that made the mob drop 1-2 each time, with 0 on occasion. The number I was looking for is 100% for one to drop, with 50% for a second one, thanks anyway.

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Update: I was successfully…
Sun, 05/26/2024 - 01:28

Update: I was successfully able to created what I wanted, I modified your procedure and deleted the Targer Entity specification and it worked out fine, I think the field specifically is what caused the problem where the first drop got duplicated. Here is the procedure for those that want to copy.

Last seen on 21:08, 16. Jun 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's strange since I…
Sun, 05/26/2024 - 06:21

That's strange since I tested it 10+ times and always got either 1 diamond or 2 diamonds, never more than 2.
Also the target part was just there since I didn't have a mob that could have it connected to a trigger ( which I am guessing is how you have connected it ) if you did then it probably ran it twice, one for the procedure target and one for the connected trigger

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My workspace is in 1.19.2,…
Mon, 05/27/2024 - 03:13

My workspace is in 1.19.2, so my guess is probably version difference.

This is the procedure, repost it since the forum is deleting our pictures.

https://imgur.com/3GVSeJ4

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also I just want to ask,…
Mon, 05/27/2024 - 04:38

also I just want to ask, about the procedure, now I wanted the mob to have a 10% chance to drop the third diamond, so the drop requirement should be 50% chance to drop one, 40% to drop two and 10% to drop three.

Last seen on 21:08, 16. Jun 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh yeah I can imagine the…
Mon, 05/27/2024 - 05:49

Oh yeah I can imagine the workspace version being an issue since mines a newer one.

This is not mine this is from a discord user. (change the greater and equal/lesser and equal to not have the equals part) 
https://imgur.com/a/0o0tOiz

Last seen on 21:08, 16. Jun 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh and in that the number 80…
Mon, 05/27/2024 - 05:52

Oh and in that the number 80 circled should be 79

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This procedure (https:/…
Mon, 05/27/2024 - 06:37

This procedure (https://imgur.com/a/0o0tOiz) still limit drops to a player kill right? i don't see the source entity as a player.

Last seen on 21:08, 16. Jun 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you'd have to add that part…
Mon, 05/27/2024 - 10:17

you'd have to add that part. That procedure is just something someone made to have a drop chance loot table

Last seen on 03:07, 10. Jun 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I ended up making an…
Mon, 05/27/2024 - 12:15

I ended up making an improvement on the already working mechanic and it now work like a charm.

https://i.imgur.com/vQdO0qh.png