Welcome to the Builder Academy

Question Rip/kill counter dont save need help please

More
26 May 2013 10:25 #2681 by JTP
I just added rip/kill counter, it adds up when killing, but after rent/quit its back to 0

Where do i need to add so it will be saved ?

Please Log in or Create an account to join the conversation.

More
26 May 2013 12:16 #2682 by JTP
I have added int rip_cnt; and int kill_cnt to char_file_u_plrtoascii

but dont save.

Please Log in or Create an account to join the conversation.

More
26 May 2013 12:19 #2683 by rudeboyrave
players.c pfdefaults.h

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

Please Log in or Create an account to join the conversation.

More
26 May 2013 12:30 #2684 by JTP
Just added it to those 2 files, dont save anyway

Please Log in or Create an account to join the conversation.

More
26 May 2013 13:04 - 26 May 2013 16:10 #2685 by JTP
Here is what i have done so far:

structs.h player_special_data_saved

int rip_cnt;
int kill_cnt;
__

utils.h

#define GET_RIP_CNT(ch) ((ch)->player_specials->saved.rip_cnt)
#define GET_KILL_CNT(ch) ((ch)->player_specials->saved.kill_cnt)

__

Add the following right before die(victim) is called.

fight.c

if (!IS_NPC(victim))
GET_RIP_CNT(victim) += 1;
if (!IS_NPC(ch))
GET_KILL_CNT(ch) += 1;
__


Report it within do_score

do.score

send_to_char(ch, "You have died %d times and killed %d opponents.\r\n", GET_RIP_CNT(ch), GET_KILL_CNT(ch));
__
act.wizard.c stat

send_to_char(ch, "Rip: [%d], Kills: [%d]\r\n", GET_RIP_CNT(k), GET_KILL_CNT(k));

__
plrtoascii.c

int rip_cnt;
int kill_cnt;

__

pfdefaults.h

#define PFDEF RIPCNT 0
#define PFDEF_KILLCNT 0
__

players.c

GET_RIP_CNT(ch) = PFDEF_RIPCNT;
GET_KILL_CNT(ch) = PFDEF_KILLCNT;
Last edit: 26 May 2013 16:10 by JTP.

Please Log in or Create an account to join the conversation.

More
26 May 2013 13:47 #2687 by Vatiken
This is a tough one but I guess a good starting point for addressing this issue would be to add the necessary code to load/save_player() to load and save the data.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

Time to create page: 0.221 seconds