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!

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

trying to set custom drops with percent chance

Discussion in 'Requests' started by Maddude174, Jan 21, 2021.

Tags:
  1. Maddude174

    Maddude174 Member

    Joined:
    Jan 21, 2021
    Messages:
    1
    Likes Received:
    0
    im a complete beginner and this is pretty comlex for me to figure out, so i resigned to finally asking for help.
    my code right now (barebones to test) is compiling successfully, and does occasionally trigger a <null> dropped title, but doesnt actually drop anything.

    for testing purposes, i only have drop set to small bag, but i want it to drop one of these (with a percentage chance per item)

    again, the code *technically* functions; just not as required.

    Code (Text):
    1.  
    2. variables:
    3.   {skull.line.name} = "%{_name}%"
    4.   {skull.line.1} = "&eValue: &a${VALUE}"
    5.  
    6. variables:
    7.     {skulldrop} = true
    8.     {dropchance} = 100
    9.     {smallbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjVmNTIxZGQyMTVhOTU4NjIxYTAwZmMwOGRmYTU1NTIyZTEzODNlNTNmZGM3ODFhOTMxNzY2ZDQ2ZDAyYWMwNyJ9fX0=""}]}}}"
    10.     {fullbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzk1YjhkYWU5NmUzOWE3YjQ3NDU2OTdlZmIxZGU2ODFlNWZkOTRkNzUwYWIwOWNiOWYyM2ZmN2U3MmEyYTMzZSJ9fX0=""}]}}}"
    11.     {amethyst} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk0Yjc1OGNhNzU2NWFhYWVhMjcyZjkyNjExZjY0ODlmYzk3OGVhMTBlYzNhZTRkNmJlMjk4NWMxZjdjYTE3OCJ9fX0=""}]}}}"
    12.     {diamond} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjczYTM2YzU1OTUzYmNkZDU2ZDE5ZWY4YTI0OTk0OTFiNWViZmE0MmY0NGRkMDhjNTg0MjAyMmFjMzhkMjJjZCJ9fX0=""}]}}}"
    13.     {emerald} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzg3YjQ0OWM2MGZhNjE5YWZiNzJkYjhhOGUxZmNmMzczMWUyMzRkNTc2ZTEyMDhmYmRlZDQ0MWEzOGJmMmVmZSJ9fX0=""}]}}}"
    14.     {chest} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhY2ZjNjQzZjYwOGUxNmRlMTkzMzVkZGNhNzFhODI4ZGZiOGRhY2E1NzkzZWI1YmJjYjBjN2QxNTU5MjQ5In19fQ==""}]}}}"
    15.  
    16. on death:
    17.   if victim is zombie, or creeper, or skeleton, or husk:
    18.     set {_drop} to {_smallbag}
    19.     set {_name} to "&6Small Bag of Gold"
    20.  
    21. function dropSkull(v: entity, a: player):
    22.     set {skull.line.name} to "%{name}%"
    23.     set {_name} to "%{skull.line.name}%"
    24.     drop {_skull} named "%{_name}%" with lore "%{_line.1}%" at {_v}'s location
    25.     send action bar "&e%{mob}% &7dropped %{skull.line.name}%" to {_a}
    26.  
     
  2. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    6
    I'm so confused.
    What are you trying to do ?
     
  3. Jakkeren

    Supporter

    Joined:
    Mar 23, 2017
    Messages:
    63
    Likes Received:
    3
    Please elaborate your issue, and what you're trying to accomplish - we can't read your mind.

    There's clearly a lot of issues and un-optimal things in your skript, but we won't be able to help you unless you actually tell us what you're trying to do.
     
    • Agree Agree x 1
  4. cuddlytrap

    cuddlytrap Member

    Joined:
    Dec 18, 2020
    Messages:
    26
    Likes Received:
    0
    i am confused but in the title it said something about chance so i would do like:

    Code (Text):
    1.  
    2. on death:
    3.   if victim is zombie, or creeper, or skeleton, or husk:
    4.     chance of 8%:
    5.       set {_drop} to {_smallbag}
    6.       set {_name} to "&6Small Bag of Gold"
    again, please state what you are actually trying to do if this is now what you were trying to do
     

Share This Page

Loading...