Topic category: Feature requests and ideas for MCreator
So, we all know some people like to use their mods in Multiplayer. This feature that I'm requesting works both ways, Single Player and Multiplayer. For the purpose of my mod, I need to know how much damage a mob or player deals and subtract a few points off of that based on how many points of something the player has. (I'm sorry if this is really easy to do with code or something because I couldn't figure it out) It could be something like, "Get Attacker Damage". That would work because I could get the Math block and do: "Get Attacker Damage" minus "Get Defense Points". (Defense points are the number that decides how many points are taken off the incoming attack. This would be an AMAZING feature to have, thanks!
Hi! Did you solve this?
I did not sadly. If anyone has any ideas, please help.
I think global trigger provides a dependency amount that you can use to determine damage. Then just check if the target entity is of type player.
How should i use the "amount" dependency in the Entity Attacked trigger, i found it but i don't know how to actually use it properly
Amount just specifies how much damage the entity takes. Use just like a regular number.
I wasn't able to find a method of simply doing this within MCreator's procedure blocks, so I went in and did it by code, which took me way longer to figure out than it should have. For anyone wondering, here's how I got this set up:
This code was set up with 1.19.2 for either the LivingAttackEvent or the LivingHurtEvent - https://imgur.com/SojlZ2Y
You can make a procedure with Event Trigger: "Before entity is hurt", then set custom nbt nuber tag with (for example) name prior health, set prior health to current health and wait one tick, then subtract the current health from prior health.
I already tested it, it works