Juskittin_ Posted April 23, 2023 Share Posted April 23, 2023 (edited) I was making a server with loot-crate like chests where you right click one it drops a random item from a list of items and the chest disappears and respawns in the same spot after a short time, I've got the disappearing and respawning down, but i need help with the random item dropping, i tried doing it on my own but either it drops 2 different items or give you nothing. I will provide my skript and i was hoping someone could help me fix it. Thank you. Edited April 23, 2023 by Juskittin_ Removed an un-wanted image Link to comment Share on other sites More sharing options...
ApexSplat Posted April 23, 2023 Share Posted April 23, 2023 (edited) 6 hours ago, Juskittin_ said: I was making a server with loot-crate like chests where you right click one it drops a random item from a list of items and the chest disappears and respawns in the same spot after a short time, I've got the disappearing and respawning down, but i need help with the random item dropping, i tried doing it on my own but either it drops 2 different items or give you nothing. I will provide my skript and i was hoping someone could help me fix it. Thank you. Well for people trying to help you, it would be nice if you actually provided your code. Edited April 23, 2023 by ApexSplat Discord: Dead#6905 Love anime! Link to comment Share on other sites More sharing options...
Juskittin_ Posted April 23, 2023 Author Share Posted April 23, 2023 12 hours ago, ApexSplat said: Well for people trying to help you, it would be nice if you actually provided your code. Yeah sorry about that, yknow how minehuts free servers are down for about a week? Yeah my code is in the folders and i do not remember it by heart i will try to type it out here though. on right-click: if event-block is chest: chance 25%: drop 1 diamond chance 25%: drop 1 dirt chance 25%: drop 1 stone chance 25%: drop 1 gold_ingot Link to comment Share on other sites More sharing options...
ApexSplat Posted April 24, 2023 Share Posted April 24, 2023 Well the problem here is if you are really lucky, you can get all 4 items. You can set a local var to a random integer between 1 and 4 as that is the same as 25% chance for each and if it is 1 they get diamond, 2 they get dirt etc Discord: Dead#6905 Love anime! Link to comment Share on other sites More sharing options...
Juskittin_ Posted April 25, 2023 Author Share Posted April 25, 2023 8 hours ago, ApexSplat said: Well the problem here is if you are really lucky, you can get all 4 items. You can set a local var to a random integer between 1 and 4 as that is the same as 25% chance for each and if it is 1 they get diamond, 2 they get dirt etc Could you provide an example of code like that? I am really new to code and I don't really know what a "local var" is. Sorry if I'm bothering you. Link to comment Share on other sites More sharing options...
ApexSplat Posted April 25, 2023 Share Posted April 25, 2023 (edited) set {_i} ro random integer between 1 and 4 if {_i} is 1: drop 1 diamond else if {_i} is 2: drop 1 dirt else if {_i} is 3: drop 1 stone else if {_i} is 4: drop 1 gold ingot Edited April 25, 2023 by ApexSplat Discord: Dead#6905 Love anime! Link to comment Share on other sites More sharing options...
Juskittin_ Posted April 27, 2023 Author Share Posted April 27, 2023 On 4/25/2023 at 8:01 AM, ApexSplat said: set {_i} ro random integer between 1 and 4 if {_i} is 1: drop 1 diamond else if {_i} is 2: drop 1 dirt else if {_i} is 3: drop 1 stone else if {_i} is 4: drop 1 gold ingot Sadly, this code did not work, i will try to experiment with it but, is there anything in the code that i need to change? Link to comment Share on other sites More sharing options...
Juskittin_ Posted April 27, 2023 Author Share Posted April 27, 2023 Here are the errors that that skript gave me. Link to comment Share on other sites More sharing options...
ApexSplat Posted April 27, 2023 Share Posted April 27, 2023 you spelt to wrong Discord: Dead#6905 Love anime! Link to comment Share on other sites More sharing options...
Juskittin_ Posted April 28, 2023 Author Share Posted April 28, 2023 9 hours ago, ApexSplat said: you spelt to wrong Oh, I fixed that but when i tried to do it it did not work at first it gave you something every time you right-click something and now ive tried to fix it it it dosent give you anything. Here's the exact code. Link to comment Share on other sites More sharing options...
ApexSplat Posted April 28, 2023 Share Posted April 28, 2023 (edited) you haven't indented it Edited April 28, 2023 by ApexSplat Discord: Dead#6905 Love anime! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now