Solved Goldswitch

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

Cupex

Member
Feb 16, 2020
43
1
8
26
I tried to make a skript, that you can transfer 9 gold nuggets into 1 gold ingot. So if you have 1-8 gold nuggets in you're inventory it will not work. If you have exact 9 gold nuggets you get 1 gold ingot. And when you have for example 27 gold nuggets you will get 3 gold ingots. But I don't know how to do that.

I can send the skript I tried so that you can look what I tried

Code:
command /goldswitch:
    trigger:
        set {_nuggetamount} to amount of gold_nugget in player's inventory
        if {_nuggetamount} is 0:
            send "You don't have enought gold nuggets in your inventory!"
            stop
        if {_nuggetamount} is less than 9:
            send "You need at least 9 gold nuggets to get 1 gold ingot!"
            stop
        if {_nuggetamount} is more or equal to 9:
            give 1 gold_ingot to player
            send "You transformed {amountof goldnuggets} into {amount of gold ingots}."
            wait 1 tick
            remove all gold_nuggets from player
            stop
 
You don't need to put "stop" everywhere
Code:
command /goldswitch:
    trigger:
        if amount of gold_nugget in player's inventory is more than or equal to 9:
            while amount of gold_nugget in player's inventory is more than or equal to 9:
                give 1 gold_ingot to player
                remove 9 gold_nuggets from player
                add 1 to {_gold}
                wait 1 tick
            set {_nuggets} to {_gold} * 9
            send "You converted %{_nuggets}% nuggets into %{_gold}%"
        else:
            send "You need to have at least 9 gold nuggets"

not sure if it works, not tested
 
Status
Not open for further replies.