0

So i'm making a map that gives you a slime ball says REGEN and a sword. I would like to give the player holding the slime regen II for 1 second to heal if he's not fighting using /testfor. But how do I testfor and give to the exact player that holds the slime, as the regen may be given to another player who's not holding the slime.

1 Answer 1

1

Use a scoreboard tag

Set up a repeat/chain line of command blocks and run:

/scoreboard players tag @a[tag=holdSlime] remove holdSlime
/scoreboard players tag @a[tag=!holdSlime] add holdSlime {SelectedItem:{id:minecraft:slime,tag:{Display:{Name:"REGEN"}}}}
/effect @a[tag=holdSlime] minecraft:regeneration 1 1
5
  • yay! ths. But i'm wondering if i give that player regen "0", will it still work? Commented Mar 4, 2016 at 13:31
  • @CụRùa regeneration 1 0 would be Regen 1 for 1 second. Not sure what happens when you put regeneration 1 -1
    – MrLemon
    Commented Mar 4, 2016 at 13:39
  • ok then. The thing is I don't want players to select the slime ball and then immediately switch to sword with regen for 1 second: if every 1 second they select the slime in hot bar, their regen would go on and on, and they can still select the sword to hit others. I think that if you give the player regen for 0 second, players will have to hold the slime continously to be regenerated. Commented Mar 4, 2016 at 13:43
  • @CụRùa ah, you meant time-wise. Not sure if 0 seconds of an effect is possible (and works), but you can try.
    – MrLemon
    Commented Mar 4, 2016 at 13:47
  • Well, I will, as on a server when I hold my blaze powder, it gives me fire resistent for 0:00 second. Thank you. Commented Mar 4, 2016 at 13:57

You must log in to answer this question.

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