Blockland Forums > Modification Help
Player variables
YourBuddyBill:
Can someone tell me all the player 'variables' such as Health, Energy, etc.?
I'm trying to figure out what other depletable variables to add to a 'refresh' item.
Ipquarx:
Do a dump of a clients player object to see all the functions and variables you can use.
Type this in the console to do that:
findClientByName(enternamehere).player.dump();
Chrono:
For health:
.getDamageLevel() (higher = less health, once this reaches the datablock's maxDamage value, the player dies)
Gets the current damage the player has taken.
.setDamageLevel(number)
Sets the current damage the player has taken.
.setHealth(number) (event function, but can be used without events)
Sets the players health.
.addHealth(number) (event function, but can be used without events)
Heals the player.
.getDatablock().maxDamage
This is the player's maximum health, do not change it.
For energy:
.getEnergyLevel() (opposite of health, higher = more energy, can only be as high as the datablock's maxEnergy value, cannot use jets at 0, and cannot use certain features depending on other datablock values)
Gets the player's current energy.
.setEnergyLevel(number)
Sets the player's current energy.
.getDatablock().maxEnergy
Gets the player's maximum energy, do not change this.
I'm pretty sure there aren't any other 'depletable variables' aside from health and energy.
To heal both of these, would be as simple as:
%obj.setDamageLevel(0);
%obj.setEnergyLevel(%obj.getDatablock().maxEnergy);
phflack:
what happens if you change the variables? would it throw up an error or just go with the new value?
Chrono:
--- Quote from: phflack on March 23, 2012, 12:24:25 AM ---what happens if you change the variables? would it throw up an error or just go with the new value?
--- End quote ---
It'll change it for every player using that datablock.