Solved Creating a custom drops skript

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

DagoDuck

Supporter +
Jun 29, 2020
4
0
1
21
Hello, I'm trying to create a skript, which will add certain items to the drop-table of mobs / blocks.

Version of Skript: 2.5-alpha4
Author: Bensku
Minecraft Version: 1.15.2
Spigot: 1.15.2

This first code is something which worked, but in my opinion it's a little complicated to add a new item.


Code:
on mine:
      if event-block is diamond block:
            drop {variable}
#This is just an example for the dropping part.
command /saveitem:
      trigger:
            if player's name is "Example":
#Thats just to be sure the command can only be used by me/other people I trust (I know, I could use a
#custom permission.)
                  set {variable} to player's tool
#This is for saving any item so I'm able to use
#attributes without skStuff

If I'd be using this, I'd have to add every new item by creating a new command + a new variable.

What I tried to do is adding an argument to the command /saveitem
Code:
command /saveitem <text>:
so I'd be able to create a list of items which would be added by holding the item in my hand and then typing in the custom command.

The code I've got right now isn't even worth showing, but I'll do it anyway:

Code:
command /saveitem <text>:
      trigger:
            if player's name is "Example":
                  set {item} to arg-1
                  set {item} to player's tool
                  add {item} to {itemliste::*}
                  send "&6%arg-1% &bgespeichert" to player
                  wait 1 second
                  delete {item}

It doesn't show any errors, but it's not working either.
I'm pretty much aware of why it's not working but I also don't know how to fix it.
It would be really nice, if someone who's a little bit more experienced in skripting than me could
help me with this issue.

Thanks

Also, sorry for bad grammar, english is not my first language.
 
Last edited:
Hello, I see one error in the code. Your checking for the player name, not the first argument. Here is my version of what you're asking for.
Code:
on mine:
    {drops::*} is set
    player's gamemode is survival
    event-block is diamond block
    chance of 50% # You can add a chance if you want, idk.
    clear drops # Destroys previous drop.
    set {_drop} to a random integer between 1 and (size of {drops::*}) # Picks a random item in list.
    drop {drops::%{_drop}%}    # Drops new item.

command /saveitem:
    trigger:
        player's tool is not air
        add player's tool to {drops::*}

command /clearitems:
    trigger:
        delete {drops::*}
I hope this helps!
 
  • Like
Reactions: DagoDuck
At first, thank you for helping me!

it seems like I haven‘t been specific enough in my request.

I‘m trying to add the drops to a specific block/ mob.

Let‘s say you want a diamond helmet named xyz with lore zyx and enchants to drop on a chance of 0.1% when you kill a cow, but you don‘t want this exact helmet to drop if you are mining a diamond block.

My idea is to add a diamond helmet and a diamond chestplate called „Ghostly Armor“ to drop if you kill a vex, and a golden armor called „Hardened Gold Armor“ to drop upon mining gold ore.

Please correct me, if I‘m the one who is not understanding what’s going on, but in your example it looks like there is only 1 item pool.

Thanks for any answers!
 
My suggestion would be to either expand upon the basic code I sent before or hard code the drops like this for each mob with a specific chance.
Code:
on death:
    victim is pig
    chance of 0.001%
    clear drops
    drop porkchop named "&eLEGENDARY PORK!!!!!"
Edit: Just to clarify, the code that I'm sending is just an example for how the system could work.
 
Status
Not open for further replies.