random dice role after fishing

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

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

Daniel_Sparky

Member
Jun 9, 2022
1
0
1
How do you create a code that whenever you catch something a random item is rolled. for example 8 diamonds or string with a custom name and is glowing, or a very low chance for a pet (Head)
 
I was going to write something up but apparently someone has already addressed this here

Code:
on script load:
    import "org.bukkit.event.player.PlayerFishEvent"
 
on "org.bukkit.event.player.PlayerFishEvent" with priority 5:
    if "%event.getState().name()%" is "CAUGHT_FISH":
        chance of 2.5%:
            message "&bSweet, sparkling surprise! That's a diamond!" to event.getPlayer()
            set {_item} to "diamond" parsed as item
            event.getCaught().setItemStack({_item})

Thats the code but it relies on Skript-Mirror to work.

To change the reward to random you would use something like

Code:
give player 1 of random items out of all items
 
Last edited:
Status
Not open for further replies.