Full Version : XmlParagon
xmlspawner >>XMLSpawner Attachments >>XmlParagon
<< Prev | Next >>
ArteGordon- 02-25-2008
XmlParagon
v1.00
updated 2/25/08
ArteGordon
Summary:
An Xmlspawner attachment that can be applied to individual xmlspawners to customize paragon spawns from that spawner. Various paragon spawning properties can be set such as buff factors, conversion rate, artifact drop rate, chest drop rate, hue, labels. Paragon spawning on the spawner can also be entirely disabled. (Thanks to Varchild for the idea).
Description:
To use this system, add the XmlParagon attachment to any xmlspawner by using the command
[addatt xmlparagon
and then targeting an xmlspawner. You can then edit the xmlparagon properties by using the command
[getatt
and targeting the xmlspawner to open the attachments gump and then selecting the properties button on the XmlParagon attachment.
Paragon spawning on any spawner with this attachment will be controlled by the attachment settings. Normal paragon settings such as map restrictions will not apply. This means that you can enable paragon spawning on any spawner on any map regardless of the default Paragon settings by adding the attachment to the spawner.
To disable paragon spawning on any spawner, just set the EnableParagon property on the attachment to false.
The ConvertFactor property will affect the relative frequency of paragon spawning. A value of 1 will result in the standard paragon spawning rate that uses a formula that takes fame of the spawn into account. Increasing the value will result in more frequent paragon spawning. Reducing the value (minimum value is zero) will decrease the frequency.
The ArtifactFactor property will affect the relative frequency of artifact drops. A value of 1 will result in the standard paragon artifact drop rate that uses a formula that takes fame of the spawn and luck of the killer into account. Increasing the value will result in more frequent paragon artifact drops. Reducing the value (minimum value is zero) will decrease the frequency.
Additional properties that can be individually adjusted in the standard attachment include:
Hue
HitsBuff
StrBuff
IntBuff
DexBuff
SkillsBuff
SpeedBuff
FameBuff
KarmaBuff
DamageBuff
ChestChance
ParagonLabel
Custom paragon attachments can also be scripted with different default behavior. Some simple examples have been included. MLParagon.cs changes the artifact drops to ML artifacts. WeakParagon.cs is an XmlParagon attachment with weaker default buff factors.
Custom attachments derived from the XmlParagon attachment can also be scripted and with the following methods that can be overridden for further customization

CODE
public virtual void XmlAddChest(BaseCreature bc, int treasureLevel) public virtual double XmlChestChance(BaseCreature bc) public virtual string XmlGetParagonLabel(BaseCreature bc) public virtual void XmlConvert(BaseCreature bc) public virtual void XmlUnConvert(BaseCreature bc)
public virtual bool XmlCheckConvert(BaseCreature bc, Point3D location, Map m)
public virtual bool XmlCheckArtifactChance(Mobile m, BaseCreature bc)
public virtual void XmlGiveArtifactTo(Mobile m, BaseCreature bc)

Installation:
This system involves making six modifications to the BaseCreature script. No other scripts are affected. No changes to any serialization are made so the system can be safely added and removed at any time. Standard paragon spawning on spawners that do not have this attachment is not affected by this system.
The system requires installation of the XmlSpawner package that can be found here
http://xmlspawner.15.forumer.com/index.php?showtopic=517
Note that updating XmlSpawner2.cs to the most recent version (beta v3.25 or higher) will add support for display of the customized paragon setting in the spawner properties list on mouseover.
XMLSpawnerFan -> What's in the next release?
see the XmlParagon.txt file for detailed installation instructions.
koluch- 03-05-2008
Is it possible to override the paragon block of not being tamable?
If I make a class such as TamableParagon.cs, is there a simple override for:
1 - in BaseCreature, paragons cant be tamed so neither can XML paragons:

CODE
[CommandProperty( AccessLevel.GameMaster )] public bool Tamable { get {
return m_bTamable && !m_Paragon;
}
set
{
m_bTamable = value;
}
}

2 - or would there have to be a total declaration in the XMLParagon, along with changes in basecreature(ok now I have a headache )
public override bool Tamable{ get{ return true; } }
or adding (for exampe on the spawner):
Horse/TAMABLE/true
..yes neither of these will override the BaseCreature declaration, thought maybe there is an easy override..maybe(?)(?)
(our players "suggestion" was to have an Albino class of creatures, with slightly higher buffs and still be tamable)
Thanks for any help or suggestions.
Koluch
aka - sorrowful Packer Fan, didnt get to see Favre in Lambeau..now hes retired
ArteGordon- 03-05-2008
there are a couple of ways you could do this.
If you wanted to allow taming of any tamable paragon creature that is spawned off of a spawner tagged with your custom TamableParagon attachment, you could make this basecreature.cs mod

QUOTE
[CommandProperty( AccessLevel.GameMaster )] public bool Tamable { get {
return m_bTamable && (!m_Paragon || XmlParagon.GetXmlParagon(this) is TamableParagon);
}
set
{
m_bTamable = value;
}
}

That test will allow a creature to be tamed if it is tamable and it is either not paragon or it is from a TamableParagon spawner.
If you wanted to support tagging individual creatures as tamable regardless of their paragon status instead of entire spawners, you could make the mod like this

QUOTE
[CommandProperty( AccessLevel.GameMaster )] public bool Tamable { get {
return m_bTamable && (!m_Paragon || XmlAttach.FindAttachment(this, typeof(XmlData), "TamableParagon") != null);
}
set
{
m_bTamable = value;
}
}

and then you could spawn individual creatures with an XmlData attachment named "TamableParagon" that would allow them to be tamed even if paragon like this
Horse/ATTACH/XmlData,TamableParagon
That mod doesnt require any XmlParagon involvement.
if you wanted to support both approaches it would look like this

QUOTE
[CommandProperty( AccessLevel.GameMaster )] public bool Tamable { get {
return m_bTamable && (!m_Paragon || XmlParagon.GetXmlParagon(this) is TamableParagon || XmlAttach.FindAttachment(this, typeof(XmlData), "TamableParagon") != null);
}
set
{
m_bTamable = value;
}
}

koluch- 03-05-2008
hehe perfect Arti!
Just what I needed!
Now..decisions decisions!!!!!
koluch- 03-10-2008
Made a TamableParagon.cs
The script makes (Albino) creatures, but the Albino tag turns to Paragon after the creatures is tamed(not sure think on a save??)
Here is the TamableParagon.cs :

CODE
using System; using Server; using Server.Items; using Server.Mobiles; namespace Server.Engines.XmlSpawner2
{
public class TamableParagon : XmlParagon
{
// string that is displayed on the xmlspawner when this is attached
public override string OnIdentify(Mobile from)
{
return String.Format("Albino {0}", base.OnIdentify(from));
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
// version 0
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
// version 0
}
#region constructors
public TamableParagon(ASerial serial)
: base(serial)
{
}
[Attachable]
public TamableParagon()
: base()
{
Hue = 1151;
// reduced buff modifiers
HitsBuff = 1.5;
StrBuff = 1.05;
IntBuff = 1.10;
DexBuff = 1.10;
SkillsBuff = 1.20;
SpeedBuff = 1.0;
FameBuff = 1.40;
KarmaBuff = 1.40;
DamageBuff = 2;
ArtifactFactor = 0;
ChestChance = .10;
ParagonLabel = "(Albino)";
}
#endregion
}
}

...did I miss something perhaps?
Thanks
ArteGordon- 03-11-2008
Once a creature is tamed, it is no longer under spawner control and loses all association with the original spawner and so the XmlParagon attachment on that spawner no longer has any effect. Since the suggested STEP 4 installation mod generates the title on the fly based on the spawner that the creature is associated with, no spawner association means no custom paragon title.
If you wanted to have a permanent title that would continue even after the connection with the spawner was lost (e.g. after taming) I would make this mod in basecreature.cs

QUOTE
public override string ApplyNameSuffix(string suffix) { XmlData customtitle = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData),"ParagonTitle"); if (customtitle != null) {
// use the existing custom title instead of generating one
suffix = customtitle.Data;
} else
if (IsParagon)
{
// ARTEGORDONMOD
// allow custom paragon labels
if (suffix.Length == 0)
suffix = XmlParagon.GetParagonLabel(this);
else
suffix = String.Concat(suffix, " " + XmlParagon.GetParagonLabel(this));
// add the custom paragon labels to the creature in the form of an XmlData attachment so that it will remain even if the spawner association is lost such as after taming
XmlAttach.AttachTo(this, new XmlData("ParagonTitle", suffix));
// end mod to allow custom paragon labels
}
return base.ApplyNameSuffix(suffix);
}

This is a variation of STEP 4 of the installation that puts the custom title information into an XmlData attachment that goes on the creature so that it will always be associated with the creature even after it is tamed.
koluch- 03-11-2008
Thanks!
Koluch