Is there anyone who's proficient in ModPE that would mind teaching me a bit? There's surprisingly little info on writing script for MCPE. I've been learning JavaScript on codecademy and I used to do a lot of scripting for Morrowind back when making mods for it was popular. I was good at that, and I learned quick because there were a ton of resources to learn from, including examples of each function and their use. I hope someone will help me out, I have a few good ideas for mods that I'd like to make and contribute here. I'm just having a terrible time finding info. Thanks!
I wrote a small script as a test project, but I can't get it working.
//gives the player natural regen
var pH = Entity.getHealth(Player.getEntity());
var ticks = 20 * 300;
//every 5 minutes, recover half a heart
function modTick() {
ticks--;
if (ticks === 0) {
Player.setHealth(pH + 1);
}
};
Can anyone tell me why this script crashes as soon as its enabled? I appreciate any help you guys can give me. Thanks!
== mean return is true
maybe you need using ==
var countdown = 20 * 300;
function modTick() {
var pH = Entity.getHealth(getPlayerEnt());
if(countdown >= 0) {
countdown--;
}
if(countdown == 0) {
Player.setHealth(pH + 1);
}
}