Help with Apple Rate Skript

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

GelaPT

New Member
Aug 20, 2019
5
0
0
23
Portugal
Hello, I'm making an 1.12.2 UHC only server and every thing is good so far, less the apples! I need the apples! x) So I made a skript to make apples drop more often but it doesn't work as it should. /apples work, it shows the message that it is indeed *something*% but leaves only drop saplings.

code:
Code:
options:
    p: §8[§2Apple Rates§8]§r
    perms: skript.apples
    {rates::apples} = 0

command /apples [<text>] [<int>]:
    permission: {@perms}
    usage: /apples [<set:reset>] [<rate (1-100)>]
    trigger:
        if arg-1 is "reset":
            broadcast "{@p} Apple Rates set to Vanilla"
            set {rates::aples} to 5
        else if arg-1 is "set":
            if arg-2 is not set:
                send "{@p} You must specify a rate to set it to!" to command sender
                stop
            else if arg-2 is less than 0:
                send "{@p} No number lower than 0!" to command sender
                stop
            else if arg-2 is more than 0:
                send "{@p} No number higher than 100!" to command sender
                stop
            else:
                set {rates::apples} to arg-2
                broadcast "{@p} Apple Rates set to %arg-2%%%"
        else:
            if {rates::apples} is set:
                send "{@p} Current Apple Rates: %{rates::apples}%%%"
            else:
                send "{@p} Current Apple Rates: Vanilla"
            send "{@p} /apples [<set:reset>] [<rate (1-100)>]"

on leaves decay:
    cancel the event
    set the event-block to air
    chance of {rates::apples}%:
        drop 1 apple at event-block
    if event-block is oak leaves:
        chance of 5%
        drop 1 oak sapling at event-block
    else if event-block is spruce leaves:
        chance of 5%
        drop 1 spruce sapling at event-block
    else if event-block is birch leaves:
        chance of 5%
        drop 1 birch sapling at event-block
    else if event-block is jungle leaves:
        chance of 5%
        drop 1 jungle sapling at event-block
    else if event-block is acacia leaves:
        chance of 5%
        drop 1 acacia sapling at event-block
    else if event-block is dark oak leaves:
        chance of 5%
        drop 1 dark oak sapling at event-block

on break of leaves:
    cancel the event
    set the event-block to air
    chance of {rates::apples}%:
        drop 1 apple at event-block
    if event-block is oak leaves:
        chance of 5%
        drop 1 oak sapling at event-block
    else if event-block is spruce leaves:
        chance of 5%
        drop 1 spruce sapling at event-block
    else if event-block is birch leaves:
        chance of 5%
        drop 1 birch sapling at event-block
    else if event-block is jungle leaves:
        chance of 5%
        drop 1 jungle sapling at event-block
    else if event-block is acacia leaves:
        chance of 5%
        drop 1 acacia sapling at event-block
    else if event-block is dark oak leaves:
        chance of 5%
        drop 1 dark oak sapling at event-block
 
You are literally forcing a drop of saplings every leaf decay... What's wrong then?

Just not to talk how you define a variable in OPTIONS

I believe I know what your problem is, I'll let you answer.

it's my first time doing a skript, I only have experience on C# and C++ never learnt anything else, I have no clue about what I'm doing xD
 
If you actually knew C++ you'd know that setting a 0% drop chance, would give you... well... 0% drops. You have no logic when you're coding... If you actually knew those languages you'd know that maybe you have to learn Skript before attempting to do one??? Uh????

Anyways I'm probably being a douche, get on with it I've told you what the problem is. You know what to do

Well my idea was declaring the variable (just like in C++/C#) I searched and didn't find much, so I kind of tried to make an invention. My idea was that the variable would change after the command was used. I tested it and in game it really said "100%"/"75%" but still didn't work as a chance of dropping the apple.
 
The variable is defined as 0, you cannot define a variable inside 'options', think greater to achieve better things.
code_language.skript:
options:
    p: §8[§2Apple Rates§8]§r
    perms: skript.apples
    {rates::apples} = 0 # this has to be defined like: APPLE_RATES: 0
Even if that worked:
code_language.skript:
chance of {rates::apples}%:
    drop 1 apple at event-block # if 0% rate, drop apple????

I changed it to 100% and now it drops 1 apple per tree, so everytime I break a new leave on a new tree it gives me an apple, but if I keep breaking the leaves it doesn't give me apples xD bug or lack of knowledge ?
 
I came up with another code:

Code:
options:
    p: §8[§2Apple Rates§8]§r
    perms: skript.apples

command /apples [<text>] [<int>]:
    permission: {@perms}
    usage: /apples [<set:reset>] [<rate (1-100)>]
    trigger:
        if arg-1 is "reset":
            broadcast "{@p} Apple Rates set to Vanilla"
            set {rates::apples} to 5
            set {rates::applesnerf} to 2
        else if arg-1 is "set":
            if arg-2 is not set:
                send "{@p} You must specify a rate to set it to!" to command sender
                stop
            else if arg-2 is less than 0:
                send "{@p} No number lower than 0!" to command sender
                stop
            else if arg-2 is more than 100:
                send "{@p} No number higher than 100!" to command sender
                stop
            else:
                set {rates::apples} to arg-2
                broadcast "{@p} Apple Rates set to %arg-2%%%"
        else:
            if {rates::apples} is set:
                send "{@p} Current Apple Rates: %{rates::apples}%%%"
            else:
                send "{@p} Current Apple Rates: Normal"
            send "{@p} /apples [<set:reset>] [<rate (1-100)>]"

on leaves decay:
    chance of {rates::apples}%:
        drop 1 apple

on break of leaves:
    chance of {rates::apples}%:
        drop 1 apple

leaves decay is working, but break of leaves isn't, it's doing what it used to do. I seriously can't get it!
 
Last edited:
Status
Not open for further replies.