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 damage entity

Discussion in 'Skript' started by loadka95, Apr 26, 2017.

Thread Status:
Not open for further replies.
  1. loadka95

    loadka95 Active Member

    Joined:
    Feb 24, 2017
    Messages:
    78
    Likes Received:
    6
    None of them is working and I have no idea why. No error message!
    I tried to replace the "monster" with "spider", but it does not worked :/

    Code (Skript):
    1. on click with dirt:
    2.     if target entity is monster:
    3.         damage the spider by 3
    4.  
    5. -------This doesn't work either---
    6.     loop all entity in radius 1 around target:
    7.         if loop-entity is monster:
    8.             damage the loop-entity by 3


     
  2. Best Answer:
    Post #4 by ShaneBee, Apr 26, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    So you want to change the damage dirt does to a spider, or something like that?

    Code (Skript):
    1. on damage:
    2.     attacker is a player
    3.     player is holding dirt
    4.     name of player's tool is "name" #do you want it to be an specific dirt with a custom name? if not, remove this line.
    5.     victim is a spider
    6.     damage the attacked spider by 3 hearts #If I remember correctly, it won't change the original attacker and will count as if the player killed the spider if it dies by this damage. I'm still not sure.
    Edit: Edited code a bit
     
    #2 ShaneBee, Apr 26, 2017
    Last edited by a moderator: Apr 26, 2017
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I want to create a laser, so when i click with something its fire a laser beam and damage the target entity
    Full code:
    Code (Skript):
    1. on leftclick with steak:
    2.     if player is op:
    3.         if distance between the target and the player is more than 10:
    4.             message "too far"
    5.         else:
    6.             loop all entity in radius 1 around target:
    7.                 if loop-entity is monster: #this line is not working
    8.                     damage the loop-entity by 3
    9.                     drawLine particle redstone, center player, target location of target, id "%player%", rainbowMode true, solid true, density 20, length 10, zigZag count 0, height 0, visibleRange 32, displacementXYZ 0, 1.3, 0, pulseDelay 1
    10.                     wait 2 tick
    11.                     play sound "ENTITY_VEX_HURT" to player with volume 5 and pitch 3
    12.                     stopEffect id "%player%"
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Alright.

    Your code:
    Code (Skript):
    1. on leftclick with steak:
    2.     player's target is set
    3.     player is op:
    4.         distance between the target and the player is more than 10:
    5.             message "too far"
    6.             stop
    7.         make the player damage target by 3 #SkQuery. Without this expression, kills won't be assigned to the player who used the ray gun. If you dont care, remove the first three words and you have a normal Skript expression.
    8.         drawLine particle redstone, center player, target location of target, id "%player%", rainbowMode true, solid true, density 20, length 10, zigZag count 0, height 0, visibleRange 32, displacementXYZ 0, 1.3, 0, pulseDelay 1
    9.         wait 2 tick
    10.         play sound "ENTITY_VEX_HURT" to player with volume 5 and pitch 3
    11.         stopEffect id "%player%"
    Working flawlessly on my part.

    By the way: Nice idea for a ray gun. I liked it while testing ;D
     
    #4 ShaneBee, Apr 26, 2017
    Last edited by a moderator: Apr 26, 2017
    loadka95 likes this.
Thread Status:
Not open for further replies.

Share This Page

Loading...