Started by
SirBadger
on
Topic category: Help with modding (Java Edition)
I'm trying to give the player an achievement for killing a certain mob, but it's not working. Does this not work anymore? I looked up multiple guides and they all have the "Add achievement to provided (entity)player" and I have "Add achievement to Event/target entity" which isn't working for me. I know this is a version thing but what do I do to make it work in my version? Thanks a lot!
Should be pretty simple. Have it so under the mobs "When entity dies" trigger, have the "Add advancement to ____".
Replace the Event/target Entity with Source Entity, and you should be good. You could also add some other things to it, but these are the basics.
I have the event trigger under when entity dies, and under that is "Add achievement to source entity" with my achievement after it, but when I kill my mob nothing happens. The achievement is under the advancements tab but I'm not able to get it. Do you know anything that can cause issues with stuff like this?
I could've gotten something wrong. But the only thing I can think of right now is perhaps you already have the advancement? You can use commands to get rid of it if you do. Such would be "/advancement revoke username only mod_id:advancement_name".
If I did get something wrong, there's a chance you could have it under when entity takes damage, and have it check if the mobs HP is less than one. Though, I would assume this would have either the same effect as when entity dies, or not work as well.
Two possible alternatives to giving the player who kills the mob the advancement. Replacing source entity with "get nearest entity at X: Y: Z: of type Player" should give the nearest player the advancement, though, its not as ideal as the actual player who kills the mob may not get it if they are further than another player.
You could also have it work similarly to the advancement the Wither gives from beating it, where the item itself gives the advancement, rather than slaying the Wither.
I don't know what I did, but I remade the mob and the achievement and it works now. Thank you for the help!!
i can't find "when entity dies" trigger in advancement tab, advancement trigger builder
I think they meant for the mob your trying to get the advancement from.
@gxywastaken You have to do that by the entity itself
@GXYwasTaken
the when entity dies is a global trigger, not accually a procedure block, also in the code of the advancement, you have to set it to "Custom Trigger" and make a procedure.