Heathcliff™
Member
- Credits
- 1
Hello!
In the last days I needed that my server loads some mobs only once at server start. I found a function that only quests use (called: "regen_load_in_file") and it's similar what I need. I think it will be useful for some of you, so I decided to share it.
In common/service.h - Add:
In game/src/sectree_manager.cpp - Search:
Add under:
In game/src/regen.cpp - Search:
Add under:
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 he can't find regen_once.txt. It won't cause any problem, just making your syserr bigger
Best regards, and sorry for my english!
In the last days I needed that my server loads some mobs only once at server start. I found a function that only quests use (called: "regen_load_in_file") and it's similar what I need. I think it will be useful for some of you, so I decided to share it.
In common/service.h - Add:
C++:
#define ENABLE_REGEN_ONCE
In game/src/sectree_manager.cpp - Search:
C++:
snprintf(szFilename, sizeof(szFilename), "%s/%s/regen.txt", c_pszMapBasePath, szMapName);
regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
Add under:
C++:
#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:
C++:
snprintf(szFilename, sizeof(szFilename), "%sregen.txt", mbMapDataContainer[lMapIndex]->szBaseName);
regen_load(szFilename, lMapIndex, mbMapDataContainer[lMapIndex]->base_x, mbMapDataContainer[lMapIndex]->base_y);
Add under:
C++:
#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 he can't find regen_once.txt. It won't cause any problem, just making your syserr bigger
Best regards, and sorry for my english!