Jump to content

Server loads regen only once after start


Recommended Posts

Hey yoo!

This little thing allows you to make new regen files called: regen_once.txt (you can rename it to anything).
Modification is using an already existing function called: regen_load_in_file, which has been used by quests.
You can use it, to generate some monsters / npcs at the server startup which don't have any respawn time, so if you kill them, they won't appear until a new server restart, or manually reloading your regens if you have those functions.

In common/service.h - Add:

#define ENABLE_REGEN_ONCE


In game/src/sectree_manager.cpp - Search:

			snprintf(szFilename, sizeof(szFilename), "%s/%s/regen.txt", c_pszMapBasePath, szMapName);
			regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);


Add under:

#ifdef ENABLE_REGEN_ONCE
			snprintf(szFilename, sizeof(szFilename), "%s/%s/regen_once.txt", c_pszMapBasePath, szMapName);
			regen_load_in_file(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
#endif


In game/src/regen.cpp - Search:

	snprintf(szFilename, sizeof(szFilename), "%sregen.txt", mbMapDataContainer[lMapIndex]->szBaseName);
	regen_load(szFilename, lMapIndex, mbMapDataContainer[lMapIndex]->base_x, mbMapDataContainer[lMapIndex]->base_y);


Add under:

#ifdef ENABLE_REGEN_ONCE
    snprintf(szFilename, sizeof(szFilename), "%sregen_once.txt", mbMapDataContainer[lMapIndex]->szBaseName);
    regen_load_in_file(szFilename, lMapIndex, mbMapDataContainer[lMapIndex]->base_x, mbMapDataContainer[lMapIndex]->base_y);
#endif


If you done it, you can create regen_once.txt with some mobs, and place it to your map folder next to regen.txt. If you don't place it in every map folder, you will get some syserr that says it can't find regen_once.txt. It won't cause any problem. It just inform you, that you didn't create that file for certain maps. 

Edited by Heathcliff™
  • Good 4
  • Love 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.