Started by
Ro...
on
Topic category: Help with Minecraft modding (Java Edition)
How could i make a defence statistique, that can be upgraded, and will act like this: When the Player is Attacked, if the opponent have 200 of Damage, and the Player 400 Health, the opponant can 2 shot him, so The Damage stats of the player, is substracted to the Player's Defence points, and then, the number that it gives, is the number of HP the Player will lose, if it gives a negative number(mean the Defence is lower than Damage) like: 20-41=-21, do Damage + 21.
Anyone?!?
not possible without code
you could make a defense nbt tag and before damage heal the player by the defense, if the number is negative set it to attack
Thank You to replying, hmm, how can i do that, can you explain me please!?
Yeah, that explanation sounds a little bit confusing but it also sounds like it could work, could you explain better?
You can totally do this with an NBT tag as eggnirmoll said. Just set the Number NBT to the affected entity and then with the Global Trigger "Entity Attacked" use the "amount" dependency located in the right-down corner. Just double-click the amount dependency, and it will set a block with that dependency on screen to use. This has stored the damage received before its applied to the attacked entity. Just do "Set health of provided entity to [amount - (DefenseNBT)]"
That should work, i can maybe try it myself as i'm creating accesories that reduce damage taken. If it works with that, it would definetely work with an NBT in the middle
Did it work? I'm attempting this
Any updates guys?
https://www.youtube.com/watch?v=Y-T8_hzi3yw try this