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

Linux TFS 7.72 Downgrade Nekiro - segmentation fault (core dumped) Warlock Dead

Forkz

Well-Known Member
Joined
Jun 29, 2020
Messages
380
Solutions
1
Reaction score
89
Hi otlanders,

After I kill a warlock, the server crashes and generates a "segmentation fault (core dumped) log. I generated the "core" file.

Does anyone want to help me?
 
Solution
The issue lies in the part of the code in creature.cpp. Simply replace it and compile. Do you know what caused the server crash? Was it when any monster saw and attacked you, causing the server to crash, or also if you pass over fire or energy, causing a crash? It has happened to me before. Just replace and test.

look for this line.
C++:
if (Player* attackerPlayer = attacker->getPlayer()) {
to change.
C++:
if (attacker) {
        if (Player* attackerPlayer = attacker->getPlayer()) {
            for (int32_t slot = CONST_SLOT_FIRST; slot <= CONST_SLOT_LAST; ++slot) {
                if (!attackerPlayer->isItemAbilityEnabled(static_cast<slots_t>(slot))) {
                    continue;
                }

                Item* item =...
post your warlock xml


Code:
warning: Section `.reg-xstate/1892' in core file too small.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./tfs'.
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Section `.reg-xstate/1892' in core file too small.
#0  0x0000563a696e2295 in Creature::blockHit(Creature*, CombatType_t, int&, bool, bool, bool, bool) ()
[Current thread is 1 (Thread 0x7fa3fd077700 (LWP 1892))]
(gdb) warning: Section `.reg-xstate/1892' in core file too small.

I added these codes to the source, I don't know if it has anything to do with it

Code:
https://github.com/otland/forgottenserver/pull/2807/files#diff-0647bf446e4dd1c21a9655a936b5499942c766cc70ad4864c43a27b98301ebeb

warlock.xml

XML:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="warlock" nameDescription="a warlock" race="blood" experience="4000" speed="230" manacost="0">
    <health now="3200" max="3200"/>
    <look type="130" head="0" body="52" legs="128" feet="95" corpse="3128"/>
    <targetchange interval="1000" chance="50"/>
    <targetstrategies nearest="100" health="0" damage="0" random="0"/>
    <flags>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag summonable="0"/>
        <flag convinceable="0"/>
        <flag illusionable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="4"/>
        <flag staticattack="80"/>
        <flag runonhealth="1000"/>
    </flags>
    <attacks>
        <attack name="melee" skill="50" attack="40"/>
        <attack name="physical" chance="50" range="7" min="-45" max="-105">
            <attribute key="shootEffect" value="energy"/>
        </attack>
        <attack name="manadrain" chance="17" range="7" min="-35" max="-75"/>
        <attack name="paralyze_warlock" chance="12" range="7"/>
        <attack name="fire" chance="34" range="7" radius="3" target="1" min="-90" max="-170">
            <attribute key="shootEffect" value="fire"/>
            <attribute key="areaEffect" value="firearea"/>
        </attack>
        <attack name="firefield" chance="20" range="7" radius="2" target="1">
            <attribute key="shootEffect" value="fire"/>
        </attack>
        <attack name="energy" chance="13" length="8" spread="0" min="-145" max="-205">
            <attribute key="areaEffect" value="energy"/>
        </attack>
    </attacks>
    <defenses armor="32" defense="125">
        <defense name="healing" chance="25" min="60" max="100">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
        <defense name="invisible" chance="10" duration="20000">
            <attribute key="areaEffect" value="blueshimmer"/>
        </defense>
    </defenses>
    <summons maxSummons="1">
        <summon name="stone golem" chance="10" max="1"/>
    </summons>
    <elements>
        <element firePercent="100"/>
        <element earthPercent="100"/>
        <element energyPercent="100"/>
    </elements>
    <immunities>
        <immunity paralyze="1"/>
        <immunity invisible="1"/>
    </immunities>
    <voices interval="1000" chance="5">
        <voice sentence="Learn the secret of our magic! YOUR death!"/>
        <voice sentence="Even a rat is a better mage than you."/>
        <voice sentence="We don't like intruders!"/>
    </voices>
    <loot>
        <item id="2689" chance="11000"/><!-- 11% bread -->
        <item id="2792" chance="3000"/><!-- 3% dark mushroom -->
        <item id="2679" chance="20000" countmax="4"/><!-- 4 20% cherry -->
        <item id="2148" chance="30000" countmax="80"/><!-- 80 30% gold coin -->
        <item id="2146" chance="2800"/><!-- 1.4% small sapphire -->
        <item id="2151" chance="1100"/><!-- 1.1% talon -->
        <item id="1986" chance="400"/><!-- 0.4% red tome -->
        <item id="2600" chance="13000"/><!-- 13% inkwell -->
        <item id="2178" chance="2500"/><!-- 2.5% mind stone -->
        <item id="2124" chance="1000"/><!-- 1% crystal ring -->
        <item id="2123" chance="200"/><!-- 0.2% ring of the sky -->
        <item id="2466" chance="300"/><!-- 0.3% golden armor -->
        <item id="2656" chance="2000"/><!-- 2% blue robe -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2047" chance="15000"/><!-- 15% candlestick -->
                <item id="2411" chance="10000"/><!-- 10% poison dagger -->
                <item id="2436" chance="7000"/><!-- 7% skull staff -->
                <item id="2185" chance="4000"/><!-- 4% 2185 volcanic rod -->
                <item id="2197" chance="500"/><!-- 0.5% stone skin amulet -->
                <item id="2167" chance="3000"/><!-- 3% energy ring -->
            </inside>
        </item>
    </loot>
</monster>

#Edit1 - Making a more complete analysis, when a monster attacks with "firefield" and then dies when it passes over the monster's firefield, the server crashes.
 
Last edited:
The issue lies in the part of the code in creature.cpp. Simply replace it and compile. Do you know what caused the server crash? Was it when any monster saw and attacked you, causing the server to crash, or also if you pass over fire or energy, causing a crash? It has happened to me before. Just replace and test.

look for this line.
C++:
if (Player* attackerPlayer = attacker->getPlayer()) {
to change.
C++:
if (attacker) {
        if (Player* attackerPlayer = attacker->getPlayer()) {
            for (int32_t slot = CONST_SLOT_FIRST; slot <= CONST_SLOT_LAST; ++slot) {
                if (!attackerPlayer->isItemAbilityEnabled(static_cast<slots_t>(slot))) {
                    continue;
                }

                Item* item = attackerPlayer->getInventoryItem(static_cast<slots_t>(slot));
                if (!item) {
                    continue;
                }

                const uint16_t boostPercent = item->getBoostPercent(combatType);
                if (boostPercent != 0) {
                    damage += std::round(damage * (boostPercent / 100.));
                }
            }
        }
 
Solution
this code is responsible: please dont add features from different engines without checking them first lol.

const int16_t& fieldAbsorbPercent = it.abilities->fieldAbsorbPercent[combatTypeToIndex(combatType)];
const int16_t& fieldAbsorbPercent = it.abilities->fieldAbsorbPercent[combatIndex];
 
The issue lies in the part of the code in creature.cpp. Simply replace it and compile. Do you know what caused the server crash? Was it when any monster saw and attacked you, causing the server to crash, or also if you pass over fire or energy, causing a crash? It has happened to me before. Just replace and test.

look for this line.
C++:
if (Player* attackerPlayer = attacker->getPlayer()) {
to change.
C++:
if (attacker) {
        if (Player* attackerPlayer = attacker->getPlayer()) {
            for (int32_t slot = CONST_SLOT_FIRST; slot <= CONST_SLOT_LAST; ++slot) {
                if (!attackerPlayer->isItemAbilityEnabled(static_cast<slots_t>(slot))) {
                    continue;
                }

                Item* item = attackerPlayer->getInventoryItem(static_cast<slots_t>(slot));
                if (!item) {
                    continue;
                }

                const uint16_t boostPercent = item->getBoostPercent(combatType);
                if (boostPercent != 0) {
                    damage += std::round(damage * (boostPercent / 100.));
                }
            }
        }
Solved
Post automatically merged:

this code is responsible: please dont add features from different engines without checking them first lol.

const int16_t& fieldAbsorbPercent = it.abilities->fieldAbsorbPercent[combatTypeToIndex(combatType)];
const int16_t& fieldAbsorbPercent = it.abilities->fieldAbsorbPercent[combatIndex];
Thanks for trying to help me!
 
Back
Top