Full Version : XmlSkillRequirement Attachment
xmlspawner >>XMLSpawner Attachments >>XmlSkillRequirement Attachment
<< Prev | Next >>
ArteGordon- 08-16-2006
This attachment allows you to specify custom skill requirements to objects that can be tested by scripts. It does not actually impose any requirements itself, it just holds them and allows them to be easily checked by scripts.
It supports the following constructors:
XmlSkillRequirement(string name)
XmlSkillRequirement(string name, string skillname, int skillvalue)
XmlSkillRequirement(string name, string skillname, int skillvalue, double expiresin)
and scripts can use the following methods to check for the requirements
public static bool CheckRequirement(Mobile from, object target)
public static bool CheckRequirement(Mobile from, object target, string name)
public static bool CheckRequirement(Mobile from, object target, string name, out SkillName skill, out int value)
So for example, with the following mod around line 140 of animaltaming.cs

QUOTE
else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState); // This animal has had too many owners and is too upset for you to tame.
}
//ARTEGORDONMOD
// add a check for additional skill requirements
else if (!XmlSkillRequirement.CheckRequirement(from, creature, "Taming"))
{
creature.SayTo(from, "You require additional skills to tame this");
}
else if (MustBeSubdued(creature))
{
creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState); // You must subdue this creature before you can tame it!
}

You can give creatures additional skill requirements for taming by just adding an XmlSkillRequirement attachment named "Taming".
Creatures without the attachment will be treated the same as they used to.
For example, spawning a horse like
horse/ATTACH/xmlskillrequirement,Taming,Ninjitsu,50
would add a requirement for 50 or more skill in Ninjitsu in order to tame the creature.
You could additionally make controlling the creature require that skill with a mod like this to basecreature.cs around line 840

QUOTE
public virtual double GetControlChance(Mobile m) { // ARTEGORDONMOD // add a check for additional skill requirements if (!XmlSkillRequirement.CheckRequirement(m, this, "Taming"))
return 0.0;
if (m_dMinTameSkill <= 29.1 || m_bSummoned || m.AccessLevel >= AccessLevel.GameMaster)
return 1.0;

You can add multiple such attachments with different names to add different requirements for different conditions, like taming, barding, lockpicking, etc. (with the proper script mods to test for them).