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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved How to apply fixed damage

Discussion in 'Skript' started by Crysta1221, Mar 16, 2022.

Tags:
Thread Status:
Not open for further replies.
  1. Crysta1221

    Crysta1221 Member

    Joined:
    Mar 16, 2022
    Messages:
    4
    Likes Received:
    0
    I'm making a PvP game right now.
    I want to deal fixed damage of 1 heart when the player attacks with an arrow and hits.
    However, I don't know how to deal fixed Heart 1 damage when the arrow hits the player.
    Could you tell me about it?
    Also, please tell me how to eliminate damage other than arrows.
    Thank you.
    --- Double Post Merged, Mar 16, 2022, Original Post Date: Mar 16, 2022 ---
    P.S: Minecraft JE 1.17
    Skript 2.6.1
    SkRayFall 1.9
     
  2. Best Answer:
    Post #2 by Nikd0, Mar 16, 2022
  3. Nikd0

    Nikd0 Active Member

    Joined:
    May 30, 2020
    Messages:
    206
    Likes Received:
    20
    Use the `on projectile hit:` event along with `damage victim by 1 heart`
     
  4. Crysta1221

    Crysta1221 Member

    Joined:
    Mar 16, 2022
    Messages:
    4
    Likes Received:
    0
    I tried it but it didn't work.
    Below is my code.
    Code (Text):
    1. on projectile hit:
    2. projectile is arrow
    3. damage victim by 1 heart
    The amount of damage is not equivalent to one fixed heart, and hitting an arrow from a distance will increase the damage.
    Also, I want to make it impossible to attack other than the attack with the bow and arrow, and when hitting the player with the attack with the bow and arrow, I want to fix the damage to one heart regardless of whether it is far or near.
    The damage is 1 fixed heart, but in the above script, the damage will be increased by 1 heart.
     
  5. ryanrox333

    ryanrox333 Member

    Joined:
    Jul 6, 2019
    Messages:
    17
    Likes Received:
    0
    you can cancel the event using Skript-Reflect and then damage the victim.

    Code (Text):
    1. on projectile hit:
    2.     projectile is arrow
    3.     set {_v} to target
    4.     set {_p} to projectile
    5.     cancel event
    6.     {_v}.damage(1, {_p})
     
  6. Crysta1221

    Crysta1221 Member

    Joined:
    Mar 16, 2022
    Messages:
    4
    Likes Received:
    0
    It doesn't work but it was solved.
    Thank You!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...