Here a small piece of code I made to allow Helmet, Cloak, Body Armor and Belt to add Arm Strength, Dexterity, Leg Strength and Agility. It's maybe a bit dirty, but it work.
The enchant bonus is divised by 2, because the bonus value is added to each arm or leg. A +1 Dexterity bonus will add +0.5 Dexterity to each arm so (could be invisible for a +1 item so, unless you're Dexterity is already a bit trained).
The enchant bonus is divised by 2, because the bonus value is added to each arm or leg. A +1 Dexterity bonus will add +0.5 Dexterity to each arm so (could be invisible for a +1 item so, unless you're Dexterity is already a bit trained).
---------- bodypart.h ---------- ITEM(bodypart, item) { public: ... item* GetExternalHelmet() const; item* GetExternalBelt() const; ... }; ITEM(arm, bodypart) { public: ... void ApplyStrengthBonus(item*); void ApplyDexterityBonus(item*); ... }; ITEM(leg, bodypart) { public: ... void ApplyStrengthBonus(item*); void ApplyAgilityBonus(item*); ... }; ---------- bodypart.cpp ---------- item* bodypart::GetExternalHelmet() const { return GetHumanoidMaster()->GetHelmet(); } item* bodypart::GetExternalBelt() const { return GetHumanoidMaster()->GetBelt(); } void arm::CalculateAttributeBonuses() { ... if(Master) { ... ApplyStrengthBonus(GetExternalHelmet()); ApplyStrengthBonus(GetExternalCloak()); ApplyStrengthBonus(GetExternalBodyArmor()); ApplyStrengthBonus(GetExternalBelt()); ApplyDexterityBonus(GetExternalHelmet()); ApplyDexterityBonus(GetExternalCloak()); ApplyDexterityBonus(GetExternalBodyArmor()); ApplyDexterityBonus(GetExternalBelt()); } } void leg::CalculateAttributeBonuses() { ... if(Master) { ... ApplyStrengthBonus(GetExternalHelmet()); ApplyStrengthBonus(GetExternalCloak()); ApplyStrengthBonus(GetExternalBodyArmor()); ApplyStrengthBonus(GetExternalBelt()); ApplyAgilityBonus(GetExternalHelmet()); ApplyAgilityBonus(GetExternalCloak()); ApplyAgilityBonus(GetExternalBodyArmor()); ApplyAgilityBonus(GetExternalBelt()); } } void arm::ApplyStrengthBonus(item* Item) { if(Item && Item->AffectsArmStrength()) StrengthBonus += Item->GetEnchantment() / 2; } void arm::ApplyDexterityBonus(item* Item) { if(Item && Item->AffectsDexterity()) DexterityBonus += Item->GetEnchantment() / 2; } void leg::ApplyStrengthBonus(item* Item) { if(Item && Item->AffectsLegStrength()) StrengthBonus += Item->GetEnchantment() / 2; } void leg::ApplyAgilityBonus(item* Item) { if(Item && Item->AffectsAgility()) AgilityBonus += Item->GetEnchantment() / 2; }Tell me if you encounter bugs, I'll edit this code, and feel free to post your own.