To answer your question, it has to be completely redone. The code is terrible, and your abusing schduleevent as if it was a timeout :/. I might release delterias Baddie system on the forums soon. You could probably at least learn from it.
PHP Code:
//Can be Used for Baddies
public function addMobExperience(temp.mob_level, temp.mob_base_exp) {
// Find XP multiplier
temp.curr_level = this._get("pve_level"); //Player Level (clientr.pve_level)
temp.level_difference = temp.mob_level - temp.curr_level; //Mob Level
temp.difference = max(-5, min(temp.level_difference, 5)); //Difference
temp.multiplier = (1 + temp.difference/5); //Multiplier
// Add experience
addExperience(temp.mob_base_exp * temp.multiplier);
}
//Can be used for Quests etc
public function addExperience(temp.amount) {
temp.amount *= 1; //Incase you have events like double EXP
temp.curr_exp = this._get("pve_exp"); //clientr.pve_exp
temp.curr_exp += temp.amount;
// Check if we reached a new level
if (temp.curr_exp >= this._get("pve_nextlevelexp")) {
/* Only used on Delteria
// Add enchantment point when leveling up
temp.enchantment_points = this._get("enchantment_points");
this._set("enchantment_points", temp.enchantment_points + 1);
*/
temp.new_level = this._get("pve_level") + 1; //clientr.pve_level + 1;
/* If you want them to still gain EXP for extra things like CMD Points after max level (25)
if (temp.new_level >= 26) {
// reset experience points so they can get more enchantment points
this._set("pve_exp", 0);
return;
}
*/
this._set("pve_level", temp.new_level); //clientr.pve_level = temp.new_level;
this._set("pve_exp", 0); //clientr.pve_exp = 0;
this._set("pve_nextlevelexp", 1000 * temp.new_level); //clientr.pve_nextlevelexp = 1000 * temp.new_level
//Floating Text to Display player leveling up
this.triggerclient("weapon", "Player/DamageDisplay", "text2",
player.x - random(0, 1),
player.y + random( -.5, 1),
"Level Up! (" SPC clientr.pve_level SPC ")",
255, 128, 0, 0, "blue"
);
this.updateProperties(); //Updat properties (only used on Delteria)
} else {
this._set("pve_exp", temp.curr_exp);
this.sendNotification("You gained" SPC temp.amount SPC "experience!", 1, "expicon.png", "");//Iphone Notification
}
}