Solved Effect on Hit

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

ChocoAura

Member
Jul 3, 2019
38
0
6
24
Hello, so I would like to make a skript that gives an effect when hit by a certain item

example:

A stone sword called "Wither Sword" that gives wither for 2 seconds every time you get hit by it

I have no clue how to do this, so it would be appreciated if you could help me.
[doublepost=1563724230,1563723873][/doublepost]Another example would be an arrow that causes a special series of events to happen to the target

thanks in advance
 
Use this:
Code:
on damage:
    if name of projectile is "Wither Sword":
        apply wither to victim for 2 seconds

[EDIT]
Line 3 (victim)
 
Use this:
Code:
on damage:
    if name of projectile is "Wither Sword":
        apply wither to victim for 2 seconds

[EDIT]
Line 3 (victim)
A sword isn't a projectile, a projectile = an egg, arrow or snowball
[doublepost=1563740121,1563740040][/doublepost]You would do something like this
code_language.skript:
on damage of a player:
    if attacker is a player:
        if attacker's tool is a stone sword:
            if name of attacker's tool is "Wither Sword":
                apply wither to victim for 2 seconds
 
Ye sorry, I switched the two examples

A sword isn't a projectile, a projectile = an egg, arrow or snowball
[doublepost=1563740121,1563740040][/doublepost]You would do something like this
code_language.skript:
on damage of a player:
    if attacker is a player:
        if attacker's tool is a stone sword:
            if name of attacker's tool is "Wither Sword":
                apply wither to victim for 2 seconds
 
  • on damage of a player:
  • if attacker is a player:
  • if attacker's tool is a stone sword:
  • if name of attacker's tool is "Wither Sword":
  • apply wither to victim for 2 seconds
Thanks for the help, it worked great!

Use this:
Code:
on damage:
    if name of projectile is "Wither Sword":
        apply wither to victim for 2 seconds

[EDIT]
Line 3 (victim)
Would that mean if i named an arrow "Weakness Arrow", i would be able to set it so it applies weakness and slowness by naming the arrow and not the bow?
 
Yes, because if you named the bow it only gives slowness if you left-click someone with it.

"ChocoAura, post: 41782, member: 8243"

Would that mean if i named an arrow "Weakness Arrow", i would be able to set it so it applies weakness and slowness by naming the arrow and not the bow?
[doublepost=1563805433,1563805267][/doublepost]
Code:
on damage:
    if name of projectile is "Slowness Arrow":
        apply slowness to victim for 2 seconds

Yes, because if you named the bow it only gives slowness if you left-click someone with it.
 
Yes, because if you named the bow it only gives slowness if you left-click someone with it.


[doublepost=1563805433,1563805267][/doublepost]
Code:
on damage:
    if name of projectile is "Slowness Arrow":
        apply slowness to victim for 2 seconds
It didn't seem to work, however what i did was:

Code:
on damage of a player:
    if attacker is a player:
        if attacker's tool is a bow:
            if name of attacker's tool is "&fWeakness Bow":
                apply slowness to victim for 10 seconds
                apply weakness to victim for 10 seconds
 
Status
Not open for further replies.