Started by
ErnBEY
on
Topic category: Help with Minecraft modding (Java Edition)
How can I make it so that when we hit an object or a person, it gives an effect, and then when we hit it again, it deletes the effect?
Topic category: Help with Minecraft modding (Java Edition)
How can I make it so that when we hit an object or a person, it gives an effect, and then when we hit it again, it deletes the effect?
Try something like this:
Replace the spear with your custom item, and the potion effect with the potion effect you want. (You can also change the potion particles to true, if you want bubbles around the target.) This procedure will trigger when an entity attacks, check if the item in their main hand is your custom item, then check if they already have a potion effect. If they already have the effect, it removes the effect. If they don't already have the effect, it adds the effect.
dont work :(
Did you set the global trigger to "Entity Attacked?" Also make sure you're using 'source entity' for the first part, not 'event/target entity.' I have tested this on my end. I recommend checking again.
All is correct, but I set the procedure as when living entity is hit with tool in my item, and it does not work.
So it gives an error.
When I select source entity it gives an error.
If you're running the procedure using "when living entity is hit with item," you could try doing it like this instead:
I do not know why you are getting an error, as the first example should still work if you are running it through "when living entity is hit with item," but this version should be simpler, if you want to do it this way.
bu sefer effect bana geliyo
This time the effect is coming to me.
Weird. Try replacing "event/target entity" with "source entity." It is possible they are switched for this trigger. (If this is true, then 'source entity' is the entity the item is hitting, and 'event/target entity' is still the entity holding the item.)
Once I solved it, I need to transfer it to MOB, how do I do it? So effects should go to moba.
And I do this with the execute command. Is it valid? I have to do it that way.
‘Entity’ includes mobs, animals, and players, so it should work for mobs. If you want to this with a command, instead of with the item, you would need to be more specific about which entity you are targeting.
I don't understand anything, what can I do?