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

How to make entity attact player?

Discussion in 'Help' started by NeoZ04, Aug 17, 2018.

  1. NeoZ04

    NeoZ04 Spider

    Messages:
    11
    GitHub:
    neoz04
    How to make entity attact player?
     
  2. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    @param Entity $theplayetplayer
    */
    public function attackEntity(Entity $theplayer){
    if($this->attackDelay > 10 && $this->distanceSquared($player) < 2){
    $this->attackDelay = 0;

    $damage = $this->getDamage();
    if($this->getMobEquipment() !== null){
    $damage = $damage + $this->getMobEquipment()->getWeaponDamageToAdd();
    }
    $v = new EntityDamageByEntityEvent($this, $player, EntityDamageEvent::CAUSE_ENTITY_ATTACK,
    MobDamageCalculator::calculateFinalDamage($player, $damage));
    $player->attack($ev);
    $this->checkTamedMobsAttack($theplayer);
    }
     
    NeoZ04 likes this.
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Attack or attract?
     
  4. NeoZ04

    NeoZ04 Spider

    Messages:
    11
    GitHub:
    neoz04
    Attact
     
  5. hikingjungle

    hikingjungle Baby Zombie

    Messages:
    123
    GitHub:
    hikingjungle
    ?
     
  6. hikingjungle

    hikingjungle Baby Zombie

    Messages:
    123
    GitHub:
    hikingjungle
    attack past tense?
     
    Awzaw likes this.
  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.