Full Version : XmlTitle Attachment
xmlspawner >>XMLSpawner Attachments >>XmlTitle Attachment
<< Prev | Next >>
Lord Hog Fred- 08-08-2006
Hello, it's me again with another idea. Sorry, I've just been really motivated on ideas and stuff for UO in general lately and thought I'd let you know my ideas .
Anyway, how about an XmlTitle attachment that when attached to a mobile would give them an added beneath their name, so not like a normal title that would appear next to their name such as "Eric, The Custom Titled" but it would appear in their 'properties list' (if mobiles have properties lists) as:
"Eric"
"The Custom Titled"
Could possibly be used for items as well to give them special titles to mark them as being from a particular event or quest such as "Christmas 2006" or "First Place Scavenger Hunter 2/11/06".
Ok I'm done now, sorry about going on about all these additions .
ArteGordon- 08-08-2006
Here is an XmlTitles attachment that will allow you to add a title to a target player or creature. You can also add multiple titles just by adding multiple attachments.
It has the following constructors
public XmlTitle(string name)
public XmlTitle(string name, string title)
public XmlTitle(string name, string title, double expiresin)
so for example adding the following attachments
[addatt xmltitle ranking "First Class"
[addatt xmltitle type Basketweaver
would result in a display of
playername
First Class
Basketweaver
You could also spawn creatures with titles with spawn entries like
orc/ATTACH/XmlTitle,title,Master Chef
this would spawn an orc with the name and title displayed as
orcname
Master Chef
You can also specify an expiration time (just like with any other attachment) for time limited titles.
[addatt xmltitle type Basketweaver 30
would assign the title of Basketweaver to the target for 30 minutes.
You might want to hand out time-limited titles as rewards for quests, for example, by specifying the XmlTitle attachment in the AttachmentString property of questholders.
Note that the 'name' of the attachment isnt really important unless you plan on adding multiple XmlTitle attachments and you want to keep them separate (in general if you add an attachment with the same type and name as an existing one, then it will replace the existing one).
To use this attachment you need to make the following mod to the AddNameProperties method in Playermobile.cs

QUOTE
public override void AddNameProperties(ObjectPropertyList list) { base.AddNameProperties(list); XmlTitle.AddTitles(this, list); }

and if you want to apply it to creatures, you need to make this mod to the AddNameProperties method in basecreature.cs

QUOTE
public override void AddNameProperties(ObjectPropertyList list) { base.AddNameProperties(list); XmlTitle.AddTitles(this, list); if (Controlled && Commandable)
{
if (Summoned)
list.Add(1049646); // (summoned)
else if (IsBonded) //Intentional difference (showing ONLY bonded when bonded instead of bonded & tame)
list.Add(1049608); // (bonded)
else
list.Add(502006); // (tame)
}
}

You could also mod scripts such as BaseArmor.cs or BaseWeapon.cs in the same way to add title support to those items as well.
Lord Hog Fred- 08-08-2006
Cool thanks Arte, you're hero.
I looked at the script and it seems to ahve a check for being added to items so I added the XmlTitle check to basearmor and added a title, only prob is that it replaces the name of the item and shifts everything down. No biggy as I wasn't really gonna use it for items but just thoguth I'd let you know.
Again thanks a lot .
ArteGordon- 08-08-2006
yeah, I just made a little change to fix up the formatting a bit.
The name replacement you saw with the item is because items typically have null names, so it interprets the title string as the name. If you give the item a name, I dont think that it will do that.
koluch- 03-07-2008
The latest release doesnt have a AddNameProperties in Playermobile.
Is there another place to address this now that it is changed?
(sorry to bug ya )
Thanks,
Koluch
ArteGordon- 03-07-2008

QUOTE (koluch @ March 07, 2008 09:53 pm)
The latest release doesnt have a AddNameProperties in Playermobile. Is there another place to address this now that it is changed? (sorry to bug ya ) Thanks, Koluch

instead of modding the existing one, just add the entire posted override to playermobile.cs

QUOTE
public override void AddNameProperties(ObjectPropertyList list) { base.AddNameProperties(list); XmlTitle.AddTitles(this, list); }

koluch- 03-09-2008
how can you remove a title given to a player using the addatt xmltitle thingee?
ArteGordon- 03-09-2008
just remove the attachment and the title will go away.
Hanse46- 04-05-2008
I added the XmlTitles to base create and have this error, any help anyone?

CODE
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979 Core: Running on .NET Framework Version 2.0.50727 Core: Optimizing for 2 processors Scripts: Compiling C# scripts...failed (1 errors, 26 warnings) Errors:
+ Engines/AI/Creature/BaseCreature.cs:
CS0103: Line 3863: The name 'XmlTitle' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

and here is the section is added this:

CODE
public override void AddNameProperties( ObjectPropertyList list ) { base.AddNameProperties( list ); XmlTitle.AddTitles(this, list); if ( Controlled && Commandable )
{
if ( Summoned )
list.Add( 1049646 ); // (summoned)
else if ( IsBonded ) //Intentional difference (showing ONLY bonded when bonded instead of bonded &
tame)
list.Add( 1049608 ); // (bonded)
else
list.Add( 502006 ); // (tame)
}

Greystar- 04-06-2008

QUOTE (Hanse46 @ April 05, 2008 11:39 pm)
I added the XmlTitles to base create and have this error, any help anyone?

CODE
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979 Core: Running on .NET Framework Version 2.0.50727 Core: Optimizing for 2 processors Scripts: Compiling C# scripts...failed (1 errors, 26 warnings) Errors:
+ Engines/AI/Creature/BaseCreature.cs:
CS0103: Line 3863: The name 'XmlTitle' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

and here is the section is added this:

CODE
public override void AddNameProperties( ObjectPropertyList list ) { base.AddNameProperties( list ); XmlTitle.AddTitles(this, list); if ( Controlled && Commandable )
{
if ( Summoned )
list.Add( 1049646 ); // (summoned)
else if ( IsBonded ) //Intentional difference (showing ONLY bonded when bonded instead of bonded &
tame)
list.Add( 1049608 ); // (bonded)
else
list.Add( 502006 ); // (tame)
}

Did you remember to add
using Server.Engines.XmlSpawner2;
to the top of basecreature.cs?
Hanse46- 04-06-2008
Thank you Greystar, I overlooked that part, now it works.
Greystar- 04-07-2008

QUOTE (Hanse46 @ April 06, 2008 03:41 pm)
Thank you Greystar, I overlooked that part, now it works.

Nah you didn't overlook it. It's not included in all postings I just know it's needed in whatever file MIGHT access anything to do with XMLSpawner.