Execute when holding item with name

  • 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.
if you want the fireball to be spawned about the time they swap to the wand
Code:
on swap hand item:
    wait 1 second
    if player's tool is stick named "Wand":
        spawn fireball
        push last spawned fireball in direction of player at speed 1
if you want the fireball to be spawned when player right clicks holding wand
Code:
on right click:
    if player's tool is stick named "Wand":
        spawn fireball
        push last spawned fireball in direction of player at speed 1
 
Try

Code:
On right click with stick:
 if name of tool of player is "Wand":
  spawn fireball at location of player
 
I will try that, thanks!


Edit: It did work, thank you guys so much!
[doublepost=1580309981,1580308268][/doublepost]I do have one extra question though, can you put a cooldown on someting like this? If so, how would you do it then?
 
You can use this expression:
Code:
(wait|halt) [for] %timespan%

Here is it in action with 5s cooldown
Code:
on right click:
    if player's tool is stick named "Wand":
        spawn fireball
        push last spawned fireball in direction of player at speed 1
        wait 5 seconds
 
Thank you for the suggestion but I tried it and it doesn't seem to work...
 
Last edited:
You can try this
Code:
command youwontfindthiscmdname:
    cooldown: .05 minutes
    cooldown message: &cWait until you can use this ability again!
    trigger:
        spawn fireball
        push last spawned fireball in direction of player at speed 1.5
on right click:
    if player's tool is stick named "Wand":
        make player execute command "youwontfindthiscmdname"
 
Status
Not open for further replies.