• 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+ New Item Attributes in Items.xml

Togu

Advanced OT User
Joined
Jun 22, 2018
Messages
308
Solutions
1
Reaction score
183
Location
Brazil
In items.cpp, on function Items:: parseItemNode, I've add:
C++:
case ITEM_PARSE_CRITICALHITCHANCE: {
                   it.abilities->specialSkills[SPECIALSKILL_CRITICALHITCHANCE] = pugi::cast<int32_t>(valueAttribute.value());
                   break;
               }

case ITEM_PARSE_CRITICALHITAMOUNT: {
                   it.abilities->specialSkills[SPECIALSKILL_CRITICALHITAMOUNT] = pugi::cast<int32_t>(valueAttribute.value());
                   break;
               }
Note: The item description works too if using abilities.specialSkills[SPECIALSKILL_CRITICALHITAMOUNT] = pugi::cast<int32_t>(valueAttribute.value());

In items.xml, I've add 2 new attributes for critical hits:
XML:
<item id="2400" article="a" name="magic sword">
       <attribute key="description" value="It's the Sword of Valor." />
       <attribute key="weight" value="4200" />
       <attribute key="defense" value="35" />
       <attribute key="attack" value="48" />
       <attribute key="weaponType" value="sword" />
       <attribute key="extradef" value="3" />
       <attribute key="criticalhitchance" value="100" />
       <attribute key="criticalhitamount" value="100" />
</item>

On the server, items are showing the right description:
23:13 You see a magic sword (Atk:48, Def:35 +3, critical hit chance +100%, critical extra damage +100%).

On the console there isn't any error.

But nothing happens when equiping (it didn't update the special skills values on the skill window) and when attacking monsters (the damage still the same, didn't see any critical attack effect).

I've take a look in the amazon armor that gives +3 distance. All configurations I did for critical is the same as the case for the skill distance increment, look (I used "find all references" from Visual Studio to check that):
Code:
   {"skilldist", ITEM_PARSE_SKILLDIST},
   {"skillfish", ITEM_PARSE_SKILLFISH},
   {"skillshield", ITEM_PARSE_SKILLSHIELD},
   {"skillfist", ITEM_PARSE_SKILLFIST},
   {"maxhitpoints", ITEM_PARSE_MAXHITPOINTS},
   {"maxhitpointspercent", ITEM_PARSE_MAXHITPOINTSPERCENT},
   {"maxmanapoints", ITEM_PARSE_MAXMANAPOINTS},
   {"maxmanapointspercent", ITEM_PARSE_MAXMANAPOINTSPERCENT},
   {"magicpoints", ITEM_PARSE_MAGICPOINTS},
   {"magiclevelpoints", ITEM_PARSE_MAGICPOINTS},
   {"magicpointspercent", ITEM_PARSE_MAGICPOINTSPERCENT},
   {"criticalhitchance", ITEM_PARSE_CRITICALHITCHANCE},
   {"criticalhitamount", ITEM_PARSE_CRITICALHITAMOUNT}

Code:
   ITEM_PARSE_SKILLDIST,
   ITEM_PARSE_SKILLFISH,
   ITEM_PARSE_SKILLSHIELD,
   ITEM_PARSE_SKILLFIST,
   ITEM_PARSE_MAXHITPOINTS,
   ITEM_PARSE_MAXHITPOINTSPERCENT,
   ITEM_PARSE_MAXMANAPOINTS,
   ITEM_PARSE_MAXMANAPOINTSPERCENT,
   ITEM_PARSE_MAGICPOINTS,
   ITEM_PARSE_MAGICPOINTSPERCENT,
   ITEM_PARSE_CRITICALHITCHANCE,
   ITEM_PARSE_CRITICALHITAMOUNT,

One of the things I want to do is to make two-handed weapons with a permanently change for the critical chance and critical damage value.

What should I do?
 
Solution
you have to add it to movements.xml to make it register
XML:
<movevent event="Equip" slot="hand" itemid="2400" level="80" function="onEquipItem" />
    <movevent event="DeEquip" slot="hand" itemid="2400" function="onDeEquipItem" />
you have to add it to movements.xml to make it register
XML:
<movevent event="Equip" slot="hand" itemid="2400" level="80" function="onEquipItem" />
    <movevent event="DeEquip" slot="hand" itemid="2400" function="onDeEquipItem" />
 
Solution
you have to add it to movements.xml to make it register
XML:
<movevent event="Equip" slot="hand" itemid="2400" level="80" function="onEquipItem" />
    <movevent event="DeEquip" slot="hand" itemid="2400" function="onDeEquipItem" />
You are the best!
But I think I'm gonna change the critical damage value in the source code cause it doesn't look like it's a critical damage (in your Item Ability System and in this one too)
 
You are the best!
But I think I'm gonna change the critical damage value in the source code cause it doesn't look like it's a critical damage (in your Item Ability System and in this one too)
it's not my system, it's a bug in tfs where crit gets applied after health is already taken from the creature so it doesn't change the damage
i'm working on it and going to add a pull request
 

Similar threads

Back
Top