advanced looting system

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

PolduZ

Member
Oct 2, 2020
31
2
8
Hey, I'm trying to randomize the list but I'm failing to do so. Can you help me?
Code:
on load:
    delete {ore.loot.list::*}
    add 2 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 iron ingot to {ore.loot.list::*}
    add 1 diamond to {ore.loot.list::*}
    add 1 diamond to {ore.loot.list::*}
    add 2 gold ingot to {ore.loot.list::*}
    add 1 gold ingot to {ore.loot.list::*}
    add 1 gold ingot to {ore.loot.list::*}
on load:
    delete {misc.loot.list::*}
    add 2 oak planks to {misc.loot.list::*}
    add 1 oak planks to {misc.loot.list::*}
    add 2 cobblestone to {misc.loot.list::*}
    add 1 cobblestone to {misc.loot.list::*}
    add 2 string to {misc.loot.list::*}
    add 5 string to {misc.loot.list::*}
    add 7 string to {misc.loot.list::*}
    add 1 string to {misc.loot.list::*}
on load:
    delete {random.loot.list::*}
    add {misc.loot.list::*} to {random.loot.list::*}
    add {ore.loot.list::*} to {random.loot.list::*}
  
command /refill:
    trigger:
        loop blocks in radius 3 around {loc}:
            if loop-block is a chest:
                clear loop-block's inventory
                set {_item} to a random number between 1 and 20
                loop {_item} times:
                    set {_randomitem} to random element out of {random.loot.list::*}
                    set {_slot} to random integer between 0 and 26
                    set slot {_slot} of loop-block's inventory to {_randomitem}
command /loc:
    trigger:
        set {loc} to player's position
Its mixing them i want it so some chests have one another second one.
 
Code:
command /refill:
    trigger:
        loop blocks in radius 3 around {loc}:
            if loop-block is a chest:
                clear loop-block's inventory
                set {_item} to a random number between 1 and 20
                
                if {chestLoot} is not set:
                    set {_list::*} to {misc.loot.list::*}
                    set {chestLoot} to true
                else:
                    set {_list::*} to {ore.loot.list::*}
                    delete {chestLoot}
                loop {_item} times:
                    set {_randomitem} to random element out of {_list::*}
                    set {_slot} to random integer between 0 and 26
                    set slot {_slot} of loop-block's inventory to {_randomitem}

1 chest will have misc loot and another will have ore loot. Not tested!
 
ty but is there a way to randomize it
[doublepost=1604480638,1604480301][/doublepost]and i will add like 1000 loot tables
for my minigame dungeon thing
 
Code:
    add 2 iron ingot to {ore.loot.list::*}
    add 1 diamond to {ore.loot.list::*}
    add 1 diamond to {ore.loot.list::*}
    add 2 gold ingot to {ore.loot.list::*}
    add 1 gold ingot to {ore.loot.list::*}
    add 1 gold ingot to {ore.loot.list::*}

I advise you to loop a number of times and add the items to the list. Less code.

Loop 6 times:
add 1 iron ingot to {ore.loot.list::*}
 
Status
Not open for further replies.