1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Enderpearl damage

Discussion in 'Requests' started by iCritiqing, Sep 18, 2017.

  1. iCritiqing

    iCritiqing Member

    Joined:
    Jul 4, 2017
    Messages:
    13
    Likes Received:
    0
    Category: misc

    Suggested name: EpDamage

    What I want:
    I want a skript that can disable/reduce player's enderpearl damage...
    and the reduced damage is corresponding to the given ammoun

    Example:
    An admin type /ep 50 iCritiqing
    then the player iCritiqing will only take 50% of the full enderpearl damage

    An admin type /ep 100 iCritiqing
    the player iCritiqing won't take any damage from enderpearls


    Ideas for commands:
    /ep 25 [Name]
    /ep 50 [Name]
    /ep 75 [Name]
    /ep 100 [Name]

    Ideas for permissions:
    ep.admin > To type the /ep command

    When I'd like it by: A reasonable time
     
  2. Best Answer:
    Post #2 by Lego_freak1999, Sep 20, 2017
  3. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    a bit late but it works (for me).

    Code (Skript):
    1. command /ep <integer=0> <player>:
    2.     trigger:
    3.         if arg 1 >= 0:
    4.             if arg 1 <= 100:
    5.                 set {ep.reduction::%uuid of arg 2%} to arg 1
    6.                
    7. on damage:
    8.     if damage cause is fall:
    9.         cancel event
    10.         wait 1 tick
    11.         if {enderpearl::%uuid of victim%} is set:
    12.             set {_calc} to {ep.reduction::%uuid of victim%}
    13.             if {ep.reduction::%uuid of victim%} is not set:
    14.                 set {_calc} to 0
    15.             set {_dam} to damage / 100
    16.             set {_dam} to {_dam} * {_calc}
    17.             set {_dam} to damage - {_dam}
    18.             damage victim by {_dam}
    19.         else:
    20.             damage victim by damage
    21.  
    22. on script load:
    23.     delete {enderpearl::*}
    24.  
    25. on projectile hit:
    26.     if event-entity is a ender pearl:  
    27.         set {enderpearl::%uuid of shooter%} to true
    28.         wait 1 tick
    29.         delete {enderpearl::%uuid of shooter%}
     
  4. iCritiqing

    iCritiqing Member

    Joined:
    Jul 4, 2017
    Messages:
    13
    Likes Received:
    0
    Thanks Bro :emoji_grinning:
    It works nicely
    but i improoved it a bit tho, and by the way you forgot the permissions thinggy :emoji_grinning:

    Here's my edit
    Code (Skript):
    1. options:
    2.     Prefix: &c&lSoul&fStars &7&l>>
    3.     Maincolor: &6
    4.     Secondcolor: &7
    5.     Red: &c
    6.  
    7. command /ep <integer=0> <player>:
    8.     permission: ep.admin
    9.     trigger:
    10.         if arg 2 is not set:
    11.             message "{@Prefix} {@Maincolor}Usage /ep <integer> <name>"
    12.         else:
    13.             if arg 1 >= 0:
    14.                 if arg 1 <= 100:
    15.                     set {ep.reduction::%uuid of arg 2%} to arg 1
    16.                     message "{@Prefix} {@Secondcolor}%arg 2%'s {@Maincolor}enderpearl damage has been reduced by {@Red}%arg 1% {@Maincolor}percent"
    17.                     message "{@Prefix} {@Maincolor}Your enderpearl damage has been reduced by {@Red}%arg 1% {@Maincolor}percent" to arg 2
    18.                 if arg 1 > 100:
    19.                     message "{@Prefix} {@Red}ERROR! Enderpearl damage reduction values must be bigger than -1 and smaller than 101!"
    20.              
    21. on damage:
    22.     if damage cause is fall:
    23.         cancel event
    24.         wait 0.005 tick
    25.         if {enderpearl::%uuid of victim%} is set:
    26.             set {_calc} to {ep.reduction::%uuid of victim%}
    27.             if {ep.reduction::%uuid of victim%} is not set:
    28.                 set {_calc} to 0
    29.             set {_dam} to damage / 100
    30.             set {_dam} to {_dam} * {_calc}
    31.             set {_dam} to damage - {_dam}
    32.             damage victim by {_dam}
    33.         else:
    34.             damage victim by damage
    35.  
    36. on script load:
    37.     delete {enderpearl::*}
    38.  
    39. on projectile hit:
    40.     if event-entity is a ender pearl:
    41.         set {enderpearl::%uuid of shooter%} to true  
    42.         wait 0.005 tick
    43.         delete {enderpearl::%uuid of shooter%}
    44.        
    45.        
    46. #Originaly created by: Lego_freak1999
    47. #Edited by: iCritiqing
     
    #3 iCritiqing, Sep 21, 2017
    Last edited: Sep 21, 2017

Share This Page

Loading...