-
Notifications
You must be signed in to change notification settings - Fork 6
ModPE Custom Functions
Minecraftdominator edited this page Feb 18, 2015
·
5 revisions
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
amountaccepts an integer.
Example: Player.addHealth(5);
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
amountaccepts an integer.
Example: Player.removeHealth(5);
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);