How to make a player take less damage?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Vini

Member
Apr 8, 2023
27
2
3
24
So, I've been trying to make a skript where a player takes less damage depending on how much their
{presistance::%attacker's uuid%} is (1 is the least and 20 is the most)
Now I've tried many different codes but the best I've came up with is this:

code_language.skript:
on damage:
    if victim is a player:
        if {presistance::%attacker's uuid%} is {presistance::%attacker's uuid%}:
            decrease damage by {presistance::%attacker's uuid%}*0.15
This code is bad, because it doesn't actually work, even thought I tested it with players, mobs, void etc.
I would be very grateful if someone helped me fix this issue.
Thank you!
 
this should work!
Code:
on damage of a player:
    if attacker is a player:
        if {presistance::%attacker's uuid%} is set:
            set damage to damage - {presistance::%attacker's uuid%}*0.15

also i think you meant "persistance" not "presistance"
 
Fixed your typo.
Use by player
Changed attacker to victim since that's what you meant.
Idk what you wanted to do with *0.15, so I made a formula that makes it so if the victim's persistance is 20 they'll take no damage and if it's 1 they'll take the full damage.

Code:
on damage of player by player:
  {persistance::%victim's uuid%}
  reduce damage by floor(((21-{presistance::%victim's uuid%})*5)% of damage)
 
Fixed your typo.
Use by player
Changed attacker to victim since that's what you meant.
Idk what you wanted to do with *0.15, so I made a formula that makes it so if the victim's persistance is 20 they'll take no damage and if it's 1 they'll take the full damage.

Code:
on damage of player by player:
  {persistance::%victim's uuid%}
  reduce damage by floor(((21-{presistance::%victim's uuid%})*5)% of damage)
Tank you, but does they take no damage mean they don't take damage even with a sharp 255 sword?
 
Tank you, but does they take no damage mean they don't take damage even with a sharp 255 sword?
pretty much, if you want SOME damage to be done even if it's maxed then just change the 21 to a 20, basically makes it so the max damage nullification is 95%