• 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.4] Magic Field Spam

X X X

Newb
Joined
Jul 26, 2015
Messages
146
Reaction score
13
Hello,

Been playing around with TFS 1.4 8.0 downgrade. Most things seem to work pretty well, but I noticed this crazy behavior when a monster shoots a a magic field:
magic field spam.gif
When a monster (minotaur mage, witch, etc) shoots a magic field at the target, it takes insane damage; the energy field is adding the condition every 0.1 seconds or something insanely fast.

Could someone point me to the right direction where this is determined in the sources?

EDIT:
This behavior only happens with energy fields and large fire fields. Once the fire field decays to the medium size, it does not spam "10" damage every 0.1 seconds. Also, poison fields do not spam.

Thanks~
 
Last edited:
Solution
There isn't necessarily a "problem" with the sources, TFS 1.4 uses an additional value for field damage (items.cpp, line 1201):
C++:
int32_t initDamage = -1;

Because of this, the attribute keys for magic fields are incorrect in the items.xml. If you look at a standard fire field that a monster would create in items.xml, you see the key "damage" is called out twice:

XML:
<item id="1487" article="a" name="fire field">
        <attribute key="type" value="magicfield" />
        <attribute key="decayTo" value="1488" />
        <attribute key="duration" value="120" />
        <attribute key="field" value="fire">
            <attribute key="damage" value="20" />
            <attribute key="ticks" value="10000" />
            <attribute...
There isn't necessarily a "problem" with the sources, TFS 1.4 uses an additional value for field damage (items.cpp, line 1201):
C++:
int32_t initDamage = -1;

Because of this, the attribute keys for magic fields are incorrect in the items.xml. If you look at a standard fire field that a monster would create in items.xml, you see the key "damage" is called out twice:

XML:
<item id="1487" article="a" name="fire field">
        <attribute key="type" value="magicfield" />
        <attribute key="decayTo" value="1488" />
        <attribute key="duration" value="120" />
        <attribute key="field" value="fire">
            <attribute key="damage" value="20" />
            <attribute key="ticks" value="10000" />
            <attribute key="count" value="7" />
            <attribute key="damage" value="10" />
        </attribute>
    </item>

This is causing the bug. To fix it, change the first "damage" to "initDamage" for all energy and large fire fields:

XML:
<item id="1487" article="a" name="fire field">
        <attribute key="type" value="magicfield" />
        <attribute key="decayTo" value="1488" />
        <attribute key="duration" value="120" />
        <attribute key="field" value="fire">
            <attribute key="initDamage" value="20" />
            <attribute key="ticks" value="10000" />
            <attribute key="count" value="7" />
            <attribute key="damage" value="10" />
        </attribute>
    </item>

Don't forget the non-pvp fire and energy fields, as well as the searing fire fields . . . imagine stepping on one of those and taking 300 damage every 0.1 seconds lol
 
Solution
Wow that worked! Never would have figured that out...items.xml looks exactly the same in other distros that I've used, TFS 1.2, etc.
 
Back
Top