visual effect while wearing armor

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

Raigna

Member
Oct 2, 2017
17
0
0
36
Hi im trying to create a piece of armor that creates a visual effect (villager green sparks etc) around a player that is wearing it, I have got the code below to work with broadcasting a test message but whatever i do to add a visual effect I get told I dont have a world, Could someone tell me how i should finish this skript or give me a example on what I should be doing please, thank you

code_language.skript:
every 5 seconds:
    loop all players:
        if loop-player is wearing an gold chestplate:
            if name of loop-player's chestplate is "&a&lI&2ndependence &a&lC&2loak":

p.s. I also have the mythic mobs addon for skript if that makes it easier, i've had a lot of success in the past in creating special attacks and on hit particle effects
 
You're better off using SharpSK and its armor equip event in the following way:
code_language.skript:
options:

  item-name: <light green><bold>I<green>ndependence <light green><bold>C<green>loak


on armor equip:
  event-item is gold chestplate
  display name of event-item is "{@item-name}"
  set metadata "independence-loak" of player to true

  while player has metadata "independence-loak":
    
    play 10 happy villager on player


on armor unequip:
  event-item is a gold chestplate
  display name of event-item is "{@item-name}"
  delete metadata "independence-loak" of player
 
Does armor equip fire on login? Because if not you'd probably need a login check to start the loop too in case they log in while already wearing the armor. That's why for things like this I tend to outsource the loop into a function and call my start<Whatever>Loop function wherever it should be re-triggered (like login and equip events). Though for a simple loop like this you could probably just repeat the code.
 
Status
Not open for further replies.