1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Creating a custom drops skript

Discussion in 'Skript' started by DagoDuck, Jun 29, 2020.

  1. DagoDuck

    DagoDuck Member

    Joined:
    Jun 29, 2020
    Messages:
    3
    Likes Received:
    0
    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 (Text):
    1.  
    2. on mine:
    3.       if event-block is diamond block:
    4.             drop {variable}
    5. #This is just an example for the dropping part.
    6. command /saveitem:
    7.       trigger:
    8.             if player's name is "Example":
    9. #Thats just to be sure the command can only be used by me/other people I trust (I know, I could use a
    10. #custom permission.)
    11.                   set {variable} to player's tool
    12. #This is for saving any item so I'm able to use
    13. #attributes without skStuff
    14.  
    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 (Text):
    1.  
    2. command /saveitem <text>:
    3.  
    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 (Text):
    1.  
    2. command /saveitem <text>:
    3.       trigger:
    4.             if player's name is "Example":
    5.                   set {item} to arg-1
    6.                   set {item} to player's tool
    7.                   add {item} to {itemliste::*}
    8.                   send "&6%arg-1% &bgespeichert" to player
    9.                   wait 1 second
    10.                   delete {item}
    11.  
    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.
     
    #1 DagoDuck, Jun 29, 2020
    Last edited: Jun 29, 2020
  2. Best Answer:
    Post #2 by Baezor, Jul 1, 2020
  3. Baezor

    Baezor Member

    Joined:
    Jan 3, 2020
    Messages:
    14
    Likes Received:
    3
    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 (Text):
    1. on mine:
    2.     {drops::*} is set
    3.     player's gamemode is survival
    4.     event-block is diamond block
    5.     chance of 50% # You can add a chance if you want, idk.
    6.     clear drops # Destroys previous drop.
    7.     set {_drop} to a random integer between 1 and (size of {drops::*}) # Picks a random item in list.
    8.     drop {drops::%{_drop}%}    # Drops new item.
    9.  
    10. command /saveitem:
    11.     trigger:
    12.         player's tool is not air
    13.         add player's tool to {drops::*}
    14.  
    15. command /clearitems:
    16.     trigger:
    17.         delete {drops::*}
    I hope this helps!
     
    • Like Like x 1
  4. DagoDuck

    DagoDuck Member

    Joined:
    Jun 29, 2020
    Messages:
    3
    Likes Received:
    0
    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!
     
  5. Baezor

    Baezor Member

    Joined:
    Jan 3, 2020
    Messages:
    14
    Likes Received:
    3
    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 (Text):
    1. on death:
    2.     victim is pig
    3.     chance of 0.001%
    4.     clear drops
    5.     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.
     
  6. DagoDuck

    DagoDuck Member

    Joined:
    Jun 29, 2020
    Messages:
    3
    Likes Received:
    0
    Alright, thank you!
    I‘ll try that.
     
Loading...