This attachment will allow you to restrict equipping an item based on conditional test strings that you assign.
This attachment requires xmlspawner installation step #9 in order to work.
By setting the Test property on the attachment to any valid conditional test you can test for name, karma, fame, hits, combinations of them etc.
When the player tries to equip the item, the attachment will evaluate the test and if it succeeds, they can equip, if it fails they cannot.
Setting the FailMsg property on the attachment will report the message to the player when they fail to equip.
The PropertyListString property allows you to specify a string that will be displayed on the property list for the item on mouseover (default is nothing). This feature requires xmlspawner installation step #11 in order to work.
It supports the following constructors
public XmlRestrictEquip()
public XmlRestrictEquip(string name)
public XmlRestrictEquip(string name, string Test)
public XmlRestrictEquip(string name, string Test, double expiresin)
The test uses the same syntax as other xmlspawner conditional tests where the equipping player would be considered the trigger mob. So, set the following would create a platehelm that could only be attached by a player named "blah"
platehelm/ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,name="blah">
To restrict an item to evil players only, use something like
platehelm/ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,karma<0 >
To only allow something to be equipped if another item is being carried, use something like
platehelm/ATTACH/<xmlrestrictequip/Test/@GETONCARRIED,mynameditem,visible=true>
To only allow something to be equipped if a special creature has been spawned from a particular spawner, use something like
longsword/ATTACH/<xmlrestrictequip/Test/@GETONSPAWN,specialspawner,1,name="The One">
To make an item display a custom property and report a custom message when a player fails to equip it, use something like
platehelm/ATTACH/<xmlrestrictequip/PropertyListString/Owner restricted/FailMsg/This can only be equipped by the original owner/Test/@GETONTRIGMOB,name="blah">
Will display the string
"Owner restricted"
in the properties list for the helm, and if someone other than the named player attempts to equip it, it will send them the message
"This can only be equipped by the original owner"
Thanks a mil Arte! your an absolute legend

Just a small bug i noticed...
i used ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,name={GETONTRIGMOB,name}
and when i do a [getatt on the item the test string has a "/" at the end
ie name=Vladimir/
which stops it from working. If i change it manually then it works 100%
yeah, its a parsing issue. It automatically appends a '/' to terminate entries that are left open. I'm looking at cleaning up the parser in general and that is something that will get taken care of.
But do it like this with the closing > and it will work. Note, you need the double quotes for proper name testing.
ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,name="{GETONTRIGMOB,name}">
QUOTE (Vladimir @ August 24, 2006 10:36 pm) |
Thanks a mil Arte! your an absolute legend 
Just a small bug i noticed...
i used ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,name={GETONTRIGMOB,name}
and when i do a [getatt on the item the test string has a "/" at the end
ie name=Vladimir/
which stops it from working. If i change it manually then it works 100% |
It's better to set it on serial..
ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,serial={GETONTRIGMOB,serial}>
because of incognito & disguise kit
btw, I don't know why, but when I use ...GETONTRIGMOB,serial}> or the same thing without ">" .. it's still GETONTRIGMOB,serial=0x1B2C/
(xmlspawner v311)
QUOTE (aph @ August 25, 2006 02:40 am) |
QUOTE (Vladimir @ August 24, 2006 10:36 pm) | Thanks a mil Arte! your an absolute legend 
Just a small bug i noticed...
i used ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,name={GETONTRIGMOB,name}
and when i do a [getatt on the item the test string has a "/" at the end
ie name=Vladimir/
which stops it from working. If i change it manually then it works 100% |
It's better to set it on serial.. ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,serial={GETONTRIGMOB,serial}> because of incognito & disguise kit
btw, I don't know why, but when I use ...GETONTRIGMOB,serial}> or the same thing without ">" .. it's still GETONTRIGMOB,serial=0x1B2C/ (xmlspawner v311)
|
yeah, that '/' thing is annoying.
another trick to get around that is to just add an empty compound | test like this
ATTACH/<xmlrestrictequip/Test/@GETONTRIGMOB,serial={GETONTRIGMOB,serial} | >
so that it will end up assigning the test as
GETONTRIGMOB,serial=0x1B2C | /
which will work.
Added a new FailMsg property that if assigned will report the message to the player when they fail to equip.
Also added the PropertyListString property that allows you to specify a string that will be displayed on the property list for the item on mouseover (default is nothing). This feature requires xmlspawner installation step #11.
platehelm/ATTACH/<xmlrestrictequip/PropertyListString/Owner restricted/FailMsg/This can only be equipped by the original owner/Test/@GETONTRIGMOB,name="blah">
Will display the string
"Owner restricted"
in the properties list for the helm, and if someone other than the named player attempts to equip it, it will send them the message
"This can only be equipped by the original owner"
Heya Arte...
I can't understand why but for some reason, it seems I can't use this on any head gear? Its working great for all other items... but head pieces can still be worn by anyone. Any ideas why this would be?
QUOTE (Vladimir @ August 26, 2006 11:12 am) |
Heya Arte...
I can't understand why but for some reason, it seems I can't use this on any head gear? Its working great for all other items... but head pieces can still be worn by anyone. Any ideas why this would be? |
so you mean that the platehelm example I posted doesnt work for you but other things do?
If this is not restricted to headgear, but also happens with other armor pieces I would guess that it has to do with installation step #9 being incomplete and perhaps missing the basearmor mod to the CanEquip method.
If it is just headgear, then perhaps you have some other custom mods to the basearmor.cs CanEquip method that overrides the attachment restrictions.
hmm no platehelms seem to be fine... having probs with cloth ninja hood and things like Hunters Headdress (Antler style head piece)... I'll check with my Admin that he did that installation step and see if there is a prob there
ah, those are clothing. The installation steps dont cover those. You will need to add another small mod to baseclothing.cs handle that.
Around line 228 at the end of the CanEquip method, change this
CODE |
return base.CanEquip( from );
|
to this
CODE |
// ARTEGORDONMOD // XmlAttachment check for CanEquip if (!Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, from)) { return false; } else {
return base.CanEquip(from); }
|
It is basically exactly the same mod as the one in basearmor.cs.
Might also want to add this to the end of the GetProperties method around line 649 while you are in there.
CODE |
// ARTEGORDONMOD // mod to display attachment properties Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list);
|