Discord Thread How do I add chance to an item so 1/2 or 1/4 of getting the item

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

    Now, what are you waiting for? Join the community now!

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

FindME

Active Member
Jul 5, 2023
58
3
8
on step on pressure plate:
if event-block is a iron pressure plate:
if block below event-location is iron block:
set {_number} to a random integer between 1 and 4
if {_number} is 1:
give player iron nugget named "&fIron Nugget" with lore "This is worth 25¢"
if {_number} is 2:
give player white dye named "&fIron Chunk" with lore "This is worth 5$"
if {_number} is 3:
give player iron ingot named "&fIron Ingot" with lore "This is worth 25$"
if {_number} is 4:
give player iron nugget named "&fIron Block" with lore "This is worth 500$"
wait 1 tick

Posted by: cleisss from the skUnity Discord. View the thread on skUnity Discord here
 
no
`on step on pressure plate:
if event-block is a iron pressure plate:
if block below event-location is iron block:
set {_n} to a random integer between 1 and 2 and 3
if {_n} is 3:
set {_n} to a random integer between 4 and 5 and 6
if {_n} is 6:
set {_n} to a random integer between 7 and 8 and 9
if {_n} is 1 or 2:
give player iron nugget named "&fIron Nugget" with lore "This is worth 25¢"
if {_n} is 4 or 5:
give player white dye named "&fIron Chunk" with lore "This is worth 5$"
if {_n} is 7 or 8:
give player iron ingot named "&fIron Ingot" with lore "This is worth 25$"
if {_n} is 9:
give player iron block named "&fIron Block" with lore "This is worth 500$"`
im trying to do 2/3 to 1/3
says it can only be 1
<@490876083206488064>

Posted by: cleisss from the skUnity Discord.
 
code_language.skript:
on step on pressure plate:
    if event-block is a iron pressure plate:
        if block below event-location is iron block:
            set {_number} to a random integer between 1 and 5
            if {_number} is 1 or 2:
                give player iron nugget named "&fIron Nugget" with lore "This is worth 25¢"
            if {_number} is 3:
                give player white dye named "&fIron Chunk" with lore "This is worth 5$"
            if {_number} is 4:
                give player iron ingot named "&fIron Ingot" with lore "This is worth 25$"
            if {_number} is 5:
                give player iron block named "&fIron Block" with lore "This is worth 500$"
            wait 1 tick
this is what i mean
not the full code
but its an example

Posted by: gaqb from the skUnity Discord.
 
oh wait
i mean 33
and whatever is after
thats why i have it as 1 and 2 and 3
but it says {_n} can only be set to one object, not more
oh wait
im stupid

Posted by: cleisss from the skUnity Discord.
 
Status
Not open for further replies.