So far i have acheived this, but it uses the tick.json tag to test if a player has an arrow then runs a function that clears 1 arrow and gives 1 spectral arrow.
im wondering if there is a better way to do this with nbt data
version 1.21
#Trying to replace all arrows a player gets with spectral arrows.
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1744057764:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
using nbt checks or modifications is never the better way
removing and giving 1 at a time cant be much better xD
you don't have to do it one by one
you c an clear all of them and store that value in a scoreboard
then use a loot table that drops spectral arrow to give them backl to the player.
add a set_count function to the loot table that uses scoreboard as the item count
im gonna need a little hand holding for this, never touched loot tables before
first, how do i store the value of all arrows the player has or will have
that's all you need inthe loot table
just combine the execute store command with the clear command
/clear always returns the number of cleared items
something like this?
@s works too, if you store the number in the players scoreboard instead of a fake player.
gonna have to be per player
but you don't have to make it fixed
i need it so that only those who can use it, use it. unless im overthinking it
I know, but that also works if you use one scoreboard for all players
they don't get evaluated parallel, but in sequence
so it doesn't matter
palyer a then player b?
this should only be running for specific players anyway i suppose
for context, im makign a skill tree with puffish skills, some people will have this passive ability and others wont
still won't interfere with each other
its only gonna be ran for specific players anyway, so i dont need @s in the loot table
me overthinking and over complicating a simple thing ;-;
if you want to use the players score, you need this
if player a picks up 128 arrows and player b 64 arrows in the same tick they should both only get the specified amount they picked up with no errors
When your system runs (assuming you only use a collective single score) first player a gets their arrows removed amd the amound stored in the scoreboard. Then the loot table uses that number to give them the new arrows.
Then player b gets their arrows removed and the new amount (64) overwrites the old one (128) so player b will only get his 64 arrows from the loot table.
When you store the amount in every players own scoreboad they will work the same but they only overwrite their own scores.
useful info to have, not necessary for this though right?
under count you havve the object name as count, what does that mean?
either way, you don't have to worry about this at all in your case as it will work no matter how you do it.
that's the fixed name of the fake player.
fixed means it uses a constant name, not a dynamic target (like @s or This)
/execute as @a[tag=saturn_test] run execute store result score count clear run clear @s minecraft:arrow
this gets rid of the arrows and stores the amount to the objective clear, how do i run the loot table?
/execute should only contain 1 execute and 1 run
[37m/[35mexecute [34mas [36m@a[33m[[37mtag[34m=[32msaturn_test[33m] [34mstore result score [0mcount [35mclear [0mrun [35mclear [36m@s [33mminecraft:arrow
oh i didnt know you could do that xD
you can chain as many sub commands as you want
:0
alright with that in mind, how do i use the loot table?
is this in the wrong place, or maybe the folder name is wrong?
nvm
/loot give Hijacktrolo loot solar_v2:spectral_arrow
👍