Skip to content

ModPE Custom Functions

Minecraftdominator edited this page Feb 18, 2015 · 5 revisions

Player

Player.addHealth

function Player.addHealth(amount){
    Entity.setHealth(getPlayerEnt(), Entity.getHealth(getPlayerEnt()) + amount);
}
  • This function adds the specified health to the player's current health.
  • The parameter amount accepts an integer.

Example: Player.addHealth(5);

Player.removeHealth

function Player.removeHealth(amount){
    Entity.setHealth(getPlayerEnt(), Entity.getHealth(getPlayerEnt()) - amount);
}
  • This function acts like Player.addHealth, but it removes the specified health from the player instead of adding it
  • The parameter amount accepts an integer.

Example: Player.removeHealth(5);

Player.getHealth

function Player.getHealth(){
    return Entity.getHealth(getPlayerEnt());
}
  • This function is a variant of Entity.getHealth(getPlayerEnt());
  • This function can be used to quickly alter the player's health.

Example: Player.setHealth(Player.getHealth() - 1);

Clone this wiki locally