Adding Fortune to this Skript code

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

spdxm_

New Member
Oct 26, 2024
6
0
1
24
So basically what i want is if a player has fortune to their pickaxe/axe then they get so and so amount depending on how much fortune and also if i could add a name to the material given to the player such as &b&lDark Diamonds here is the code if anyone could help

on break of diamond block:
if gamemode of player is survival:
if event-block is cobblestone:
give player diamond 5
clear drops
 
You should try coding it yourself first, and if you encounter any problems thats where you should ask for help in this forum, rather than people spoon feeding you the code. Also there's a button to place your "code"(script) so that it would look clean the next time you post a script in a forum


Screenshot 2024-10-29 at 4.06.24 AM.png
 
You should try coding it yourself first, and if you encounter any problems thats where you should ask for help in this forum, rather than people spoon feeding you the code. Also there's a button to place your "code"(script) so that it would look clean the next time you post a script in a forum


View attachment 8975
okay, i will try but im very new and i don't even know where to start to coding it, i asked someone already and they gave me a solution already so i might just delete this post but thanks for showing me the "code" thing. i appriciate it
 
So basically what i want is if a player has fortune to their pickaxe/axe then they get so and so amount depending on how much fortune and also if i could add a name to the material given to the player such as &b&lDark Diamonds here is the code if anyone could help

on break of diamond block:
if gamemode of player is survival:
if event-block is cobblestone:
give player diamond 5
clear drops
Events, Conditions + etc I used for this:
Block Broken Event
Chance Condition
RNG Expression

Is Enchanted Condition


Additional enchant functionality can be tricky to code with Skript but is very much doable. If you want a true fortune enchant type effect applied to a certain block, you'll likely need to do a bit of math. Minecraft's true fortune has a bit of complex math, so for the sake of this, I'll make it simplier. You start with an RNG, this will be the max amount of blocks a player can get:
Code:
set {_rb} to a random number between 1 and 4
After that, apply a chance percent to give that number of drops to player
Code:
set {_rb} to 1
chance of 28%:
   set {_rb} to a random number between 1 and 4
Notice I set {_rb} to 1 before the RNG code is called that way even if it doesn't occur, {_rb} will still be set and usable. Now, after that, you apply the other events to correspond with the code and slight customization to the given item.
Code:
on break of cobblestone:
   player's gamemode is survival
   player's tool is enchanted with fortune
   set {_rb} to 1
   chance of 28%:
      set {_rb} to a random number between 1 and 4
   give {_rb} of diamond named "&b&lDark Diamond" to player
and 4[/CODE]
 
  • Like
Reactions: Doodle
Events, Conditions + etc I used for this:
Block Broken Event
Chance Condition
RNG Expression

Is Enchanted Condition


Additional enchant functionality can be tricky to code with Skript but is very much doable. If you want a true fortune enchant type effect applied to a certain block, you'll likely need to do a bit of math. Minecraft's true fortune has a bit of complex math, so for the sake of this, I'll make it simplier. You start with an RNG, this will be the max amount of blocks a player can get:
Code:
set {_rb} to a random number between 1 and 4
After that, apply a chance percent to give that number of drops to player
Code:
set {_rb} to 1
chance of 28%:
   set {_rb} to a random number between 1 and 4
Notice I set {_rb} to 1 before the RNG code is called that way even if it doesn't occur, {_rb} will still be set and usable. Now, after that, you apply the other events to correspond with the code and slight customization to the given item.
Code:
on break of cobblestone:
   player's gamemode is survival
   player's tool is enchanted with fortune
   set {_rb} to 1
   chance of 28%:
      set {_rb} to a random number between 1 and 4
   give {_rb} of diamond named "&b&lDark Diamond" to player
and 4[/CODE]
bro I ain't reading allat :emoji_sob:

bro went above and beyond listing LINKS TO THE SYNTAX

also luke I'm not sure if you saw but someone already gave him the code he needed :emoji_skull:
 
bro I ain't reading allat :emoji_sob:

bro went above and beyond listing LINKS TO THE SYNTAX

also luke I'm not sure if you saw but someone already gave him the code he needed :emoji_skull:
I did. Just added the links & all plus a tutorial for in case someone new to Skript wanted to try making something like that themselves.