package mzsJVM.Event;
import mzsJVM.IScriptEventHandler;
import org.nwnx.nwnx2.jvm.*;
import org.nwnx.nwnx2.jvm.constants.Weather;

@SuppressWarnings("unused")
public class Module_OnHeartbeat implements IScriptEventHandler {
	@Override
	public void runScript(NWObject objSelf) {

		if (NWScript.getLocalInt(NWObject.MODULE, "sWeathersChange") == NWScript.getTimeHour()) return;

		NWScript.deleteLocalInt(NWObject.MODULE, "sWeathersChange");
		NWScript.setLocalInt(NWObject.MODULE, "sWeathersChange", NWScript.getTimeHour());

		if (NWScript.random(100) <= 30) // A percentile roll. DEFAULT: 30%.
		{
			NWScript.setWeather(NWObject.MODULE, Weather.RAIN);
		}
		else
		{
			NWScript.setWeather(NWObject.MODULE, Weather.CLEAR);
		}
	}
}


@@ -273,16 +273,36 @@
 elf) %7B%0A%0A
+%09%09SaveCharacters();%0A
 %09%09if (NW
@@ -747,11 +747,344 @@
 %0A%09%09%7D%0A%09%7D%0A
+%0A%09// Export all characters every minute.%0A%09private void SaveCharacters()%0A%09%7B%0A%09%09int currentTick = NWScript.getLocalInt(NWObject.MODULE, %22SAVE_CHARACTERS_TICK%22) + 1;%0A%0A%09%09if(currentTick %3E= 10)%0A%09%09%7B%0A%09%09%09NWScript.exportAllCharacters();%0A%09%09%09currentTick = 0;%0A%09%09%7D%0A%0A%09%09NWScript.setLocalInt(NWObject.MODULE, %22SAVE_CHARACTERS_TICK%22, currentTick);%0A%09%7D%0A%0A
 %7D%0A%0A

Save characters every minute.