Jump to content
  • 0

OnPCStatCalcEvent HELP


Drakkus

Question


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

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&section=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

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


bonus .@i + 13, 50;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

Removed.

Edited by Kaze
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

trunk/db/const.txt

bStr	13
bAgi	14
bVit	15
bInt	16
bDex	17
bLuk	18
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...