OtherDrops

226k Downloads

"health" condition

sehrgut opened this issue · 4 comments

commented

I'd like to encourage not-quite-to-the-death PVP on my server by allowing players to capture each other's heads. Essentials /give allows me to award the trophy, but I'd love to have a "health" condition (or better yet, separate player-health and victim-health conditions) so that I can award the trophy on wearing someone down to a particular number of half-hearts.

otherdrops:
  PLAYER:
    - action: HIT
      command: "/$give %p head:3 player:%v"
      message.server: %p has acquired %v's head
      victim-health: 4
commented

Why not specify the number of half-hearts instead of the number of hearts? Is there some reason to shun non-integer values? It makes more sense to me to specify "2.5 hearts" than it does to specify "5 half-hearts".

commented

Half-hearts are actually the integer value of health. You have 10 hearts in the GUI, displaying health from 0 to 20. It's not a continuous value: you can't have health of 8.6, for example.

Sent from my iPhone

On Apr 4, 2013, at 9:51 PM, CelticMinstrel [email protected] wrote:

Why not specify the number of hearts instead of the number of half-hearts? Is there some reason to shun non-integer values?


Reply to this email directly or view it on GitHub.

commented

If you look at the health parameter of the scoreboard system you have a max health of 20, on the wiki, things have their health listed by half hearts (behind the graphic) and in programming there are many reasons to avoid decimals when it is easy to do so. Also as I think sehrgut has pointed out, there is an assumption created when you have a certain number of digits of accuracy, that anything with that many digits should work, (as long as you don't exceed the min/max,) whereas in this case you would have to jump by 0.5.

commented

The reasons to avoid decimals are for internal representation purposes, not for output, and even so they probably don't apply when dealing with powers of 0.5. Considering the GUI, full hearts is a more natural mapping. Sure, it's stored as half-hearts (due to the reasons for avoiding decimals), but that's an internal representation; there's no reason to consider that when deciding how to display output or take input.

Of course, it's true that you can't have a value of 8.6, but it's easy to just round that off to 8.5.