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}```
#Meteor Skript
1 messages · Page 1 of 1 (latest)
current code ⬆️
theres 2 things that i need help with
i dont want the same item twice in the chest
the thing that doesnt work right now is that when i spawn a chest theres no item in the chest
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
{item} is not set
doesnt work
wdym?
try to send your error msg or smth, dont say doesn't work idk too
set slot {itemslotrow1} of {block}'s inventory to {item::1}
you actually need to loop the variable
wdym?
what does that do?
to fill your chest without complicated your code
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?
like that?
nah its not important, juswt do what you wanna do
no but if its better and makes the code more professional i wanna do it
also is this right?
yea its right
alr
how do i do this?
put a underscore before the name of your variable, like this {_variable}
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?
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
try loop-block
fixed it
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
?
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.
make any of the variables that you access outside this trigger global
in this case item::1, 2 3
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
why are block and itemslotrow global