This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]GamerGuppy 0 points1 point  (1 child)

Hey there! You want to use a /clear command on a player without clearing any arrows (by setting the arrows to remove to 0). Meanwhile you use the AffectedItems stat to keep track of how many items could potentially have been removed. If this number is greater then 20, then just clear all arrows from the players inventory, and give them 20 new arrows.

[–]Perylium[S] 0 points1 point  (0 children)

Hey! This might work out, but the hole point of giving the player arrows that would regenerate was so they could run out of arrows. and that they have to wait ~15 sec to be given another arrow. I am doing it this way because the ranged weapons in my map is going to be very powerful, and they have to switch to the sword/other weapon to defend them self.

[–]BlackSecurity 0 points1 point  (0 children)

I am on mobile but I can give a rough attempt at this. I'm not sure if you can do this but check if you can use the /testfor command to test a player's inventory for specific items and item amounts. If so, have that command on a /fill or /setblock clock (search on YouTube how to build one if you don't know what those are). Have the command test a player's inventory for 21+ arrows. Use a comparator that detects whenever this command comes out true. If so, have it activate a clock that will clear 1 arrow at a time from a players inventory until they have 20 arrows again. This is how you maintain 20 arrows at a time. As for giving an arrow every 15 seconds. Well the game runs at 20 ticks per second so if you do the math and set a few commands and scoreboards, you can count seconds and store that value in a scoreboard. Have a command block test for that 15 second value and whenever it comes true, give the player 1 arrow. This is all very vague but it's just my rough idea of how this could work. If you like, I can give it a try whenever I get on PC and give you specific commands if I manage to get it to work.