1

I'm building my own custom created mini-game called murder.

I have 3 teams, and I only have to setup 1 more, but I've ran into a problem; When they get an arrow and shoot it a command block with testfor activates and starts giving them every single time when they have no arrows, an arrow.

The problem is I only want them to give them 1 arrow at a time, so when they shoot that arrow, they get 1 back within 30 ticks of time , but I don't have enough experience with command blocks to do so, anyone who can help me?

6
  • Don't assume the solution is to use testfor because it probably isn't.
    – MBraedley
    May 13, 2015 at 12:53
  • then what could it be? May 13, 2015 at 13:46
  • So you want the player to always have exactly one arrow in their inventory? Or that it stays at a certain amount (they have 3, shoot 1, get 1 back, still have 3)? Could an infinity bow accomplish what you are wanting?
    – SirBenet
    May 13, 2015 at 16:09
  • No, just one. and after 3 seconds they shot it, they receive another one, but you must be in a certain team to receive it. so like this: /testfor @a[team=Arrow] {Inventory{Slot9b,id:minecraft:air} and would activate if there is nothing in that specific slot, but my problem here is now that minecraft:air wont work, I need it to detect that slot 9 is empty. May 13, 2015 at 16:33
  • @MinecraftDoge So if they have three arrows, and shoot one, what happens? Do they get another arrow, or does it only give them one if they have none left?
    – SirBenet
    May 14, 2015 at 19:56

2 Answers 2

0

I found my own answer after testing, testing, and testing, and here's my solution:

You use scoreboard objectives, and use the testfor command, to look if you have the "use bow" stat. If you used it, the testfor command sends a signal to remove the arrow, and after a specified number of ticks, the arrow is returned.

I used replaceitem, but you can use give.

-2
/testfor @a[team=Arrow] {Inventory{Slot9b,id!:minecraft:arrow}

I beleve this does the trick, it tests for anything exept an arrow.

7
  • 2
    I did ! know ! works there. That's handy!
    – user43038
    May 14, 2015 at 11:16
  • 1
    @TimPost This doesn't work, unfortunately.
    – SirBenet
    May 14, 2015 at 17:07
  • @colorfusion are you shure, I didn't test it but i found it on the web
    – BRHSM
    May 14, 2015 at 17:37
  • 1
    @CoderGuy Where did you find it? The command definitely doesn't work, at least not in its current state.
    – SirBenet
    May 14, 2015 at 17:41
  • @i found it in a large minigame project of a friend on the minecraft forums (post got deleted a while back)
    – BRHSM
    May 14, 2015 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .