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

ITem stats

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

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    How can I make item stats? It counts how many kills every sword has, so like its the item that has status.

    I tried setting lore (the kills)to the item in hand but it don't go as expected.
     
  2. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    You can create an id for each sword when someone gets one and then check the id of sword on your data, when someone kills with those sword it gives one more point for that sword, to display the kills of a sword just send it with sendTip or sendPopup, simple!
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    How do i give id?
     
  4. Pab45O

    Pab45O Spider Jockey

    Messages:
    37
    GitHub:
    Pab450
    I think you can use setNamedTag() with nbt tag, im not good on this but i think you can make something like that ->

    PHP:
    $kills = new IntTag("Kills"12); //kills
    $nbt = new CompoundTag("stats", [$kills]);

    $item->setNamedTag($nbt);
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    shouldnt the inttag be random
     
  6. Pab45O

    Pab45O Spider Jockey

    Messages:
    37
    GitHub:
    Pab450
    Wtf ?
     
  7. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    how am i supposed to update the kills
     
  8. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Ya but I think u can get name tag by this not sure
    PHP:
    $kills = new IntTag("Kills"12);
    $nbt = new CompoundTag("stats", [$kills]);
    $item->getNamedTag($nbt);
     
  9. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    im not trying to get the nametag
     
  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.