Hello all,
I've recently started using Skript and am really stuck with how to do a few things. I'd like to have a script that does the following. (Note that this uses a custom item/handle in the first part which triggers when the item is just right clicked. This works fine and my query isn't related to this, it's just the projectile part I'm confused on).
(When a player right clicks a custom item - provided by another plugin, apply glowing to everyone but the player and then...) For 40 seconds check all arrows fired by the player. If the arrow hits another player, it applies a weakness 1 potion effect. After the 40 seconds the script then stops and the arrows return to normal.
I initially tried using 'loop 40 seconds' but Skript really didn't like that so I wondered if I could do it with a while loop and a variable 'ended' like this:
This does run but doesn't work properly as I know 'target' isn't right. It's almost like I need another event for the second part. But I don't want the projectile part to run before the first custom items part.
Would really appreciate any advice. How do I make something keep occurring for a set amount of time?
Thank you!
I've recently started using Skript and am really stuck with how to do a few things. I'd like to have a script that does the following. (Note that this uses a custom item/handle in the first part which triggers when the item is just right clicked. This works fine and my query isn't related to this, it's just the projectile part I'm confused on).
(When a player right clicks a custom item - provided by another plugin, apply glowing to everyone but the player and then...) For 40 seconds check all arrows fired by the player. If the arrow hits another player, it applies a weakness 1 potion effect. After the 40 seconds the script then stops and the arrows return to normal.
I initially tried using 'loop 40 seconds' but Skript really didn't like that so I wondered if I could do it with a while loop and a variable 'ended' like this:
Code:
on CustomItems handle:
if the action id is "ranger":
remove player's held item from player's inventory
loop all players:
if loop-player is not player:
apply glowing to loop-player for 40 seconds
{ended} = 0
while {ended} is less than 160:
projectile exists
projectile is arrow
apply weakness 1 to target for 15 seconds
add 1 to {ended}
wait for 0.25 seconds
This does run but doesn't work properly as I know 'target' isn't right. It's almost like I need another event for the second part. But I don't want the projectile part to run before the first custom items part.
Would really appreciate any advice. How do I make something keep occurring for a set amount of time?
Thank you!