Onforum.net - Web and gaming resource community

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members .

[Mini Tut] Server loads regen only once after start

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:
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:D

Best regards, and sorry for my english!
 
thanks! i will try it :D
So every server start, the mobs will load only once, but if i kill all the mobs (for example: dungeon, wherre need to kill more mobs and they are respawning) the mobs will load ?
 

Top

Dear User!

We found that you are blocking the display of ads on our site.

Please add it to the exception list or disable AdBlock.

The advertises that you'll see aren't intrusive they just help us to keep the community alive

If you don't want to see those ads just buy an upgrade.

Thank you for understanding!

Rogue

Rogue Purchase

User upgrade! at

🔥 Upgrade Now
Baba2

Baba2 Purchase

User upgrade! at

🔥 Upgrade Now

Escanor25 Purchase

User upgrade! at

🔥 Upgrade Now