Full Version : Adding new enahncements to metals?
xmlspawner >>Scripting Support >>Adding new enahncements to metals?
<< Prev | Next >>
Lord Hog Fred- 10-27-2006
How can I add new attributes to the metals?
I want to add things like Mage Armor to any armour made from Valorite, etc those sorts of additions. How can I do it?
I've been trying for ages and still haven't been able to do it.
ArteGordon- 10-27-2006
you can add your custom attributes in oreinfo.cs in the CraftAttributeInfo class that specifies what attributes are available and which are added for particular materials, but this doesnt automatically cause those attributes to be applied.
If you want armor to actually give attribute bonuses, then you have to explicitly add checks for the resource attributes in the appropriate scripts.
For example, resist bonuses are added in basearmor.cs like this

CODE
public override int PhysicalResistance{ get{ return BasePhysicalResistance + GetProtOffset() + GetResourceAttrs().ArmorPhysicalResist + m_PhysicalBonus; } }

and armor durability bonuses are added like this

CODE
public int GetDurabilityBonus() { int bonus = 0; if ( m_Quality == ArmorQuality.Exceptional ) bonus += 20;
switch ( m_Durability )
{
case ArmorDurabilityLevel.Durable: bonus += 20; break;
case ArmorDurabilityLevel.Substantial: bonus += 50; break;
case ArmorDurabilityLevel.Massive: bonus += 70; break;
case ArmorDurabilityLevel.Fortified: bonus += 100; break;
case ArmorDurabilityLevel.Indestructible: bonus += 120; break;
}
if ( Core.AOS )
{
bonus += m_AosArmorAttributes.DurabilityBonus;
CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
CraftAttributeInfo attrInfo = null;
if ( resInfo != null )
attrInfo = resInfo.AttributeInfo;
if ( attrInfo != null )
bonus += attrInfo.ArmorDurability;
}
return bonus;
}

so the bottom line is that after making the mods to oreinfo.cs to add your custom attributes, the additional mods that you would need to add to cause them to take effect would depend on what those attributes were and where they are normally used.
Lord Hog Fred- 10-27-2006
Ah ok, well I tried adding the MageArmor to crafting.
I added this to BaseArmor.cs

CODE
//Added Bonuses public int GetMageArmorBonus() { int bonus = 0; bonus += m_AosArmorAttributes.MageArmor;
CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
CraftAttributeInfo attrInfo = null;
if ( resInfo != null )
attrInfo = resInfo.AttributeInfo;
if ( attrInfo != null )
bonus += attrInfo.MageArmor;
return bonus;
}
//End

And these lines to OreInfo.cs

CODE
private int m_MageArmor; public int MageArmor{ get{ return m_MageArmor; } set{ m_MageArmor = value; } } golden.MageArmor = 1;

However, if I make some amrour out of gold it still doesn't seem to have Mage Armor.
ArteGordon- 10-27-2006
there isnt anything that calls GetMageArmorBonus by default. I assume that you just added that method.
You would need to add calls to that in scripts that currently just look at the MageArmor attribute, like in the armor GetProperties call

CODE
if ( (prop = m_AosArmorAttributes.MageArmor) != 0 ) list.Add( 1060437 ); // mage armor

if that isnt changed, then it will continue to just display the base MageArmor attribute and will not reflect the resource bonus.
So if you changed it there, you would be able to see the resource bonus, but you would still have to find all of the places where it referred to the MageArmor attribute and change them to use your new bonus call.