Full Version : Adding to XmlValue
xmlspawner >>Q&A >>Adding to XmlValue
<< Prev | Next >>
Lord Hog Fred- 08-13-2006
How would I go about adding to an XmlValue attachment?
I want to add say 15 to a players existing XmlValue attachment of name "X" what checks should I use to check the player for the XmlValue of the correct name and then update the int by adding the desired amount?
Thanks ,
ArteGordon- 08-13-2006
you should be able to use the INC,val keyword like this
SETONTRIGMOB/ATTACHMENT,xmlvalue,XS,value/INC,15
would increase the value of the xmlvalue attachment named "XS" by 15
Lord Hog Fred- 08-13-2006
Sorry I forgot to point out that I was trying to do this in a script not using the Spawner itself.
ArteGordon- 08-13-2006
ah, then it would look something like

CODE
XmlValue a = (XmlValue)XmlAttach.FindAttachment(from, typeof(XmlValue), "TheName"); if(a != null) { // found the attachment so add 15 to the Value property a.Value += 15;
}

where, 'from' would be a reference to the player you were checking, and "TheName" is the name of the XmlValue attachment you are looking for.
This is the general format for accessing and modifying the contents of attachments on objects.