1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Damage done

Discussion in 'Development' started by Hipster, Dec 30, 2016.

  1. Hipster

    Hipster Zombie

    Messages:
    214
    How to get how much damage was taken by the player from the entitydamageevent?
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Have you looked in (src\pocketmine\event\entity\EntityDamageEvent)?

    PHP:
    public function onDamage(EntityDamageEvent $event) {
      
    //Checks if the damaged entity is a Player
      
    if($event->getEntity() instanceof Player) {
        
    //Gets the damage dealt to the Player.
        
    $event->getDamage();
        }
      }
     
    applqpak and Hipster like this.
  3. Hipster

    Hipster Zombie

    Messages:
    214
    Oh sorry, i am new
     
  4. Aviv

    Aviv Baby Zombie

    Messages:
    156
    That could be wrong, if you want to know how much damage was dealt after calculating the armor/effect modifiers?
    for that use
    PHP:
    $event->getFinalDamage();
    Whaat?? im pretty sure i used entitydamageevent and it worked fine
     
  5. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You're mistaken for the EntityDamageByEntityEvent ;)
     
  6. Primus

    Primus Zombie Pigman

    Messages:
    749
    True, I deleted my post.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.