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

spawn npc error

Discussion in 'Development' started by Harviy11, Nov 18, 2016.

  1. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    hello i cant spawn npc by command it give me error
    PHP:
    elseif($cmd[0] === "/npc"){
             
    $npc = new Human($player->chunk,
             
    $block->cos($player->yaw M_PI 180);
             
    $block->sin($player->yaw M_PI 180);
             new 
    CompoundTag("", [
             
    "Pos" => new ListTag("Pos", [
             new 
    DoubleTag(""$block->getX()),
             new 
    DoubleTag(""$block->getY()),
             new 
    DoubleTag(""$block->getZ())
             ]),
             
    "Motion" => new ListTag("Motion", [
             new 
    DoubleTag(""0),
             new 
    DoubleTag(""0),
             new 
    DoubleTag(""0)
             ]),
             
    "Rotation" => new ListTag("Rotation", [
             new 
    FloatTag(""90),
             new 
    FloatTag(""0)
             ]),
             
    "Skin" => new CompoundTag("Skin", [
             
    "Data" => new StringTag("Data"$player->getSkinData())
             ])
             ]
             ));



        
    $npc->spawnToAll();
        
    $npc->setDataProperty(Entity::DATA_NAMETAGEntity::DATA_TYPE_STRING"§l§9Annihilation1");
        
    $npc->setDataProperty(Entity::DATA_SHOW_NAMETAGEntity::DATA_TYPE_BYTE1);
       {
    error:
    [Server thread/CRITICAL]: ParseError: "syntax error, unexpected ';', expecting ',' or ')'" (EXCEPTION) in "myzip:///WCore.zip#WCore/src/WallCore/Main" at line 191


    HELP ME PLS
     
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    What is line 191?
     
  3. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    PHP:
    <?php
    if($cmd[0] === "/npc"){
             
    $block->cos($player->yaw M_PI 180);
             
    $block->sin($player->yaw M_PI 180);
             new 
    CompoundTag("", [
             
    "Pos" => new ListTag("Pos", [
             new 
    DoubleTag(""$block->getX()),
             new 
    DoubleTag(""$block->getY()),
             new 
    DoubleTag(""$block->getZ())
             ]),
             
    "Motion" => new ListTag("Motion", [
             new 
    DoubleTag(""0),
             new 
    DoubleTag(""0),
             new 
    DoubleTag(""0)
             ]),
             
    "Rotation" => new ListTag("Rotation", [
             new 
    FloatTag(""90),
             new 
    FloatTag(""0)
             ]),
             
    "Skin" => new CompoundTag("Skin", [
             
    "Data" => new StringTag("Data"$player->getSkinData())
             ])
             ]
             ); 
    //You had a double ) here
     
  4. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    $npc = new Human($player->chunk,
     
  5. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    i removed double ) and do not fixed my problem
    line 191 is
    PHP:
    $npc = new Human($player->chunk,
     
  6. imYannic

    imYannic Baby Zombie

    Messages:
    113
    You have obviously an error in the long CompoundTag / NBT code. By the way, is the last {} supposed to be { instead of }
     
  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.