help thanks!

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

skanto123

Active Member
Jan 8, 2018
70
0
0
How do I make it so when I click a chest if that chests contains 9 iron ingots or gold ingots or diamonds or emeralds then it removes 9 of that item from the chest and adds 1 gold block or iron block or diamond block or emerald block but if it has 8 or less of that item that is stops and send the user a message but if the chest contains like 36 gold ingots that it turns it into 4 blocks etc so like 180 ingots turns it into 20 blocks etc everytime it divides the ingots in the chest with 9 removes all the ingots and adds the devided number of thems to the chest aka blocks

Thanks
 
i didn't tested it (I just code from brain)

code_language.skript:
on rightclick on chest:
    wait a ticks
    set {_Loop::iron} to number of cobblestone in player's inventory
    set {_Loop::gold} to number of iron ore in player's inventory
    set {_loop::diamond} to number of stone in player's inventory
    set {_Loop::Emerald} to number of glowstone dust in player's inventory
    loop {_Loop::*}:
        while {_Loop::%loop-index%} is more than or equal to 9:
            subtract 9 from {_loop::%loop-index%}
            remove 9 of ("%loop-index%" parsed as item) from player's inventory
            add 1 of ("%loop-index% Block" parsed as item) to player's inventory

#Edit

Would be nice if you use next time better title example: "Converter from ingot to block"
 
thanks but dosnt work i want to make it so if a player has a diamond hoe named "&cSpecial Hoe" in his inventory and on left click on a chest or trapped chest that it turns ingots into ores inside the chest and nuggets into ingots thanks if you could do that and gunpowder into tnt! THANKS!
 
code_language.skript:
command /item:
    trigger:
        give player diamond hoe named "Im a Magic"

on rightclick on chest:
    player's tool is diamond hoe named "Im a Magic"
    wait a ticks
    set {_Loop::iron ingot} to number of iron ingot in event-block's inventory
    set {_Loop::gold ingot} to number of gold ingot in event-block's inventory
    set {_loop::diamond} to number of diamond in event-block's inventory
    set {_Loop::Emerald} to number of Emerald in event-block's inventory
    loop {_Loop::*}:
        while {_Loop::%loop-index%} is more than or equal to 9:
            subtract 9 from {_loop::%loop-index%}
            remove 9 of ("%loop-index%" parsed as item) from event-block's inventory
            if loop-index is "Iron ingot":
                add 1 of ("Iron Block" parsed as item) to event-block's inventory
            else if loop-index is "Gold ingot":
                add 1 of ("Gold Block" parsed as item) to event-block's inventory
            else:
                add 1 of ("%loop-index% Block" parsed as item) to event-block's inventory

if you want adding Tnt and somethings, i hope you know what you have doing...


upload_2018-1-13_16-26-48.png

(i put every one stacks)
 
code_language.skript:
command /item:
    trigger:
        give player diamond hoe named "Im a Magic"

on rightclick on chest:
    player's tool is diamond hoe named "Im a Magic"
    wait a ticks
    set {_Loop::iron ingot} to number of iron ingot in event-block's inventory
    set {_Loop::gold ingot} to number of gold ingot in event-block's inventory
    set {_loop::diamond} to number of diamond in event-block's inventory
    set {_Loop::Emerald} to number of Emerald in event-block's inventory
    loop {_Loop::*}:
        while {_Loop::%loop-index%} is more than or equal to 9:
            subtract 9 from {_loop::%loop-index%}
            remove 9 of ("%loop-index%" parsed as item) from event-block's inventory
            if loop-index is "Iron ingot":
                add 1 of ("Iron Block" parsed as item) to event-block's inventory
            else if loop-index is "Gold ingot":
                add 1 of ("Gold Block" parsed as item) to event-block's inventory
            else:
                add 1 of ("%loop-index% Block" parsed as item) to event-block's inventory

if you want adding Tnt and somethings, i hope you know what you have doing...


View attachment 1664
(i put every one stacks)
HEY I did what you said and it worked but now its saying http://prntscr.com/i07udx how do i fix?
 
i think its just a warning, i didn't get this message. Did you edit somewhere? If yes. show me full code, please. Thanks.