Skript Help - Shotgun Skript With Distance

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

Status
Not open for further replies.

Narfic

Member
Aug 2, 2020
1
0
1
Hello, I am Narfic. I was working on a script to make a shotgun and wanted the distance to between the victim and shooter to correlate to the amount of hearts the victim took. (Also: The indentation is correct the forum just makes it all go to the left I believe.)
Code:
on damage:
    if event-projectile is arrow:
        if {power.%shooter%} = 3:
            set {_loc.%victim%} to location of block at location of victim
            wait 1 tick
            if distance between the shooter and {_loc.%victim%} is smaller than 3:
                damage victim by 6 hearts
            else if distance between the shooter and {_loc.%victim%} is smaller than 6:
                damage victim by 4 hearts
            else if distance between the shooter and {_loc.%victim%} is smaller than 9:
                damage victim by 2 hearts
            else:
                damage victim by 0.5 hearts
For some reason, instead of taking damage corresponding to the length the victim only take 0.5 hearts every time. Any information would help, thank you in advanced.
 
Last edited:
Hello, I am Narfic. I was working on a script to make a shotgun and wanted the distance to between the victim and shooter to correlate to the amount of hearts the victim took. (Also: The indentation is correct the forum just makes it all go to the left I believe.)

Here is my current code:


on damage:
if event-projectile is arrow:
if {power.%shooter%} = 3:
set {_loc.%victim%} to location of block at location of victim
wait 1 tick
if distance between the shooter and {_loc.%victim%} is smaller than 3:
damage victim by 6 hearts
else if distance between the shooter and {_loc.%victim%} is smaller than 6:
damage victim by 4 hearts
else if distance between the shooter and {_loc.%victim%} is smaller than 9:
damage victim by 2 hearts
else:
damage victim by 0.5 hearts


For some reason, instead of taking damage corresponding to the length the victim only take 0.5 hearts every time. Any information would help, thank you in advanced.

Code:

Code blocks thanks. Debug too.
 
Status
Not open for further replies.