Hi~
I tried to add a custom event OnPCStatCalcEvent to run item script
in npc
src/map/script.c
"OnPCStatCalcEvent",//StatCalcEvent_name
src/map/script.h
const char *StatCalcEvent_name;
src/map/npc.c
{"StatCalcEvent",script_config.StatCalcEvent_name},
src/map/npc.h
NPCE_PCStatCalc,
src/map/status.c
+ npc_script_event(sd,NPCE_PCStatCalc);
+ if (!calculating)
+ return 1;
// ----- STATS CALCULATION -----
and a script command
BUILDIN_FUNC(CalcCharStat)
{
TBL_PC *sd;
if( script_hasdata(st,2) )
sd=map_id2sd(script_getnum(st,2)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
if(sd==NULL){
script_pushint(st,-1);
return 0;
}
status_calc_pc(sd,0);
return 0;
}
BUILDIN_DEF(CalcCharStat,"?"),
my test script
morocc,141,101,4 script eventtset 112,{
set cstate,!cstate;
dispbottom "the [cstate] value now is:"+cstate;
CalcCharStat;
close;
OnPCStatCalcEvent:
if(cstate){
bonus3 bAutoSpell,48,5,1000;
bonus bStr,100;
}
end;
}
When cstate=1 the bAutoSpell working as intended
but the bStr not work immediately ,Only when re-login character
or take off/on equipment , Character's status will be updated
My problem is how to update Character's status immediately whithout
re-logining or taking off/on equipment ?