X Times a mob was killed [Solved!]

Started by ignDante on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
X Times a mob was killed [Solved!]
Tue, 04/07/2020 - 14:22 (edited)

How can i make it to check how many times this mob was killed, like if you kill Mob Y 100 times summon a mob that drops and item?

Edited by ignDante on Tue, 04/07/2020 - 14:22
Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try this: Make a procedure…
Mon, 04/06/2020 - 16:06

Try this: Make a procedure. In the green thingie, where it says "No additional trigger" scroll down to "Entity kills Entity". Then go to "Logic and loops" and select "If do" statement. Go to Entity procedures and select "Is Current entity a subtype of..." and place it on the if part of the previous statement. change the subtype for the one of the mob you want. 

Either make a local variable (left corner of the procedure screen) or a global one (you have to return to the workspace, then go to the global variables tab, right side bellow the Mod elements and resources). I think the global one would work better, but it might not appear if you create it after you have started with the procedure (save it, close it, and reopen it after you have made the variable). Make the variable a number, not logic or string.  

Go back to the procedure, and in the If/do statement, place set variable of the variable you made, in the do part. Then go to math and select the one that says "space + space". Place "get variable"  and place if in one of the spaces, and go to Minecraft components to add the box with a 0. Change the number to 1 and place t on the other space. Then place that whole "get variable + 1" in the puzzle thingie of the set variable. 

All this do is that after an enemy of said type is killed, it adds 1 to a variable.

Now add another if/do statement under the previous one. From logic operations, select the one that is "space = space" of the same color of your variable, and place if on the if part. Go for another "get variable" and place it in once of the squares. change the = to a >.  and select another 0 box, place it on the other square, and change it to the number of monsters you want to be killed before the other is summoned. 

Now, in the do part, place "Spawn... entity" (found in world management) and change it to the entity you want to appear. You can play with the coordinates by changing the letters for something like X+1. (Y is height, X and Z are horizontals).

And there it is. NOTE: I'm doing this from memory, you might need to tweek it a bit. Also, this works for single player, but if you are going for multiplayer, it will not distinguish who kills the mob, just that the mob is killed. The characteristics of the mob are another topic, you can either set them when you make them, or place another procedure when said enemy is killed. 

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I got another solution,…
Tue, 04/07/2020 - 14:22

I got another solution, using Variables and its so easy but thanks anyway.