#Trying to replace all arrows a player gets with spectral arrows.

1 messages · Page 1 of 1 (latest)

storm ingot
#

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

strange sedgeBOT
#

<@&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

oblique ermine
#

using nbt checks or modifications is never the better way

storm ingot
#

removing and giving 1 at a time cant be much better xD

oblique ermine
#

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

storm ingot
#

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

oblique ermine
oblique ermine
#

/clear always returns the number of cleared items

storm ingot
#

something like this?

oblique ermine
#

@s works too, if you store the number in the players scoreboard instead of a fake player.

storm ingot
#

gonna have to be per player

oblique ermine
#

but you don't have to make it fixed

oblique ermine
#

it's preference

storm ingot
#

i need it so that only those who can use it, use it. unless im overthinking it

oblique ermine
#

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

storm ingot
#

palyer a then player b?

oblique ermine
#

yes

#

but within the same tick

#

minecraft is heavily single threaded

storm ingot
#

this should only be running for specific players anyway i suppose

oblique ermine
#

as I said, it's preference

#

but if you want to use @s, do it like this

storm ingot
#

for context, im makign a skill tree with puffish skills, some people will have this passive ability and others wont

oblique ermine
#

still won't interfere with each other

storm ingot
#

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 ;-;

oblique ermine
storm ingot
#

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

oblique ermine
#

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.

storm ingot
storm ingot
oblique ermine
oblique ermine
storm ingot
#

OH

#

ok

oblique ermine
#

fixed means it uses a constant name, not a dynamic target (like @s or This)

storm ingot
#

/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?

oblique ermine
#

/execute should only contain 1 execute and 1 run

river plankBOT
#
/execute as @a[tag=saturn_test] store result score count clear run clear @s minecraft:arrow
storm ingot
#

oh i didnt know you could do that xD

oblique ermine
#

you can chain as many sub commands as you want

storm ingot
#

: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

oblique ermine
#

👍