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

How to send bossbar these days

Discussion in 'Development' started by Levi, Jun 18, 2018.

  1. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Code:
    $z->getId();
    
    just replace it with id of zombie entity.
    it's defined under $z variable
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Code:
    [16:41:16] [Server thread/CRITICAL]: Unhandled exception executing command 'testc' in testc: Argument 1 passed to pocketmine\utils\BinaryStream::putUnsignedVarInt() must be of the type integer, null given, called in phar://C:/Users/arjxy/Desktop/pocketmine/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/BossEventPacket.php on line 115
    [16:41:16] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\utils\BinaryStream::putUnsignedVarInt() must be of the type integer, null given, called in phar://C:/Users/arjxy/Desktop/pocketmine/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/BossEventPacket.php on line 115" (EXCEPTION) in "vendor/pocketmine/binaryutils/src/BinaryStream" at line 230
    
    PHP:
    $pk = new AddEntityPacket();
            
    $pk->type Entity::ZOMBIE;
            
    $pk->entityRuntimeId Entity::$entityCount++;
            
    $pk->position = new Vector3();
            
    $pk->metadata[Entity::DATA_NAMETAG] = [Entity::DATA_TYPE_STRING"Title"];
            
    $sender->dataPacket($pk);

            
    $pbk = new BossEventPacket();
            
    $pbk->bossEid = (int)32;
            
    $pbk->eventType BossEventPacket::TYPE_SHOW;
            
    $pbk->healthPercent 1;
    $pbk->playerEid $sender->getId();
            
    $pbk->title "hi";
            
    $sender->dataPacket($pbk);
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    anybody
     
  4. fycarman

    fycarman Creeper

    Messages:
    2
    PHP:
    $id Entity::$entityCount++;
    $pk = new AddEntityPacket();
    $pk->type Entity::ARROW;
    $pk->entityRuntimeId $id;
    $pk->position $player->asVector3();
    $pk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING"text"]];
    $player->dataPacket($pk);

    $pk = new BossEventPacket();
    $pk->bossEid $id;
    $pk->playerEid $player->getId();
    $pk->eventType BossEventPacket::TYPE_SHOW;
    $pk->healthPercent 100;
    $pk->unknownShort 1;
    $pk->color 1;
    $pk->overlay 1;
    $pk->title "text";
    $player->dataPacket($pk);
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    i have that in repeating task. and the bossbar created 3 bossbars
     
  6. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    that spawns arrows wth
     
  7. fycarman

    fycarman Creeper

    Messages:
    2
    1. Why do you use a repeating task for sending the boss bar? Explain what you're trying to do and we will be able to help.
    2. You can replace
    PHP:
    Entity::ARROW
    to whatever you want, It was an example.
     
  8. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    I have a live timer in bossbar, it won't update if i just send it once, rigght
     
  9. Joao Nunes

    Joao Nunes Spider Jockey

    Messages:
    30
    GitHub:
    joaonunes12
    How can I change the color of the bossbar? I tried to change the $ this->color but it was not.
     
  10. Fadhel

    Fadhel Witch

    Messages:
    68
    GitHub:
    dimbis
    you cannot change the color of it in MC:Bedrock. The color variable does nothing.
     
  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.