#Meteor Skript

1 messages · Page 1 of 1 (latest)

dusk moat
#
   trigger:
      clear {item::*}

command /addmeteoritem:
   trigger:
      add player's tool to {item::*}
      send "&6Current Meteor Items Is: %{item::*}%"

command /meteor:
   trigger:
      set {x} to random integer between 100 and 110
      set {y} to random integer between 68 and 72
      set {z} to random integer between 100 and 110
      set {itemslotrow1} to random integer between 0 and 8
      set {itemslotrow2} to random integer between 9 and 17
      set {itemslotrow3} to random integer between 18 and 26
      set {location} to location at {x}, {y}, {z}
      set block at {location} to chest
      set {block} to block at {location}
      set slot {itemslotrow1} of {block}'s inventory to {item}
      set slot {itemslotrow2} of {block}'s inventory to {item}
      set slot {itemslotrow3} of {block}'s inventory to {item}```
#

current code ⬆️

#

theres 2 things that i need help with

#

i dont want the same item twice in the chest

dusk moat
#

and i only want 1 item per row and there cant be the 2 same items in 2 rows

#

like 3 items in total

#

and 3 rows

#

so 1 item per row

#

and its random which item gets in which row

#

but there cant be 2 of the same items in the chests if u guys know what i mean

worldly halo
#

{item} is not set

dusk moat
#

so i should change it to "{item::*}"

#

?

worldly halo
#

give it a try, but you cannot set slot like that

#

try to loop your variable

dusk moat
worldly halo
dusk moat
#

there is no error message

#

it just doesnt add items to the chest

worldly halo
#

set slot {itemslotrow1} of {block}'s inventory to {item::1}

dusk moat
#

ill try that

#

that works

#

Thank You For The Help 😄

worldly halo
#

you actually need to loop the variable

dusk moat
#

wdym?

worldly halo
dusk moat
#

what does that do?

worldly halo
#

to fill your chest without complicated your code

dusk moat
#
   trigger:
      clear {item::*}

command /addmeteoritem:
   trigger:
      add player's tool to {item::*}
      send "&6Current Meteor Items Is: %{item::*}%"

command /meteor:
   trigger:
      set {x} to random integer between 100 and 110
      set {y} to random integer between 68 and 72
      set {z} to random integer between 100 and 110
      set {itemslotrow1} to random integer between 0 and 8
      set {itemslotrow2} to random integer between 9 and 17
      set {itemslotrow3} to random integer between 18 and 26
      set {location} to location at {x}, {y}, {z}
      set block at {location} to chest
      set {block} to block at {location}
      loop {_item::*}
      set slot {itemslotrow1} of {block}'s inventory to {item::1}
      set slot {itemslotrow2} of {block}'s inventory to {item::2}
      set slot {itemslotrow3} of {block}'s inventory to {item::3}```

where do i put it?
worldly halo
#

before the set slot

#

and you could just use local variable to set the location

worldly halo
#

nah its not important, juswt do what you wanna do

dusk moat
#

no but if its better and makes the code more professional i wanna do it

worldly halo
dusk moat
#

alr

dusk moat
round moon
#

put a underscore before the name of your variable, like this {_variable}

dusk moat
#

why?

#
   trigger:
      clear {_item::*}
      send "&6Cleared %{_item::*}%"

command /addmeteoritem:
   trigger:
      add player's tool to {_item::*}
      send "&6Current Meteor Items Is: %{_item::*}%"

command /meteor:
   trigger:
      set {_x} to random integer between 100 and 110
      set {_y} to random integer between 68 and 72
      set {_z} to random integer between 100 and 110
      set {_itemslotrow1} to random integer between 0 and 8
      set {_itemslotrow2} to random integer between 9 and 17
      set {_itemslotrow3} to random integer between 18 and 26
      set {_location} to location at {_x}, {_y}, {_z}
      loop all blocks in a radius 5 of {_location}
      set loop-blocks to magma and obsidian
      set block at {_location} to chest
      set {_block} to block at {_location}
      set slot {_itemslotrow1} of {_block}'s inventory to {_item::1}
      set slot {_itemslotrow2} of {_block}'s inventory to {_item::2}
      set slot {_itemslotrow3} of {_block}'s inventory to {_item::3}```

Like this?
dusk moat
#
   trigger:
      clear {_item::*}
      send "&6Cleared %{_item::*}%"

command /addmeteoritem:
   trigger:
      add player's tool to {_item::*}
      send "&6Current Meteor Items Is: %{_item::*}%"

command /meteor:
   trigger:
      set {_x} to random integer between 100 and 110
      set {_y} to random integer between 68 and 72
      set {_z} to random integer between 100 and 110
      set {_itemslotrow1} to random integer between 0 and 8
      set {_itemslotrow2} to random integer between 9 and 17
      set {_itemslotrow3} to random integer between 18 and 26
      set {_location} to location at {_x}, {_y}, {_z}
      loop all blocks in radius 5 of {_location}:
         set loop-blocks to magma and obsidian
         set block at {_location} to chest
         set {_block} to block at {_location}
         set slot {_itemslotrow1} of {_block}'s inventory to {_item::1}
         set slot {_itemslotrow2} of {_block}'s inventory to {_item::2}
         set slot {_itemslotrow3} of {_block}'s inventory to {_item::3}```

Still doesnt work
round moon
#

try loop-block

dusk moat
#

fixed it

round moon
#

that worked?

#

also dont make item a local variable. if you read what they did you would know that that makes your top code do basically nothing

dusk moat
#

?

round moon
#

Local variables are limited to the place they were set. You cannot get the value of the local variable outside of when you set it, it's only accessible in the same trigger that you defined it in. If you need to pass information between triggers, or over time, use global variables.

dusk moat
#

so a location use local

#

and use global for everything else?

round moon
#

make any of the variables that you access outside this trigger global

#

in this case item::1, 2 3

dusk moat
#
   trigger:
      clear {item::*}
      send "&6Cleared %{item::*}%"

command /addmeteoritem:
   trigger:
      add player's tool to {item::*}
      send "&6Current Meteor Items Is: %{item::*}%"

command /meteor:
   trigger:
      set {_x} to random integer between 100 and 110
      set {_y} to random integer between 68 and 72
      set {_z} to random integer between 100 and 110
      set {_itemslotrow1} to random integer between 0 and 8
      set {_itemslotrow2} to random integer between 9 and 17
      set {_itemslotrow3} to random integer between 18 and 26
      set {_location} to location at {_x}, {_y}, {_z}
      loop all blocks in radius 5 of {_location}:
         set loop-blocks to magma or obsidian

      set block at {_location} to chest
      set {block} to block at {_location}
      set slot {itemslotrow1} of {block}'s inventory to {item::1}
      set slot {itemslotrow2} of {block}'s inventory to {item::2}
      set slot {itemslotrow3} of {block}'s inventory to {item::3}```

LIKE THIS?
#

sry caps

round moon
#

why are block and itemslotrow global