Solved Using variable assigned to random number in argument of drop

  • 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.
Apr 4, 2017
16
0
0
41
I'm having some trouble with the Random Number expression.

Consider this minimal example; the desired functionality is that every time a block is broken, a random integer between 1 and 9 is chosen, and that many diamonds are dropped.
Code:
on block break:
    set {_diamondsToDrop} to random integer between 1 and 9
    drop {_diamondsToDrop} diamonds

This code returns the error

Can't understand this condition/effect: drop {_diamondsToDrop} diamonds

On the other hand, replacing this last line with broadcast "%{_diamondsToDrop}%" broadcasts the integer (as expected), and replacing it instead with drop 1 diamond drops one diamond upon break (also as expected).

What is wrong with the code, and how can one achieve this functionality?
 
Last edited:
Status
Not open for further replies.