• 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!

Feature Reborn System | Reset level, increase power, set exclusive items, spells, houses, web and more!

Hey all, currently recompiling for TFS 1.4.1 with MySQL being 10.5.5 and I'm having a problem in my iologindata.cpp

My code:
C++:
bool IOLoginData::loadPlayerById(Player* player, uint32_t id)
{
    Database& db = Database::getInstance();
    return loadPlayer(player, db.storeQuery(fmt::format("SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `rebirth`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`, `direction` FROM `players` WHERE `id` = {:d}", id)));
}

bool IOLoginData::loadPlayerByName(Player* player, const std::string& name)
{
    Database& db = Database::getInstance();
    return loadPlayer(player, db.storeQuery(fmt::format("SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `rebirth`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`, `direction` FROM `players` WHERE `name` = {:s}", db.escapeString(name))));
}

My problem:

rebirthfieldlist.png

Extremely thankful for any help.
 
Hey all, currently recompiling for TFS 1.4.1 with MySQL being 10.5.5 and I'm having a problem in my iologindata.cpp

My code:
C++:
bool IOLoginData::loadPlayerById(Player* player, uint32_t id)
{
    Database& db = Database::getInstance();
    return loadPlayer(player, db.storeQuery(fmt::format("SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `rebirth`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`, `direction` FROM `players` WHERE `id` = {:d}", id)));
}

bool IOLoginData::loadPlayerByName(Player* player, const std::string& name)
{
    Database& db = Database::getInstance();
    return loadPlayer(player, db.storeQuery(fmt::format("SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `rebirth`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`, `direction` FROM `players` WHERE `name` = {:s}", db.escapeString(name))));
}

My problem:

View attachment 68555

Extremely thankful for any help.
Add a column int 11 'rebirth' to your players table
 
Hi @Stellow, just ran it in SQL and it added the table but still getting the same error from my previous attachment. Any ideas? Much appreciated

Edit: used the code to add the table:
SQL:
ALTER TABLE players ADD rebirths int(11) NOT NULL default 0;

Edit 2: sorry for wasting time, the code should be modified to this & should be fixed.
SQL:
ALTER TABLE players ADD rebirth int(11) NOT NULL default 0;
sqlrebirth.png
 
Last edited:
Sorry for the spam on the post, but I'm trying to add requirements to weapons and it doesn't appear to be working.
T.F.S 1.4.1, no errors in console when launching or equipping weapon/etc

in my weapons.xml (i've tried unproperly 1 and 0, both still don't work)
XML:
<melee id="20092" level="8" rebirth="4" unproperly="1" />

movements.xml
XML:
<movevent event="Equip" itemid="20092" level="8" rebirth="4" slot="hand" function="onEquipItem">
        <vocation name="Knight" />
        <vocation name="Elite Knight" showInDescription="0" />
    </movevent>
if anyone has any solutions it'd be much appreciated <3
 
Can confirm everything is working as intended on TFS 1.5, thanks for the great release!

Meme Reaction GIF


[Note: Had to exclude the onLook door edit due to the new style for function doesnt use ss << anymore.
But other than that, everything copys over fine with the exception of change `rebirth; -> rebirth = 0; in some cases.]
 
As @Sarah Wesker said here, rebirth damage is being applied twice if an onHealthChange event exists

So here is the fix:

[Game.cpp]

Remove this from Game::combatChangeHealth
C++:
        double bonusRebirth = 0.0;
        if(attackerPlayer != nullptr){
            bonusRebirth = attackerPlayer->rebirth * g_config.getNumber(ConfigManager::REBORN_DMGBONUS);
            bonusRebirth /= 10;
            bonusRebirth /= 100;
            bonusRebirth += 1;
        }
        else
            bonusRebirth = 1.0;
     
        std::cout << bonusRebirth << std::endl;

Remove * bonusRebirth from the following lines:
C++:
damage.primary.value = std::abs(damage.primary.value) * bonusRebirth;
damage.secondary.value = std::abs(damage.secondary.value * bonusRebirth);

[Combat.cpp]

TFS 1.2

Paste the following, on here
C++:
if (Player* casterPlayer = caster->getPlayer()) {
    if (int32_t rebirths = casterPlayer->getRebirth()) {
        damage.primary.value += std::round(damage.primary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
        damage.secondary.value += std::round(damage.secondary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
    }
}

TFS 1.3+
Paste the following, on here
C++:
if (damage.primary.type != COMBAT_HEALING && damage.origin != ORIGIN_CONDITION) {
    if (int32_t rebirths = casterPlayer->getRebirth()) {
        damage.primary.value += std::round(damage.primary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
        damage.secondary.value += std::round(damage.secondary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
    }
}

Paste the following, on here
C++:
if (casterPlayer) {
    if (int32_t rebirths = casterPlayer->getRebirth()) {
        damageCopy.primary.value += std::round(damageCopy.primary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
        damageCopy.secondary.value += std::round(damageCopy.secondary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.));
    }
}
 
Last edited:
This is a reborn system, on which player reaches level X and then goes back to level 8, you choose how and what status will be available.

This system was designed to TFS 1.2, but can be adapted to any version, the only difference is maybe a function name. Comment if you have problem adapting to your source.

I have attached sources, and few .lua files such as action and movements, to help you make your configurations

Here is the list of features:

  • Storage of Rebirths database, this can be handy when creating new websites page
  • Rebirth information when looking at a character
  • Increase in damage and spells damage by rebirth
  • Bonus on acquired health and mana on level up
  • Exclusive houses based on rebirth level
  • Exclusive spells based on rebirth level
  • Exclusive items based on rebirth level
  • Doors and teleport access based on rebirth level
  • Simple highscore Gesior page
  • Lua rebirth functions
  • Configuration on config.lua on basic rebirth status, such as required level, damage bonus, percentage of level and hp

Pictures:







Coding:

The c++ code is all labeled with REBIRTH, so if you Ctrl + F for it, you will find it all.

To add houses rebirth requirements, add this to houses.xml:
Code:
 reqrebirth="10"

To add rebirth requirements to spells, add this to spells.xml:
Code:
rebirth="1"

To add rebirth requirements to items, add this to weapons.xml:
Code:
rebirth="1" unproperly="0" -- 0 means that it must fit the requirements to wield

To make custom doors, use a regular quest door, and set action id to 10000 + required reborns, 10010 for 10 reborns for example.

To make custom tiles or teleport, do the same process on the action id.

config.lua configuration:
Code:
rebornLevel = 500000 -- min level to reborn
rebornStats = 5 -- % more hp and mp on every reset ()
rebornDmg = 10 -- % attack bonus per reborn. 10 = 1%, 100 = 10%, 1000 = 100%. accumulative, keep it low!!!!

Files:

rebirth (https://www.dropbox.com/sh/323ahk3obcrhk21/AAAu1Qz96A1PCFS_8pu5dy7Qa?dl=0)
Does anyone know if I can change just the name? example Rebirth by Reset? will it work?
 
if (damage.primary.type != COMBAT_HEALING && damage.origin != ORIGIN_CONDITION) { if (int32_t rebirths = casterPlayer->getRebirth()) { damage.primary.value += std::round(damage.primary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.)); damage.secondary.value += std::round(damage.secondary.value * (rebirths * g_config.getNumber(ConfigManager::REBORN_DMGBONUS) / 10. / 100.)); } }
Is it possible to change this function 'getRebirth' to 'storage 378378'? I don't want to implement this function in the source code; I just want to use the storage to increase damage per reset. I tried copying and replacing the function, but it resulted in an error. Can you assist me?


Look, I made the adaptation but without success xD @Roddet
C++:
        if (damage.primary.type != COMBAT_HEALING && damage.origin != ORIGIN_CONDITION) {
            int32_t resets = casterPlayer->StorageValues(378378);
            double damageIncreasePercentage = 1.015;

            damage.primary.value *= std::pow(damageIncreasePercentage, resets);
            damage.secondary.value *= std::pow(damageIncreasePercentage, resets);
        }
 
Is it possible to change this function 'getRebirth' to 'storage 378378'? I don't want to implement this function in the source code; I just want to use the storage to increase damage per reset. I tried copying and replacing the function, but it resulted in an error. Can you assist me?
If thats the case, use an onHealthChange event instead
 
Sorry to revive a old thread, everything seems to be working just fine... however there is one thing that is odd... for some reason after implementing all of this I see the TFS console is just spamming "1" when somebody logs in

*Edit
Looks like this may be the source.. will test, but so far it works good :)
 
Sorry for the spam on the post, but I'm trying to add requirements to weapons and it doesn't appear to be working.
T.F.S 1.4.1, no errors in console when launching or equipping weapon/etc

in my weapons.xml (i've tried unproperly 1 and 0, both still don't work)
XML:
<melee id="20092" level="8" rebirth="4" unproperly="1" />

movements.xml
XML:
<movevent event="Equip" itemid="20092" level="8" rebirth="4" slot="hand" function="onEquipItem">
        <vocation name="Knight" />
        <vocation name="Elite Knight" showInDescription="0" />
    </movevent>
if anyone has any solutions it'd be much appreciated <3

Hello I am using TFS 1.4.2 I am having the same issue as this

I am going through code line by line, had to make a couple adjustments but everything seems to be lining up just fine...

Only diff in weapons.cpp was this is not listed in .cpp on TFS 1.4.2
C++:
Weapon::Weapon(LuaScriptInterface* interface) :
    Event(interface)
{
    scripted = false;
    id = 0;
    level = 0;
    magLevel = 0;
    mana = 0;
    manaPercent = 0;
    soul = 0;
    rebirth = 0;
    premium = false;
    enabled = true;
    wieldUnproperly = false;
    breakChance = 0;
    action = WEAPONACTION_NONE;
}

Maybe this is the bottleneck? I wouldn't imagine so, the luascript interface seems to have been moved to weapons.h and I have added the right information there as far as I know... copying everything over

Any idea what could be causing the rebirth="1" unproperly="1" not work? (0 doesn't work either)
 

Similar threads

Back
Top