Karmageddon

Member
ServUO Version
Publish 58
Ultima Expansion
Time Of Legends
I am trying to add a property to items that are randomly generated as loot for an event.

I have tried adding this to the loot generation
C#:
private static void ApplyMarker(Item item)
        {
            item.InvalidateProperties();
        }

        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);
            list.Add(1359, "Blah Blah");
        }

This doesn't give any error on compile but does not apply the property.

This is the code I am using to generate the item for loot. This is only one part of the whole loot generation.
C#:
else if (item is BaseArmor armor)
                {
                    int attributeCount, min, max;
                    GetRandomAOSStats(out attributeCount, out min, out max);
                    BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                    
                    ApplyMarker(item);
                    item.Hue = 1359;
                    cont.DropItem(item);
                }
 
If you are adding a property the item has, then just add it like the comment points to below, just like hue or alike, if your trying to add a custom property, then that is a different avenue!

C#:
else if (item is BaseArmor armor)
                {
                    int attributeCount, min, max;
                    GetRandomAOSStats(out attributeCount, out min, out max);
                    BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                   
                    //Add props to the armor here, they have to be existing props the armor has!
   
                    ApplyMarker(armor);
                    armor.Hue = 1359;
                    cont.DropItem(armor);
                }
 
Then you'll need to add the custom property to the items you want it to be applied in your loot drops, you could make a interface and attach it for just those items. Or just add the property to the class, or make a generic class that you modify with the items info plus your custom prop! So in a way making a copy but adding a prop in the process. So where this is all going is that you first need to support the property by having it on the item first, can't just add props to a item if it doesn't have it already!
 
The problem with your code list.Add(1359, "Blah Blah") is that the first argument is not Hue, but Localization Number. It must exist in the Cliloc, for example list.Add(1041522, "Blah Blah") should work.
 

Active Shards

Donations

Total amount
$0.00
Goal
$500.00
Back