Hello, There! i would like to ask for pleased support for the 'OnPCStatCalcEvent'
How do i set only minimum of +50 Only?
PLEASE correct me if i post in the wrong SECTION since i have posted Script + Source.
SCRIPT:
mes "which bonus do you want ?";
mes "NOTE: each of stat is only +1 UPGRADE until you reach the maximum +50";
next;
.@s = select ( "str +1", "agi +1", "vit +1", "int +1", "dex +1", "luk +1" ) -1;
if ( bonus_stat & 1 << .@s ) {
mes "You already reach the maximum bonus stats";
close;
}http://rathena.org/board/index.php?app=forums&module=post§ion=post&do=new_post&f=36
bonus_stat = bonus_stat | 1 << .@s;
nude;
close;
OnPCStatCalcEvent:
for ( .@i = 0; .@i < 6; .@i++ )
if ( bonus_stat & 1 << .@i )
bonus .@i + 13, 1;
end;
}
SOURCE:
Index: clif.c
===================================================================
--- clif.c (revision 17007)
+++ clif.c (working copy)
@@ -9359,6 +9359,8 @@
clif_broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF);
}
+ status_calc_pc(sd,0); // run OnPCStatCalcEvent
+
map_iwall_get(sd); // Updates Walls Info on this Map to Client
sd->state.changemap = false;
}
Index: npc.c
===================================================================
--- npc.c (revision 17007)
+++ npc.c (working copy)
@@ -3560,6 +3560,7 @@
{"Die Event",script_config.die_event_name},
{"Kill PC Event",script_config.kill_pc_event_name},
{"Kill NPC Event",script_config.kill_mob_event_name},
+ {"Stat Calc Event",script_config.stat_calc_event_name},
};
for (i = 0; i < NPCE_MAX; i++)
Index: npc.h
===================================================================
--- npc.h (revision 17007)
+++ npc.h (working copy)
@@ -103,6 +103,7 @@
NPCE_DIE,
NPCE_KILLPC,
NPCE_KILLNPC,
+ NPCE_STATCALC,
NPCE_MAX
};
struct view_data* npc_get_viewdata(int class_);
Index: script.c
===================================================================
--- script.c (revision 17007)
+++ script.c (working copy)
@@ -247,6 +247,7 @@
"OnPCLoadMapEvent", //loadmap_event_name
"OnPCBaseLvUpEvent", //baselvup_event_name
"OnPCJobLvUpEvent", //joblvup_event_name
+ "OnPCStatCalcEvent", //stat_calc_event_name
"OnTouch_", //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)
"OnTouch", //ontouch2_name (run whenever a char walks into the OnTouch area)
};
@@ -17269,6 +17270,19 @@
return 0;
}
+BUILDIN_FUNC(stat_recalc) {
+ TBL_PC* sd;
+ if ( script_hasdata( st, 2 ) ) {
+ if ( data_isstring( script_getdata( st, 2 ) ) )
+ sd = map_nick2sd( script_getstr( st, 2 ) );
+ else
+ sd = map_id2sd( script_getnum( st, 2 ) );
+ } else
+ sd = script_rid2sd(st);
+ if ( sd )
+ status_calc_pc( sd, 0 );
+ return 0;
+}
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
@@ -17726,5 +17740,7 @@
BUILDIN_DEF(checkquest, "i?"),
BUILDIN_DEF(changequest, "ii"),
BUILDIN_DEF(showevent, "ii"),
+
+ BUILDIN_DEF(stat_recalc, "?"),
{NULL,NULL,NULL},
};
Index: script.h
===================================================================
--- script.h (revision 17007)
+++ script.h (working copy)
@@ -28,6 +28,7 @@
const char *loadmap_event_name;
const char *baselvup_event_name;
const char *joblvup_event_name;
+ const char *stat_calc_event_name;
const char* ontouch_name;
const char* ontouch2_name;
Index: status.c
===================================================================
--- status.c (revision 17007)
+++ status.c (working copy)
@@ -2423,6 +2423,8 @@
pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
+ npc_script_event( sd, NPCE_STATCALC );
+
// Parse equipment.
for(i=0;i<EQI_MAX-1;i++) {
current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
Hopefully someone would HELP me this out, greatly APPRECIATED!
Thank you!!!
Regards, Vlync