Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mob tap to run code

Comments in 'Plugin Development' started by korado531m7, Mar 14, 2016.

  1. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    How to write?
    I know 1 mob. but, using different mobs, i don't know. please tell me.
  2. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    do you mean this
    PHP:
    if($entity instanceof \pocketmine\entity\NameMobsHere){ 

    //$damager = Player Touch The Mobs
    }
  3. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Yes. but, how to run different code for different mobs?
    Is that 1 mob?
  4. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Do You Mean IF Player Touch Any Mobs !
  5. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    yes
  6. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    i think that is true
    PHP:
    if($entity instanceof \pocketmine\entity\Zombie || 
    $entity instanceof \pocketmine\entity\Sheep ||
     
    /* etc... Mobs */){

    }
  7. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Thank you
    And I have another question.
    How to write this code "if player hit entity id=XXX"?

Share This Page

Advertisement