Hello, I am currently having trouble setting a player in a variable to apply an affect to them. I was looking around the forums and didn't see anything that really helped. This might be a quick fix seeing as I only started working with skript a week or so ago, but I wanted to check just in case.
The idea: I am trying to make it so that when a skeleton shoots you , a random number is drawn. If the number is 1, the player is not effected, but if the number is 2, the player has wither 3 applied to them for 8 seconds. I have all of the stuff working except a way to make it so only players are affected by the arrows, and not any mobs in an area. I'm not sure how to identify what player was hit and set their name in a variable so they receive the wither effect. Any help with this would be much appreciated!
Heres my code:
on damage:
projectile exists
projectile is a arrow:
set {_player-hit} to %player%
if {_necroAttack} is 1:
set {_empty} to 1
if {_necroAttack} is 2:
apply potion of wither of tier 3 to {_player-hit}
set {_necroAttack} to random integer between 1 and 2
on skript load:
set {empty} to 0
The idea: I am trying to make it so that when a skeleton shoots you , a random number is drawn. If the number is 1, the player is not effected, but if the number is 2, the player has wither 3 applied to them for 8 seconds. I have all of the stuff working except a way to make it so only players are affected by the arrows, and not any mobs in an area. I'm not sure how to identify what player was hit and set their name in a variable so they receive the wither effect. Any help with this would be much appreciated!
Heres my code:
on damage:
projectile exists
projectile is a arrow:
set {_player-hit} to %player%
if {_necroAttack} is 1:
set {_empty} to 1
if {_necroAttack} is 2:
apply potion of wither of tier 3 to {_player-hit}
set {_necroAttack} to random integer between 1 and 2
on skript load:
set {empty} to 0