Full Version : setting mob notoriety at spawn time
xmlspawner >>XMLSpawner Mods and Tips >>setting mob notoriety at spawn time


<< Prev | Next >>

ArteGordon- 06-14-2006
To allow any creature to be spawned with red/blue/gray notoriety, you can make a simple mod to basecreature.cs

Those settings are normally hardcoded into the creature scripts in these properties

CODE

 public virtual bool InitialInnocent
 {
  get
  {
   return false;
  }
 }

 public virtual bool AlwaysMurderer
 {
  get
  {
   return false;
  }
 }

 public virtual bool AlwaysAttackable
 {
  get
  {
   return false;
  }
 }


that are set by default in BaseCreature.cs

If you wanted to be able to set those at spawn time, you could make this modification to those properties around line 920 in BaseCreature.cs

CODE

 public virtual bool InitialInnocent
 {
  get
  {
   XmlData x = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData), "Notoriety");
   if (x != null && x.Data == "blue")
   {
    return true;
   }

   return false;
  }
 }

 public virtual bool AlwaysMurderer
 {
  get
  {
   XmlData x = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData), "Notoriety");
   if (x != null && x.Data == "red")
   {
    return true;
   }
   return false;
  }
 }

 public virtual bool AlwaysAttackable
 {
  get
  {
   XmlData x = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData), "Notoriety");
   if (x != null && x.Data == "gray")
   {
    return true;
   }
   return false;
  }
 }


and add this to the beginning of the script

CODE

using Server.Engines.XmlSpawner2;


and then you could spawn a creature with whatever noto you wanted by attaching an XmlData attachment named Notoriety with the setting you wanted to the creature, like

dog/ATTACH/xmldata,Notoriety,red

or

orc/ATTACH/xmldata,Notoriety,blue

or

unicorn/ATTACH/xmldata,Notoriety,gray