Ideas on Damage severity

Discussion in 'Development' started by minijaham, Feb 20, 2021.

  1. minijaham

    minijaham Zombie Pigman

    Messages:
    737
    GitHub:
    minijaham
    Hey! I am currently making a single-player RPG plugin.

    I'm planning to add something like a damage indicator where colors differ depending on the severity of the damage recieved.

    I had an idea to do something like
    LastDamage (math thingy) with MaxHealth

    Which I can't recall doing because my brain is too small to remember things from the past and I need your help to do math things!!!!!
     
  2. EndermannbugZJFC

    EndermannbugZJFC Slime

    Messages:
    75
    GitHub:
    endermanbugzjfc
    PHP:
    $severity $player->getHealth() - $player->getLastDamageCause()->getFinalDamage();

    if (
    $serverity 3); // Do stuff  if health lower than 3

    switch ($serverity) {
        case 
    3:
            
    // Do stuff if health equals 3
            
    break;

        default:
            
    // Else...
            
    break;
    }
     
    minijaham likes this.

Share This Page

  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.