How can make a kill with specific weapon event?

How can I make an event where there is a condition if X kills Y with Z weapon? I thought that in the death event I could put an ASM check, if X carries Z in the first place of his inventory, but I don’t know if there is the most efficient way since if the weapon breaks it might not work