so i want to spawn an npc and when i click on it i have an ui so i know how to send an ui but how to spawn an npc ?
theres a plugin called slapper its on poggit.pmmp.io and it has a ton of commands i which you can use to spawn clickable npcs just download the .phar file for it put it in your plugins folder in pocket mine then turn on the server and when u go back in there will be a list of commands to spawn an npc slapper spawn (type) (Name) example: slapper spawn human Human This will spawn an npc named human with your skin and where u where facing to add a command to it after u spawn it will give you an entity id which then you use in the command /slapper edit (ID) addcommand (command) example: /slapper edit 4 addcommand say This is a work in progress to get a ui to display with a slapper click you have to make your ui pop up with a command if u dont know how to do this i will put a paste bin here https://pastebin.com/YSCJHA4T now just do /slapper edit (ID) addcommand FFA and if u have a FormAPI UI in the PHP file and in your plugin.yml have the command listed with the correct line up it will work
PHP: <?phpuse pocketmine\Entity\Zombie;use pocketmine\event\Listener;use pocketmine\plugin\PluginManager;use pocketmine\server;use pocketmine\Entity\Monster;use pocketmine\plugin\PluginBaseclass (Your File Name) extends PluginBase{ const NETWORK_ID = 32; public $width = 0.6; public $height = 1.8; public $eyeHeight = 1.62;public function getNameTag(): string{ return "Zombie";} public function onWhateverUWant (){ $zombie = new \pocketmine\entity\Zombie($pos->getLevel(), \pocketmine\entity\Zombie::createBaseNBT($pos, new \pocketmine\math\Vector3(0,0,0))); $zombie->spawnToAll ();}} Thats The Base On How To Spawn A Zombie With Code