Hey, I'm new to pocketmine. How would i make it so villagers attack back and have a good reach and make it look like aim aura and also change the size Please send a code thanks!
PHP: <?phpnamespace Johanna;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\nbt\tag\CompoundTag;use pocketmine\nbt\tag\DoubleTag;use pocketmine\nbt\tag\FloatTag;use pocketmine\nbt\tag\ListTag;use pocketmine\Player;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\entity\Entity;use pocketmine\event\entity\EntityDamageByEntityEvent;use pocketmine\event\entity\EntityDeathEvent;use pocketmine\scheduler\Task;use pocketmine\level\Level;use pocketmine\level\Position;use pocketmine\item\Item;use pocketmine\utils\Config;use pocketmine\command\CommandSender;use pocketmine\command\Command;use pocketmine\command\PluginCommand;class Main extends PluginBase implements Listener { public function onEnable() : void{ @mkdir ($this->getDataFolder()); $this->c = new Config($this->getDataFolder() . "Config.yml", Config::YAML, [ "maxhealth" => "30000", "maxscale" => "6", ]); $this->db = $this->c->getAll(); $this->getServer()->getPluginManager()->registerEvents($this, $this); if (! $this->getServer()->isLevelGenerated("Boss")) { $this->getServer()->generateLevel("Boss", null, "FLAT"); } if (! $this->getServer()->isLevelLoaded("Boss")) { $this->getServer()->loadLevel("Boss"); } $this->cmd = new PluginCommand("boss", $this); $this->cmd->setDescription("boss Command"); $this->getServer()->getCommandMap()->register("Boss", $this->cmd); $this->getScheduler()->scheduleDelayedTask(new class ($this) extends Task { private $owner; public function __construct(Main $owner) { $this->owner = $owner; } public function getOwner() { return $this->owner; } public function onRun(int $currentTick) { $nbt = new CompoundTag('', [ 'Pos' => new ListTag('Pos', [ new DoubleTag('', 1), new DoubleTag('', 75), new DoubleTag('', 1) ]), 'Motion' => new ListTag('Motion', [ new DoubleTag('', 0), new DoubleTag('', 0), new DoubleTag('', 0) ]), 'Rotation' => new ListTag('Rotation', [ new FloatTag('', lcg_value() * 360), new FloatTag('', 0) ]), ]); $entity = Entity::createEntity(Entity::ZOMBIE, $this->owner->getServer()->getLevelByName("Boss"), $nbt); $entity->setMaxHealth(100); $entity->setHealth(100); $entity->setScale(10); $entity->spawnToAll(); $this->owner->getServer()->broadcastMessage ("§f[§dElixir§fPvP] §c A Boss Has Spawned!"); } }, 20); } public function onDeath(EntityDeathEvent $event) { $entity = $event->getEntity(); if ($entity instanceof \pocketmine\entity\hostile\Zombie) { $nbt = new CompoundTag('', [ 'Pos' => new ListTag('Pos', [ new DoubleTag('', 253), new DoubleTag('', 4), new DoubleTag('', 253) ]), 'Motion' => new ListTag('Motion', [ new DoubleTag('', 0), new DoubleTag('', 0), new DoubleTag('', 0) ]), 'Rotation' => new ListTag('Rotation', [ new FloatTag('', lcg_value() * 360), new FloatTag('', 0) ]), ]); $entity = Entity::createEntity(Entity::ZOMBIE, $this->getServer()->getLevelByName("Boss"), $nbt); $entity->setMaxHealth($this->db["maxhealth"]); $entity->setHealth($this->db["maxhealth"]); $entity->setScale($this->db["maxscale"]); $entity->spawnToAll(); $this->getServer()->broadcastMessage ("§f[§dElixir§fPvP] §c A Boss Has Spawned!"); } } public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{ if ($command->getName() === "Boss") { if (! isset ($args[0])) { $sender->sendMessage("/ Boss Stamina <Health> \ n / Boss Size <Size>"); return true; } if ($args[0] === "Boss Stamina") { if (! isset ($args[1]) or ! is_numeric($args[1])) { $sender->sendMessage("Please enter numbers"); return true; } $this->db["maxhealth"] = $args[1]; $sender->sendMessage($args[1] . " As the Boss Health"); $this->save(); } if ($args[0] === "size") { if (! isset ($args[1]) or ! is_numeric($args[1])) { $sender->sendMessage("Please enter numbers"); return true; } $this->db["maxscale"] = $args[1]; $sender->sendMessage($args[1] . " Is set to default size"); $this->save(); } } } public function onDisable() : void{ $this->save(); } public function save() { $this->c->setAll($this->db); $this->c->save(); }} Here is my code can you show me how to make it attack make it hit faster or do more damage etc