Skript: strike a player lightning

  • 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 community!

    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!

SuperRedr

New Member
Jul 2, 2023
7
0
1
Suggested name: strike a player lightning for cooldown

Spigot/Skript Version: 1.8.9 and 1.12


What I want:
Star a 10 seconds period where each hit has a 10% of striking lightning.

basically
a item that when u right click it gives a 10% chance of striking the player u are hitting
Dealing 1.5 hearts
lasts 10 seconds

Exemple: 0:42
 
Here's the damage part of your code you'd want:
Code:
on damage:
   if {lightning::%attacker%} isn't 0:
      attacker is player
      victim is player
      name of player's tool is "&eLightning Test":
         chance of 10%:
         strike lightning effect at the victim
         damage the victim by 1.5
         send "&4[Server] &e&lKaboom&6!!! &eYou just damaged %victim% with &flightning&6!!" to attacker
Here's the right-click portion:
Code:
on right click:
   name of player's tool is "&eLightning Test":
      if {lightning::%player%} isn't 0:
         set {lightning::%attacker%} to 10

every second:
   loop all players:
      if {lightning::%loop-player%} isn't 0:
         remove 1 from {lightning::%loop-player%}

Keep in mind: I did not test this out so there could be a couple inconsistencies with the code I provided!!
 
Here's the damage part of your code you'd want:
Code:
on damage:
   if {lightning::%attacker%} isn't 0:
      attacker is player
      victim is player
      name of player's tool is "&eLightning Test":
         chance of 10%:
         strike lightning effect at the victim
         damage the victim by 1.5
         send "&4[Server] &e&lKaboom&6!!! &eYou just damaged %victim% with &flightning&6!!" to attacker
Here's the right-click portion:
Code:
on right click:
   name of player's tool is "&eLightning Test":
      if {lightning::%player%} isn't 0:
         set {lightning::%attacker%} to 10

every second:
   loop all players:
      if {lightning::%loop-player%} isn't 0:
         remove 1 from {lightning::%loop-player%}

Keep in mind: I did not test this out so there could be a couple inconsistencies with the code I provided!!
1689192134864.png
 
Replace line 14 with "{lightning::%player%}" and line 5 with "name of attacker's tool is "&eLightning Test"". I kinda wrote the code a bit quickly so I looked over those issues; sorry for the mix up.
it works thanks, code give player a item diamond sword
 
[20:21:27 WARN]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (Lightning hammer.sk, line 6: chance of 10%:')
Make sure to add 1 extra indentation after line 6 like:

chance of 10%:
strike lightning effect at victim
 
[20:21:27 WARN]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (Lightning hammer.sk, line 6: chance of 10%:')
Forgot to format it properly, I edited it to be more accurate now.