Set base_exp gain to 0 at certain level

Salty

New member
Messages
5
Points
0
Hello!
I know I found this source edit somewhere on the forums here a while ago but I can't for the life of me find it anywhere.

Essentially I want to make it so that when a player reaches level 195, their base experience gain from any monster kill is set to 0. This essentially soft caps the max level to 195 until a player does a

quest chain to reach level 200, which is the real maximum.

I'm pretty sure it's an easy config in the mob.c file but I can't seem to remember where to put it.

 
I just solved the other topic by reading the mob_dead function ... LOL

#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/nullpo.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = { "NoEXP_Gain", SERVER_TYPE_MAP, "0.1", HPM_VERSION,};int max_lv_exp_gain = 99;int pc_checkbaselevelup_pre( struct map_session_data *sd ) { nullpo_ret(sd); if ( (int)sd->status.base_level >= max_lv_exp_gain ) { sd->status.base_exp = 0; hookStop(); return false; } return true;}HPExport void plugin_init (void) { addHookPre( "pc->checkbaselevelup", pc_checkbaselevelup_pre );}just like this is enough,this line in mob.c

party->exp_share(pt.p, &md->bl, pt.base_exp,pt.job_exp,pt.zeny);I saw party_exp_share function also runs pc_gainexp function, so just hook this 1 function enough
EDIT: erm ... it seems to block job_exp gain ... now fixing ...

EDIT2: ok done

 
Last edited by a moderator:
I am unfamiliar with hooks.

Do I place the code you wrote at the top of mob.c or does it go in a specific location?

 
http://herc.ws/wiki/Hercules_Plugin_Manager
Code:
//===== Hercules Plugin ======================================//= Maximum Level Exp Gain//===== By: ==================================================//= AnnieRuru//===== Current Version: =====================================//= 0.2//===== Compatible With: ===================================== //= Hercules 2015-12-19//===== Description: =========================================//= stop players from gaining exp after certain level//===== Topic ================================================//= [URL="https://boardtest.herc.ws/topic/11510-set-base-exp-gain-to-0-at-certain-level//====="]http://herc.ws/board/topic/11510-set-base-exp-gain-to-0-at-certain-level//=====[/URL] Additional Comments: =================================  //= the 1st one I did has a battle config//============================================================#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/nullpo.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = {	"MaxLvExpGain",	SERVER_TYPE_MAP,	"0.2",	HPM_VERSION,};int max_lv_exp_gain = 99;void battle_config_setting( const char *key, const char *val ) {	if ( !strcmpi( key, "max_lv_exp_gain" ) )		max_lv_exp_gain = atoi(val);}int return_battle_config( const char *key ) {	if ( !strcmpi( key, "max_lv_exp_gain" ) )		return max_lv_exp_gain;	return 0;}int pc_checkbaselevelup_pre( struct map_session_data *sd ) {	nullpo_ret(sd);	if ( (int)sd->status.base_level >= max_lv_exp_gain ) {		sd->status.base_exp = 0;		hookStop();		return false;	}	return true;}HPExport void server_preinit (void) {	addBattleConf( "max_lv_exp_gain", battle_config_setting, return_battle_config );}HPExport void plugin_init (void) {	addHookPre( "pc->checkbaselevelup", pc_checkbaselevelup_pre );}
hahaha ...
 
Last edited by a moderator:
Back
Top