How to set a custom HP to a armor?

Discussion in 'Plugin Development' started by Soldado_08, Apr 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Soldado_08

    Well, i'm making a command that will give me a armor, with a lore showing how much HP this armor should give. Like this:
    [​IMG] < This is a random HP.
    But now, I want that when I put the armor, my life increase. According to the HP in the lore.
    For example: My base HP is 50, and if I put a armor that gives me 5045 HP, i will get 5096 HP.
    PS: I already set the BossBar to show me my HP.
    [​IMG]


    Thanks for you patience, and sorry for my bad english =P
     
  2. Offline

    rfsantos1996

    setMaxHealth(double) will do the work. setMaxHealth(<health base> + <bonus health>);

    E você é brasileiro, certo (ou português)?
     
  3. Offline

    Soldado_08

    Sim, br kkk

    Consegui fazer assim :D Brigado!
    Mas teria como eu associar o hp da armadura com o hp que o player vai ficar quando vestir a armadura? Por exemplo, eu queria que quando o player colocasse a armadura, iria aumentar o hp dele, e quando tirasse a armadura, iria voltar ao hp normal. Por que por enquanto, quando o player da o comando, o hp dele ja sobe, sem precisar colocar a armadura.

    English:
    But I would associate with the armor hp that player will get while wearing armor. For example, I want that when the player put the armor would increase the hp of it, and when to take off his armor, would return to normal hp. For now, when the player's command, his hp rises without putting the armor.
     
  4. Offline

    rfsantos1996

    Você pode ver as armaduras do jogador pra ver quanto HP a mais ele vai ter em cada click do inventario, então quando ele equipa algo ja irá atualizar seu HP.

    Use o evento InventoryClickEvent ou algo do tipo, pegue todos seus equipamentos e veja seus atributos.

    You can check player's armor on every inventory click, so when he equip or unequip an item, you can update their HP based on item's atributes.

    Use InventoryClickEvent or similar, get the armor from the player and see its atributes.
     
  5. Offline

    Soldado_08

    Okay, i will try it, can you add me in skype? gustavo.290998
    thanks ;)
     
Thread Status:
Not open for further replies.

Share This Page