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

TFS 1.X+ Console getting spammed with "1"

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24
legit no clue, so i just got everything moved over from 1.2 to the latest source, was testing things out, fixing things, updating code ect.
I got to the point that it was time to do login testing.

everything went mostly fine, had a few things i forgot. but good none the less.

The issue start when i go near my trainers, my console gets spammed with "1" till the point it crashed me once.

Its not just them, being near any creature will make "1" randomly appear in console, but not as bad as the trainers.

I tried changing and adding things i saw the monsters that were not spamming my console had. Nothing.

Any ideas what is causing this spam?


XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
  <monster name="Training Dummy" nameDescription="a training dummy" race="undead" experience="1" speed="0" manacost="0">
    <health now="1000000000" max="1000000000"/>
    <look typeex="5787" corpse="5972"/>
    <targetchange interval="40000" chance="0" />  <!-- excessively long intervals was a fix in the last server due to setting the think interval in the source from 1000 too 1 --> <!-- also this bit of code was added in a attempt to find out the problem -->
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="1" />
        <flag illusionable="0" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="0" />
        <flag canpushcreatures="0" />
        <flag targetdistance="1" />
        <flag staticattack="100" />
        <flag runonhealth="0" />
        <flag rewardchest="1" />   <!-- does not need to be here, was testing things, removed at once point did not stop the spam -->
    </flags>
    <attacks>
      <attack name="melee" interval="20000" attack="1" skill="60"/>
    </attacks>
    <defenses armor="0" defense="0">
      <defense name="all outfits" interval="40000" chance="100">  <!-- spell to make them change outfits, removed at one point no change in the "1" spam -->
      </defense>
      <defense name="healing" interval="10000" chance="100" min="1000000000" max="1000000000"/> <!-- upped the interval on this, was at 1, but did not change anything -->
    </defenses>
    <immunities>
      <immunity invisible="1"/>
    </immunities>
    <loot>
    <item id="5903" chance="100000" uniquedrop="1" /><!-- ferumbras' hat -->
    <item name="longsword" chance="4000" />
    </loot>
  </monster>

any help would be much appreciated!
 
Good news!, i happened to randomly stumble upon what was causing "1" to be spammed, bad news, i have 0 clue why it was being spammed when players entered the monsters view.

So this bit of code
C++:
std::cout << bonusRebirth << std::endl;

From this system Feature - Reborn System | Reset level, increase power, set exclusive items, spells, houses, web and more! (https://otland.net/threads/reborn-system-reset-level-increase-power-set-exclusive-items-spells-houses-web-and-more.245808/)

was causing the spam.

The reason i said bad news, is to my knowledge it should not of caused the spam where it was placed, at least not till health was changed. this is what i mean.


C++:
bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage)
{
    const Position& targetPos = target->getPosition();
    if (damage.primary.value > 0) {
        if (target->getHealth() <= 0) {
            return false;
        }

        Player* attackerPlayer;
        if (attacker) {
            attackerPlayer = attacker->getPlayer();
        }
        else {
            attackerPlayer = nullptr;
        }

        Player* targetPlayer = target->getPlayer();
        if (attackerPlayer && targetPlayer && attackerPlayer->getSkull() == SKULL_BLACK && attackerPlayer->getSkullClient(targetPlayer) == SKULL_NONE) {
            return false;
        }

        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;

        damage.primary.value = std::abs(damage.primary.value) * bonusRebirth;
        damage.secondary.value = std::abs(damage.secondary.value * bonusRebirth);

        if (damage.origin != ORIGIN_NONE) {

i undid the removal for this copy and paste so you could see where i found it. Best of my knowledge this should not be spamming, unless the server is considering healing at full health a combat health change.


Delete:

std::cout << bonusRebirth << std::endl;

save, and compile again.
 
Back
Top