Started by
BobEsBeans
on
Topic category: Help with Minecraft modding (Java Edition)
Okay so I haven't been able to find anything like this, if there is a forum that explains this please link me to it.
So basically,
- I want my mob to spawn at the nearest water source if a player kills a villager. (Not important as of now but would still be helpful)
- Every time the player kills a villager it adds to a global variable. (This is done)
- I want my mob to be able to load chunks near it and path find to the player no matter how far they are away.
- Eventually I want them to path find to whatever player has the highest amount of villager kills.
Now what I've tried to do is make an attack condition in the AI and goals section to do this but what ends up happening is my mob just wanders around like he's not aggroed on the player, if I take the condition off he aggros but then he cant find me after I get so far away. I have the follow and tracking ranges at their max.
Any help on any of these would be extremely helpful!
AI and goals:
Attack Condition:
Behavior:
Attack Condition:
Kill Counter:
Spawn:
Can Spawn:
Edited by BobEsBeans on Mon, 11/10/2025 - 06:47
Okay so now he's peaceful until attacked, but he wasn't not when the villager count is 1 or more. Found out this was because of the checking for the highest count of villager kills blocks (this https://imgur.com/65TZzos). Did I do this part wrong or was I supposed to do something else with the variable? https://imgur.com/MVUSljD
This fixes him not attacking for each kill:
That is because it is checking if they have killed 100 villagers, I think you should default it to 1 instead of 100, also change it to be equal or greater( >=) than, instead of only = so if they go over they still get attacked.
And next you'd need to update that highest kill count when a player goes over it, if they do then replace that highest count, you can do this by creating this procedure
"on player tick"
if their amount_souls > highest_souls
then set highest_souls = amount_souls
Then go back to your "when dexter kills an entity" procedure, and add this inside the first if statement before setting amount_souls= 0
if amount_souls of target entity = highest_souls
set highest_souls = 1
(this will automatically update from the previous procedure to the highest kills so it wont stay 1 for more than 1 tick.)
Hope this helps.
Sorry for getting back to you so late, yes that made the timer work so than you for that as well as all your help so far! The issue I'm having now is that he doesn't swap targets to whoever has the most kills, is there a different block to swap targets? or did I do something wrong? https://imgur.com/mbdP05q
So I assume that would be because of how the highest souls works, I recommend you change it to be a global variable so you don't need to check for what entity it's attached to, but also it might be remembering who it aggroed first, so in the same "dexter kills another entity" procedure just make it set its attack target to "no entity" so it forgets who it is attacking after they are killed, the block should be in the advanced tab.
I cant set the variable to a global world, global map, or global session cause I get this error https://imgur.com/mE8YwOP
I assume this is what you meant right? https://imgur.com/ukOf7G9
Yes that is correct, also the reason for that error is because you coded that variable before when it was a player variable, but now that it is a world variable, checking for a world variable inside a targeted player wouldn't work, so you'd have to click "Do nothing" and then go and delete the old variable and replace it in those 3 procedures, it should be good when it no longer needs a target entity tag.
You can use the link below to find how you would like to store the variable, however I think map is the best fit here.
https://mcreator.net/wiki/variables