Spawning mobs with dyed leather 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!

Sep 13, 2023
18
1
3
14
Hey, so I wanted to spawn a mob with dyed leather armor. I've tried many different ways but it just won't work. Here is my code, please help me dye the armor black.
Code:
on right click:
    if name of player's held item is "&aAncient Tome":
        if {undeadmagecount} is less than 1:
            remove 1 book named "&aAncient Tome" from player's inventory
            add 1 to {undeadmagecount}
            spawn 1 skeleton at player
            set max health of last spawned entity to 75
            set health of last spawned entity to 75
            set held item of last spawned entity to bone of sharpness 10
            set offhand item of last spawned entity to book of mending 1
            set helmet of last spawned entity to air
            set chestplate of last spawned entity to leather chestplate
            set leggings of last spawned entity to leather leggings
            set boots of last spawned entity to leather boots
            set display name of last spawned entity to "&7[Lv10] &4&lUndead Mage &c75&7/&c75"
 
Oh, and if possible, can you also tell me how to put armor trims on the armor? If it's not possible it's fine, the main thing is the dye.
 
Oh, and if possible, can you also tell me how to put armor trims on the armor? If it's not possible it's fine, the main thing is the d
Easy.

Code:
set {_chestplate} to leather chestplate
dye {_chestplate} (255, 0, 0)
set chestplate of last spawned entity to {_chestplate}

I did not check for errors at all.
 
Works perfectly, thanks! Is there a way to add armor trims though?
You would need SkBee for this. If you don't know that it is, it is a skript addon. I personally do not use addons, but if you use skunity docs, it's incredibly simple.
 
I've tried this many times and it doesn't work. Skript doesn't say that there's any errors, but it doesn't give the mob an armor trim either.
Code:
on right click:
    if name of player's held item is "&aAncient Tome":
        if {undeadmagecount} is less than 1:
            remove 1 book named "&aAncient Tome" from player's inventory
            add 1 to {undeadmagecount}
            spawn 1 skeleton at player
            set {undeadmage} to last spawned entity
            set max health of {undeadmage} to 75
            set health of {undeadmage} to 75
            set held item of {undeadmage} to bone of sharpness 10
            set offhand item of {undeadmage} to book of mending 1
            set helmet of {undeadmage} to air
            set {_dyearmor} to leather chestplate
            dye {_dyearmor} black
            set chestplate of {undeadmage} to {_dyearmor}
            set armor trim of {undeadmage}'s chestplate to armor trim from amethyst_material with ward_pattern
            set {_dyearmor} to leather leggings
            dye {_dyearmor} black
            set leggings of {undeadmage} to {_dyearmor}
            set {_dyearmor} to leather boots
            dye {_dyearmor} black
            set boots of {undeadmage} to {_dyearmor}
            set display name of {undeadmage} to "&7[Lv10] &4&lUndead Mage &c75&7/&c75"

I also made sure that the skbee version I was using was correct, and it was.
 
I've tried this many times and it doesn't work. Skript doesn't say that there's any errors, but it doesn't give the mob an armor trim either.
Code:
on right click:
    if name of player's held item is "&aAncient Tome":
        if {undeadmagecount} is less than 1:
            remove 1 book named "&aAncient Tome" from player's inventory
            add 1 to {undeadmagecount}
            spawn 1 skeleton at player
            set {undeadmage} to last spawned entity
            set max health of {undeadmage} to 75
            set health of {undeadmage} to 75
            set held item of {undeadmage} to bone of sharpness 10
            set offhand item of {undeadmage} to book of mending 1
            set helmet of {undeadmage} to air
            set {_dyearmor} to leather chestplate
            dye {_dyearmor} black
            set chestplate of {undeadmage} to {_dyearmor}
            set armor trim of {undeadmage}'s chestplate to armor trim from amethyst_material with ward_pattern
            set {_dyearmor} to leather leggings
            dye {_dyearmor} black
            set leggings of {undeadmage} to {_dyearmor}
            set {_dyearmor} to leather boots
            dye {_dyearmor} black
            set boots of {undeadmage} to {_dyearmor}
            set display name of {undeadmage} to "&7[Lv10] &4&lUndead Mage &c75&7/&c75"

I also made sure that the skbee version I was using was correct, and it was.
Honestly, just stick to RGB. It's easy to do, just look it up on Google or something. Also, I'd recommend using different variables for each armor piece. Sorry I responded so late btw.
 
Also just wanted to say, thank you so much for the help, it really helps a lot!
I try my best. I'm usually on every single day of the week (I have a huge addiction to this site), and so while I'm on I try to help as much people as possible. Another reason I'm on this site is because of the very convenient parser which allows me to check my code even when I don't have my laptop with me, which is incredibly useful since I don't have my laptop with me.
But yeah, this site is great for all skript purposes, and I'm glad I found this site since it allows me to help people.

I just wrote a whole essay lmao

P.S. I also do skript requests (even though I suck a skripting and my first attempt at a request took me 4 tries), so if you need something done other than a gui (because I hate those), you can just ask. I don't use addons though, bc for me it seems like a bad idea to rely on something unreliable.
 
Honestly, just stick to RGB. It's easy to do, just look it up on Google or something. Also, I'd recommend using different variables for each armor piece. Sorry I responded so late btw.
Oh, that's not what i meant, the dyed leather armor works perfectly, its the armor trim that isn't working. Thank you so much for helping though!
 
Oh, that's not what i meant, the dyed leather armor works perfectly, its the armor trim that isn't working. Thank you so much for helping though!
Oh, then idk how to help since I don't use SkBee, lol. I might do some more research Abt it after I'm done helping someone else, though.
 
Alright, thanks! Also I just wanted to ask how do you stop a script? Basically I'm trying to make the boss spawn mobs, but when it dies the "while" loop still runs one last time. How do I stop a specific script? I just need to stop the loop if the boss dies.
Code:
on right click:
    if name of player's held item is "&aAncient Tome":
        wait 5 seconds
        while {undeadmagecount} is 1:
            wait 15 seconds
            spawn 1 skeleton at {undeadmage}
            set {mageminion} to last spawned entity
            set max health of {mageminion} to 10
            set health of {mageminion} to 10
            set held item of {mageminion} to bone
            set helmet of {mageminion} to air
            set chestplate of {mageminion} to air
            set leggings of {mageminion} to air
            set boots of {mageminion} to air
            set {mageminion}'s display name to "&7[Lv1] &5Mage Minion &c10&7/&c10"
            make 10 of witch particle at {mageminion} with offset vector(0.5, 0.5, 0.5)
 
Alright, thanks! Also I just wanted to ask how do you stop a script? Basically I'm trying to make the boss spawn mobs, but when it dies the "while" loop still runs one last time. How do I stop a specific script? I just need to stop the loop if the boss dies.
Code:
on right click:
    if name of player's held item is "&aAncient Tome":
        wait 5 seconds
        while {undeadmagecount} is 1:
            wait 15 seconds
            spawn 1 skeleton at {undeadmage}
            set {mageminion} to last spawned entity
            set max health of {mageminion} to 10
            set health of {mageminion} to 10
            set held item of {mageminion} to bone
            set helmet of {mageminion} to air
            set chestplate of {mageminion} to air
            set leggings of {mageminion} to air
            set boots of {mageminion} to air
            set {mageminion}'s display name to "&7[Lv1] &5Mage Minion &c10&7/&c10"
            make 10 of witch particle at {mageminion} with offset vector(0.5, 0.5, 0.5)
Use exit loop . Kinda simple, lol.
 
If that doesn't work, the you might have to rewrite the whole code...
 
Also can you tell me why this isn't working? Trying to make it spawn somewhere random around the boss but not in it
Code:
            loop blocks in radius 2 around {undeadmage}:
                if loop-block is not {undeadmage}'s location:
                    spawn 1 skeleton at loop-block