• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ TFS 1.2 Remove learned spells when rooked.

cryptomeepo

Member
Joined
Aug 11, 2021
Messages
61
Solutions
4
Reaction score
14
TFS 1.2 Nostalrius Datapack.

My players aren't losing spells they learned before getting rooked, so they can use exura vita as a knight if they go to main again for example.

C++:
        // Teleport newbies to newbie island
        if (g_config.getBoolean(ConfigManager::TELEPORT_NEWBIES)) {
            if (getVocationId() != VOCATION_NONE && level <= static_cast<uint32_t>(g_config.getNumber(ConfigManager::NEWBIE_LEVEL_THRESHOLD))) {
                Town* newbieTown = g_game.map.towns.getTown(g_config.getNumber(ConfigManager::NEWBIE_TOWN));
                if (newbieTown) {
                    // Restart stats
                    level = 1;
                    experience = 0;
                    levelPercent = 0;
                    capacity = 400;
                    health = 150;
                    healthMax = 150;
                    mana = 0;
                    manaMax = 0;
                    magLevel = 0;
                    magLevelPercent = 0;
                    manaSpent = 0;
                    setVocation(0);

                    // Restart skills
                    for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { //for each skill
                        skills[i].level = 10;
                        skills[i].tries = 0;
                        skills[i].percent = 0;
                    }

                    // Restart town
                    setTown(newbieTown);
                    loginPosition = getTemplePosition();

                    // Restart first items
                    addStorageValue(30017, 1);

                    // Restart items
                    for (int32_t slot = CONST_SLOT_FIRST; slot <= CONST_SLOT_LAST; slot++)
                    {
                        Item* item = inventory[slot];
                        if (item) {
                            g_game.internalRemoveItem(item, item->getItemCount());
                        }
                    }
                } else {
                    std::cout << "[Warning - Player:death] Newbie teletransportation is enabled, newbie town does not exist." << std::endl;
                }
            }
        }

Anyone can help me here? :D
 
they will have EVERYTHING reset when being rooked except by his depot items (and skull?), or at least that is how I remember that it worked, yes they lose all spells, and when going back to main the spells need to be bought again
 

Similar threads

Back
Top