trying to set custom drops with percent chance

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

Maddude174

Member
Jan 21, 2021
1
0
1
26
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:
variables:
  {skull.line.name} = "%{_name}%"
  {skull.line.1} = "&eValue: &a${VALUE}"

variables:
    {skulldrop} = true
    {dropchance} = 100
    {smallbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjVmNTIxZGQyMTVhOTU4NjIxYTAwZmMwOGRmYTU1NTIyZTEzODNlNTNmZGM3ODFhOTMxNzY2ZDQ2ZDAyYWMwNyJ9fX0=""}]}}}"
    {fullbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzk1YjhkYWU5NmUzOWE3YjQ3NDU2OTdlZmIxZGU2ODFlNWZkOTRkNzUwYWIwOWNiOWYyM2ZmN2U3MmEyYTMzZSJ9fX0=""}]}}}"
    {amethyst} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk0Yjc1OGNhNzU2NWFhYWVhMjcyZjkyNjExZjY0ODlmYzk3OGVhMTBlYzNhZTRkNmJlMjk4NWMxZjdjYTE3OCJ9fX0=""}]}}}"
    {diamond} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjczYTM2YzU1OTUzYmNkZDU2ZDE5ZWY4YTI0OTk0OTFiNWViZmE0MmY0NGRkMDhjNTg0MjAyMmFjMzhkMjJjZCJ9fX0=""}]}}}"
    {emerald} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzg3YjQ0OWM2MGZhNjE5YWZiNzJkYjhhOGUxZmNmMzczMWUyMzRkNTc2ZTEyMDhmYmRlZDQ0MWEzOGJmMmVmZSJ9fX0=""}]}}}"
    {chest} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhY2ZjNjQzZjYwOGUxNmRlMTkzMzVkZGNhNzFhODI4ZGZiOGRhY2E1NzkzZWI1YmJjYjBjN2QxNTU5MjQ5In19fQ==""}]}}}"

on death:
  if victim is zombie, or creeper, or skeleton, or husk:
    set {_drop} to {_smallbag}
    set {_name} to "&6Small Bag of Gold"

function dropSkull(v: entity, a: player):
    set {skull.line.name} to "%{name}%"
    set {_name} to "%{skull.line.name}%"
    drop {_skull} named "%{_name}%" with lore "%{_line.1}%" at {_v}'s location
    send action bar "&e%{mob}% &7dropped %{skull.line.name}%" to {_a}
 
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:
variables:
  {skull.line.name} = "%{_name}%"
  {skull.line.1} = "&eValue: &a${VALUE}"

variables:
    {skulldrop} = true
    {dropchance} = 100
    {smallbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjVmNTIxZGQyMTVhOTU4NjIxYTAwZmMwOGRmYTU1NTIyZTEzODNlNTNmZGM3ODFhOTMxNzY2ZDQ2ZDAyYWMwNyJ9fX0=""}]}}}"
    {fullbag} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzk1YjhkYWU5NmUzOWE3YjQ3NDU2OTdlZmIxZGU2ODFlNWZkOTRkNzUwYWIwOWNiOWYyM2ZmN2U3MmEyYTMzZSJ9fX0=""}]}}}"
    {amethyst} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk0Yjc1OGNhNzU2NWFhYWVhMjcyZjkyNjExZjY0ODlmYzk3OGVhMTBlYzNhZTRkNmJlMjk4NWMxZjdjYTE3OCJ9fX0=""}]}}}"
    {diamond} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjczYTM2YzU1OTUzYmNkZDU2ZDE5ZWY4YTI0OTk0OTFiNWViZmE0MmY0NGRkMDhjNTg0MjAyMmFjMzhkMjJjZCJ9fX0=""}]}}}"
    {emerald} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzg3YjQ0OWM2MGZhNjE5YWZiNzJkYjhhOGUxZmNmMzczMWUyMzRkNTc2ZTEyMDhmYmRlZDQ0MWEzOGJmMmVmZSJ9fX0=""}]}}}"
    {chest} = "{SkullOwner:{Id:""e1c1a194-7e86-414f-86bb-42d82a21cfb8"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhY2ZjNjQzZjYwOGUxNmRlMTkzMzVkZGNhNzFhODI4ZGZiOGRhY2E1NzkzZWI1YmJjYjBjN2QxNTU5MjQ5In19fQ==""}]}}}"

on death:
  if victim is zombie, or creeper, or skeleton, or husk:
    set {_drop} to {_smallbag}
    set {_name} to "&6Small Bag of Gold"

function dropSkull(v: entity, a: player):
    set {skull.line.name} to "%{name}%"
    set {_name} to "%{skull.line.name}%"
    drop {_skull} named "%{_name}%" with lore "%{_line.1}%" at {_v}'s location
    send action bar "&e%{mob}% &7dropped %{skull.line.name}%" to {_a}
I'm so confused.
What are you trying to do ?
 
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.
 
i am confused but in the title it said something about chance so i would do like:

Code:
on death:
  if victim is zombie, or creeper, or skeleton, or husk:
    chance of 8%:
      set {_drop} to {_smallbag}
      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