CITIZENS API: NPC's not getting hurt

Discussion in 'Plugin Development' started by Monkeyboystein, Jul 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Monkeyboystein

    Im trying to spawn NPC's for a game and theyre not getting hurt when i hit them!
    Code:java
    1. if(args[0].equals("create"){
    2. NPCRegistry registry = CitizensAPI.getNPCRegistry();
    3.  
    4. if(args[1].equalsIgnoreCase("Red")) {
    5. NPC npc = registry.createNPC(EntityType.PLAYER, "Red");
    6. npc.spawn(p.getLocation());
    7.  
    8. npc.getBukkitEntity().setMaxHealth((double)getConfig().getInt("NexusHealth"));
    9. npc.getBukkitEntity().setHealth((double)getConfig().getInt("NexusHealth"));
    10. npc.setName(ChatColor.GREEN +args[1]);
    11. npc.getBukkitEntity().getEquipment().setHelmet((new ItemStack(Material.WOOL, 1, (short) 14)));
    12. return true;
    13. }
    14. }
    15.  


    what am i doing wrong?
     
  2. Offline

    soulofw0lf

    you'll probably be better off asking on a citizens page
     
  3. Offline

    Monkeyboystein

    thanks,
     
  4. Offline

    xTrollxDudex

  5. Offline

    Monkeyboystein

    im starting to think it doesnt but they why isnt it getting hurt?
     
  6. Offline

    Theodossis

    I had that problem to. You can use NPCDamageEvent even the citizen isn't damaged.
     
Thread Status:
Not open for further replies.

Share This Page