Setting 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!

Status
Not open for further replies.

Very Cool Bee

New Member
May 21, 2020
7
1
0
23
Hello, it's a me. Very Cool Bee.
I want to change the damage of an iron sword. By default it's damage is 3 hearts and I want it to be a random number between 2.5 and 3.5 and well I don't really know how to do that.
But maybe you know! :wrong:
 
Hey Very Cool Bee,

You can set damage with:
Code:
set the damage to <damage amount>

More information on this can be found here: http://en.njol.ch/projects/skript/doc/expressions#ExprDamage

To do what you want you should use this code:
Code:
on damage:
  damage type is attack
  attacker's tool is iron sword
  set {_damage} to random integer between 2.5 and 3.5
  set the damage to {_damage}

I hope this helps!
Well it works, but what about the cooldown? I mean wouldn't the pvp with this code work like in 1.8?
 
Status
Not open for further replies.