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

Help me to spawn an NPC

Discussion in 'Plugin Help' started by Noxi69, Jun 11, 2020.

  1. Noxi69

    Noxi69 Spider

    Messages:
    10
    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 ?
     
  2. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    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
     
  3. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    if u need more help tell me what the text needs to be and i can prolly make the plugin for you.
     
  4. Noxi69

    Noxi69 Spider

    Messages:
    10
    i dont want to download plugin i want to know how to create an entity and spawn it
     
  5. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    Thats how it works theres no way to just spawn one out of thin air
     
  6. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    You can spawn any entity you want. Do not give fake information please.
     
  7. Noxi69

    Noxi69 Spider

    Messages:
    10
    So how to spawn an entity give me the code pls
     
  8. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    113
    GitHub:
    jviguy
    PHP:
    <?php
    use pocketmine\Entity\Zombie;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginManager;
    use 
    pocketmine\server;
    use 
    pocketmine\Entity\Monster;
    use 
    pocketmine\plugin\PluginBase

    class (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
     
  9. Noxi69

    Noxi69 Spider

    Messages:
    10
    thanks
     
  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.