Who would be interested in a script capable of generating thousands of armor / weapon scripts with balanced attributes and stats?
I have tried and tested a special method for generating the maximum amount of combinations of unique armor and weapons and thus, with given arguments, have been able to generate over 10,000 Armor and 6,000 Weapon scripts for my shard.
Unfortunately, my shard uses a completely different "simplified" method of setting properties, so the output is absolutely incompatible with and standard version of RunUO.
My proposal is, if enough people are interested in using this idea, I will be happy to manufacture it towards supporting RunUO standard installations.
The main aim of the generation is to generate as many combinations of unique armor and weapon scripts, where each item has it's own class name and unique properties written with clean, error free and semi-annotated code.
The core key in being able to create such a unique armor or weapon script lies in the "Lore" of the item, the current list is as follows:
Code:
public enum ItemLore
{
NotSet,
FixLore,
Gladiator,
Bandit,
Invoker,
Caster,
Wizard,
Wraith,
Conjurer,
Doctor,
Healer,
Angel,
Devil,
Darkness,
Shadows,
Earth,
Arcanist,
Warrior,
Stealther,
Moon,
Sun,
Blizzard,
Night,
Day,
Knight,
Mage,
Storm,
Hurricane,
Farplane,
Conqueror,
Void,
Bear,
Whale,
Eagle,
Owl,
Wolf,
Tiger,
Beast,
Demon,
Ghost,
Sundering,
Spirit,
Earthblood,
Ludicrous,
Serpentine,
Snake,
Ocean,
Waters,
Lifeblood,
Depths,
Nether,
}
The Lore effects the elemental attributes and especially the Class Name and Item Name of the armor or weapon.
The Item Name is decided by using a random enumeration of either
all Weapon or Armor ItemID's, the enumeration keys are named according to the relative ItemID name in TileData.mul, these are the base Item Names that the generator will use.
The Armor Generator is capable of distinguishing between Body Armor and Shields.
the Weapon Generator is capable of distinguishing between Bows, One-Handed and Two-Handed Weapons.
This includins the fact that a Weapon may be a Melee Two-Handed or a Ranged Two-Handed Weapon.
Attributes are categorized into 3 groups:
- Misc: Represents Attributes not related to Melee or Magic specifically.
- Melee: Represents all attributes unique to Melee specifically.
- Magic: Represents all attributes unique to Magic specifically.
Items can be generated into a total of 5 categories by using a combination of the above list, those final categories are:
- Misc
- Magic
- Magic & Misc
- Melee
- Melee & Misc
Depending on the selected category for the generated item, only attribute that pertain to that category will be selected as viable attributes to apply in the output script.
The generation process is as follows:
- -> Select ItemLore
- -> Parse Class Name
- -> Set Item Name
- -> Affix Lore to Item Name
- -> Select Unique Attributes
- -> Filter Attributes (Melee/Magic)
- -> Select Melee/Magic Item Type
- -> Apply Melee/Magic Attributes
- -> Set Appropriate Resistances/Damage Types Using ItemLore
- -> Write Generated Armor/Weapon Item As Script (.cs)
After each script is generated, the Class Name is added to a cache file (Generator.cache) prefixed with the total list count. This is to prevent the generator from producing duplicate scripts. The cache file is Saved and Loaded each time the generator runs, meaning that it will remember what has previously been generated, killing any chance to produce duplicate entris.
The generator will attempt to generate scripts in blocks of 1000.
The main entry method for the generator is contained in a
while statement and for each block of 1000 scripts, a baked-in 30-second timeout is applied to break from the loop.
The generator will also count how many scripts have been generated in each block of 1000, it may fall short easily, if it has tried to create a duplicate entry.
So, there is now an "infinite" loop, or so it seems...
To achieve the absolute, unknown
MAXIMUM amount of combinations, the loop will not be broken unless one of two conditions are met:
- The Total Generated Scripts (In this block of 1000) is 0
- The Generator Reaches The Specified TimeOut Period (Of 30 seconds per block of 1000)
Samples:
Each ¦ represents one block of 1000.
Code:
Generating Armor Scripts...
¦¦¦¦¦¦¦¦¦¦¦¦Generator Timed Out.
Done: Generated 11786 Armor Scripts.
-
Generating Weapon Scripts...
¦¦¦¦¦¦Generator Timed Out.
Done: Generated 6158 Weapon Scripts.
Output Armor Script Sample:
Note that this item would actually be considdered a very hard and "imbalanced" item according to most shard owner's standards.
Code:
using System;
using Server;
using Server.Items;
namespace Server.Items
{
public class BoneArmsOfTheLudicrous : BaseArmor
{
[Constructable]
public BoneArmsOfTheLudicrous( )
: base( 0x1453 ) //5203
{
Hue = 2415;
Name = "Bone Arms";
Weight = 2.0;
Layer = Layer.Arms;
Attributes.RegenHealth = 90;
Attributes.RegenMana = 81;
Attributes.Intelligence = 90;
Attributes.SpellRecovery = 108;
Attributes.ReducedManaCost = 108;
SetStrengthLevel( StrengthLevel.Ultimate );
ItemLore = ItemLore.Ludicrous;
ItemBind = ItemBind.OnPickup;
ItemRank = ItemRank.Legendary;
}
public BoneArmsOfTheLudicrous( Serial serial )
: base( serial )
{ }
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 ); //Version #
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt( ); //Version #
}
}
}
See: Output Armor Generator Cache File sample as attached.
So the input I want to see is sujestions about improving the generation process, maybe you know a better way to reach a total number of possible unknown combinations? Maybe you have a few "Lores" to add to the list?
Please comment, rate and share.
Regards,
Vorspire