Solved How to make a spell switcher?

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

HypixelsFox

Member
Mar 26, 2021
14
1
3
18
i made a wand that can shoot fireballs and stuff like that but i also want to add a second spell now that strikes lightning but i dont know how to add a spell switcher (i would have the spells switch on right click because the spell is cast on left click) Rn i only have this code but i hope someone can help me with adding it because im fairly new to skript

# permissions: skript.Wand

variables:
{%player%::fireballavalible} = 1

command /wand:
trigger:
player has permission "skript.Wand"
give blaze rod named "&c&lWand" with lore "&kL<reset>" to player

on left click:
if held item is blaze rod:
if lore of item contains "&kL":
if {%player%::fireballavalible} = 1:
shoot fireball
set {%player%::fireballavalible} to 0
wait 3 seconds
set {%player%::fireballavalible} to 1

on projectile collide:
damage entity by 1.5
 
Code:
command /wand:
 permission: skript.wand
 permission message: "You cannot do that"
 trigger:
  give blaze rod named "&c&lWand" with lore "&kL" to player
 
on left click:
 if player's held item is a blaze rod named "&c&lWand" with lore "&kL":
  if {%player%.selectedSpell} is "fireball":
   if {%player%.canfireball} is 1:
    shoot a fireball
    set {%player%.canfireball} to 0
    wait 3 seconds
    set {%player%.canfireball} to 1
  if {%player%.selectedSpell} is "lightning":
   if {%player%.canLightning} is 1:
    strike lightning at location of player
    set {%player%.canLightning} to 0
    wait 3 seconds
    set {%player%.canLightning} to 1

on right click:
 if player is holding a blaze rod named "&c&lWand" with lore "&kL":
  if {%player%.selectedSpell} is "lightning":
   set {%player%.selectedSpell} to "fireball"
  if {%player%.selectedSpell} is "fireball":
   set {%player%.selectedSpell} to "lightning"

This should work, and it should also be pretty easy if you want to add more spells
 
Status
Not open for further replies.