BabaVoss Posted May 4, 2023 Group: Members Topic Count: 37 Topics Per Day: 0.02 Content Count: 79 Reputation: 0 Joined: 06/17/20 Last Seen: February 7, 2024 Share Posted May 4, 2023 is it possible to enable view_hpmeter on certain maps only. or make a mapflag that enable to see hp on users. Quote Link to comment Share on other sites More sharing options...
0 joecalis Posted May 5, 2023 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 64 Reputation: 41 Joined: 03/26/12 Last Seen: March 29 Share Posted May 5, 2023 (edited) in src\map\script_constants.hpp Find: export_constant(MF_NODYNAMICNPC); Change To: export_constant(MF_NODYNAMICNPC); export_constant(MF_VIEW_HPMETER); in src\map\map.hpp Find: MF_NODYNAMICNPC, MF_MAX Change To: MF_NODYNAMICNPC, MF_VIEW_HPMETER, MF_MAX in src\map\npc.cpp Find: switch( mapflag ){ case MF_INVALID: Change To: switch( mapflag ){ case MF_VIEW_HPMETER: if (state) { union u_mapflag_args args = {}; if (sscanf(w4, "%11d", &args.flag_val) < 1) args.flag_val = 0; // No level specified, allow everyone. map_setmapflag_sub(m, MF_VIEW_HPMETER, true, &args); } else map_setmapflag(m, MF_VIEW_HPMETER, false); break; case MF_INVALID: in src\map\map.cpp Find: case MF_NOCOMMAND: if (status) { nullpo_retr(false, args); mapdata->flag[mapflag] = ((args->flag_val <= 0) ? 100 : args->flag_val); } else mapdata->flag[mapflag] = false; break; Change To: case MF_NOCOMMAND: case MF_VIEW_HPMETER: if (status) { nullpo_retr(false, args); mapdata->flag[mapflag] = ((args->flag_val <= 0 && mapflag != MF_VIEW_HPMETER) ? 100 : args->flag_val); } else mapdata->flag[mapflag] = false; break; Find: // additional mapflag data mapdata->zone = 0; // restricted mapflag zone mapdata->flag[MF_NOCOMMAND] = false; // nocommand mapflag level Change To: // additional mapflag data mapdata->zone = 0; // restricted mapflag zone mapdata->flag[MF_NOCOMMAND] = false; // nocommand mapflag level mapdata->flag[MF_VIEW_HPMETER] = 99; // viewhpmeter mapflag level (Blocks everyone except Admin by default) in src\map\atcommand.cpp Find: if (map_getmapflag(m_id, MF_NOCOSTUME)) strcat(atcmd_output, " NoCostume |"); clif_displaymessage(fd, atcmd_output); Change To: if (map_getmapflag(m_id, MF_NOCOSTUME)) strcat(atcmd_output, " NoCostume |"); if (map_getmapflag(m_id, MF_VIEW_HPMETER)) strcat(atcmd_output, " ViewHPMeter |"); clif_displaymessage(fd, atcmd_output); in src\map\pc.cpp Find: /*========================================== * pc Init/Terminate *------------------------------------------*/ void do_final_pc(void) { Change To: bool pc_can_view_hpmeter(struct map_session_data *sd){ if(!sd) return false; if(pc_has_permission(sd,PC_PERM_VIEW_HPMETER) && pc_get_group_level(sd) >= map_getmapflag(sd->bl.m, MF_VIEW_HPMETER)) return true; return false; } /*========================================== * pc Init/Terminate *------------------------------------------*/ void do_final_pc(void) { in src\map\pc.hpp Find: #endif /* PC_HPP */ Change To: bool pc_can_view_hpmeter(struct map_session_data *sd); #endif /* PC_HPP */ in src\map\clif.cpp Find: if( pc_has_permission( tsd, PC_PERM_VIEW_HPMETER ) ){ clif_hpmeter_single( *tsd, sd->status.account_id, sd->battle_status.hp, sd->battle_status.max_hp ); } Change to: if( pc_can_view_hpmeter( tsd ) ){ clif_hpmeter_single( *tsd, sd->status.account_id, sd->battle_status.hp, sd->battle_status.max_hp ); } Find: if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || //Party-mate, or hpdisp setting. (sd->bg_id && sd->bg_id == dstsd->bg_id) || //BattleGround pc_has_permission(sd, PC_PERM_VIEW_HPMETER) ) Change To: if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || //Party-mate, or hpdisp setting. (sd->bg_id && sd->bg_id == dstsd->bg_id) || //BattleGround pc_can_view_hpmeter(sd) ) Find: if( pc_has_permission(sd,PC_PERM_VIEW_HPMETER) ) { mapdata->hpmeter_visible++; sd->state.hpmeter_visible = 1; } Change To: if( pc_can_view_hpmeter(sd) ) { mapdata->hpmeter_visible++; sd->state.hpmeter_visible = 1; } Usage: <mapname><tab>mapflag<tab>view_hpmeter<tab><group_level> This should set a map with the mapflag to enable view_hpmeter that players with higher or equal to the specified group_level can bypass. To block everyone set the group_level to 100. ***Note: You still need to add "view_hpmeter: true" to the group permissions on the groups.yml file.*** Edited May 11, 2023 by joecalis Changed to block view_hpmeter for everyone except admins by default. 1 1 Quote Link to comment Share on other sites More sharing options...
Question
BabaVoss
is it possible to enable view_hpmeter on certain maps only. or make a mapflag that enable to see hp on users.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.