Setting all blocks in a list

Discussion in 'Skript' started by chrissquid123, Aug 12, 2018.

  1. how would I loop all blocks in a list variable then set them to coal ore very 10 seconds. Here is the code of how the blocks are added to the variable.
    Code (Text):
    on place:
        player's tool is a coal ore named "&cWarzone Coal Ore" with lore "Place to make a warzone coal"
        set {warzone.%event-block%} to true
        add the event-block to {warzores::*}
    So this is the code I tested and it didnt work
    Code (Text):
    every 10 seconds:
        loop {warzores::*}:
            set {warzores::%loop-index%} to coal ore
            chance of 35%:
                set {warzores::%loop-index%} to iron ore
            chance of 12%:
                set {warzores::%loop-index%} to gold ore
            chance of 6%:
                set {warzores::%loop-index%} to emerald ore
            chance of .4%:
                set {warzores::%loop-index%} to diamond ore
     
  2. try, change this "add the event-block to {warzores::*}"
    to
    "add type of event-block to {warzores::*}"
     
  3. Thanks for the help I am testing this right now
     
  4. Youre welcome... hopefully that works.
     
  5. This doesn't seem to be working, I tested it and after 10 seconds the block is not being set to coal ore.
     
  6. OH you're trying to set the block, not the variable, okay let me do this for ya
    Ignore what I previously said about:
    "try, change this "add the event-block to {warzores::*}"
    to
    "add type of event-block to {warzores::*}""

    Do this instead
    Code (Text):
    on place:
        player's tool is a coal ore named "&cWarzone Coal Ore" with lore "Place to make a warzone coal"
        set {warzone.%event-block%} to true
        add the event-block to {warzores::*}

    every 10 seconds:
        loop {warzores::*}:
            set block at location of {warzores::%loop-index%} to coal ore
            chance of 35%:
                set block at location of {warzores::%loop-index%} to iron ore
            chance of 12%:
                set block at location of {warzores::%loop-index%} to gold ore
            chance of 6%:
                set block at location of {warzores::%loop-index%} to emerald ore
            chance of .4%:
                set block at location of {warzores::%loop-index%} to diamond ore
     
     
    • Like Like x 1
  7. or use

    add location of event-block to {warzones::*}


    and then do

    set block at {warzones::%loop-index%} to <block>
     
  8. loop-index won't work because of this:
    Code (Text):
    add the event-block to {warzores::*}
    U need to use "loop-value" instead of that
     
  9. When adding something to a list it automatically gets a numbers as index, so it does have an index.
     
    • Agree Agree x 1
  10. Yeah what ShaneBee said works fine
     
    • Like Like x 1