Solved damage entity

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

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

loadka95

Active Member
Feb 24, 2017
78
6
8
26
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_language.skript:
on click with dirt:
    if target entity is monster:
        damage the spider by 3

-------This doesn't work either---
    loop all entity in radius 1 around target:
        if loop-entity is monster:
            damage the loop-entity by 3
 
So you want to change the damage dirt does to a spider, or something like that?

code_language.skript:
on damage:
    attacker is a player
    player is holding dirt
    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.
    victim is a spider
    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
 
Last edited by a moderator:
So you want to change the damage dirt does to a spider, or something like that?

code_language.skript:
on damage:
    attacker is a player
    player is holding dirt
    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.
    victim is a spider
    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
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_language.skript:
on leftclick with steak:
    if player is op:
        if distance between the target and the player is more than 10:
            message "too far"
        else:
            loop all entity in radius 1 around target: 
                if loop-entity is monster: #this line is not working
                    damage the loop-entity by 3
                    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
                    wait 2 tick
                    play sound "ENTITY_VEX_HURT" to player with volume 5 and pitch 3
                    stopEffect id "%player%"
 
I want to create a laser, so when i click with something its fire a laser beam and damage the target entity
Alright.

Your code:
code_language.skript:
on leftclick with steak:
    player's target is set
    player is op:
        distance between the target and the player is more than 10:
            message "too far"
            stop
        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.
        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
        wait 2 tick
        play sound "ENTITY_VEX_HURT" to player with volume 5 and pitch 3
        stopEffect id "%player%"

Working flawlessly on my part.

By the way: Nice idea for a ray gun. I liked it while testing ;D
 
Last edited by a moderator:
  • Like
Reactions: loadka95
Status
Not open for further replies.