Jump to content
  • 0

Auto recalculate Stats after changing MAPFLAGS for PVP & GVG


Lord Turtle

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   7
  • Joined:  04/13/12
  • Last Seen:  

 

i have noticed that when you are already inside a map, then the mapflag suddenly changed eg. PVPON , restricted equipments that are equipped still have their effect until you make a move that will result in triggering the status recalculation so i have made a code that triggers the recalculation automatically after changing mapflags but i have some problem with it.

Please check the codes below.



map.cpp

/*==========================================
 * recalculate stats inside a map
 *------------------------------------------*/
static int map_instacalc(struct block_list *bl, va_list ap)
{
	struct map_session_data* sd;

	nullpo_retr(0, bl);
	nullpo_retr(0, sd = (struct map_session_data *)bl);

	status_calc_pc(sd, SCO_NONE);
	
	return 1;
}

map.cpp

/**
 * Set a mapflag
 * @param m: Map ID
 * @param mapflag: Mapflag ID
 * @param status: true - Set mapflag, false - Remove mapflag
 * @param args: Arguments for special flags
 * @return True on success or false on failure
 */
@ -4647,6 +4662,7 @@ bool map_setmapflag_sub(int16 m, enum e_mapflag mapflag, bool status, union u_ma
				clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
				map_foreachinmap(map_mapflag_pvp_stop_sub, m, BL_PC);
				map_foreachinmap(unit_stopattack, m, BL_CHAR, 0);
++				map_foreachinmap(map_instacalc, m, BL_PC);
			} else {
				if (!battle_config.pk_mode) {
					clif_map_property_mapall(m, MAPPROPERTY_FREEPVPZONE);
@ -4684,6 +4700,7 @@ bool map_setmapflag_sub(int16 m, enum e_mapflag mapflag, bool status, union u_ma
			if (!status) {
				clif_map_property_mapall(m, MAPPROPERTY_NOTHING);
				map_foreachinmap(unit_stopattack, m, BL_CHAR, 0);
++				map_foreachinmap(map_instacalc, m, BL_PC);
			} else {
				clif_map_property_mapall(m, MAPPROPERTY_AGITZONE);
				if (mapdata->flag[MF_PVP]) {

This code is working but the problem is when i reload script theres an error showing on console and after i reload 2nd time = automatic server crash. please help.

This is what it shows on console on first and second @reloadscript , i dont know why it triggers quest i did not edit anything there.

[Status]: set users RAGNAROK : 1
[Status]: Done loading '0' entries for '0' NPC Markets from 'market' table.
[Error]: quest_add: Character 150003 already has quest 6025.
[Debug]: Source (NPC): #B_camp_start03 at bat_c03 (146,56)
[Debug]: Function: setquest (1 parameter):
[Debug]: Data: number value=6025
[Info]: Done loading '13035' NPCs:
        -'3091' Warps
        -'187' Shops
        -'9756' Scripts
        -'3911' Spawn sets
        -'79336' Mobs Cached
        -'0' Mobs Not Cached
[Status]: Event 'OnInit' executed with '1480' NPCs.
[Status]: Event 'OnInterIfInit' executed with '0' NPCs.
[Status]: Done loading '0' entries for '0' NPC Markets from 'market' table.
[Error]: Server received crash signal! Attempting to save all online characters!
[Info]: Saved Inventory (0) data to table inventory for char_id: 150003
[Info]: Saved Cart (0) data to table cart_inventory for char_id: 150003
[Info]: Saved char 150003 - PUKEKE: status skills.
[Status]: Map-server #0 has disconnected.
[Status]: set users RAGNAROK : 0

 

Edited by tribal0306
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  220
  • Reputation:   251
  • Joined:  04/08/13
  • Last Seen:  

You do not specify which is the error showed on console.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   7
  • Joined:  04/13/12
  • Last Seen:  

On 10/31/2019 at 3:50 AM, Easycore said:

You do not specify which is the error showed on console.

This is what it shows on console on first and second @reloadscript , i dont know why it triggers quest i did not edit anything there ? 

On more than 2 times reload scriptmap server always crash.

[Status]: set users RAGNAROK : 1
[Status]: Done loading '0' entries for '0' NPC Markets from 'market' table.
[Error]: quest_add: Character 150003 already has quest 6025.
[Debug]: Source (NPC): #B_camp_start03 at bat_c03 (146,56)
[Debug]: Function: setquest (1 parameter):
[Debug]: Data: number value=6025
[Info]: Done loading '13035' NPCs:
        -'3091' Warps
        -'187' Shops
        -'9756' Scripts
        -'3911' Spawn sets
        -'79336' Mobs Cached
        -'0' Mobs Not Cached
[Status]: Event 'OnInit' executed with '1480' NPCs.
[Status]: Event 'OnInterIfInit' executed with '0' NPCs.
[Status]: Done loading '0' entries for '0' NPC Markets from 'market' table.
[Error]: Server received crash signal! Attempting to save all online characters!
[Info]: Saved Inventory (0) data to table inventory for char_id: 150003
[Info]: Saved Cart (0) data to table cart_inventory for char_id: 150003
[Info]: Saved char 150003 - PUKEKE: status skills.
[Status]: Map-server #0 has disconnected.
[Status]: set users RAGNAROK : 0
Edited by tribal0306
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...