drewwales

Initiate
ServUO Version
Publish 58
Ultima Expansion
Endless Journey
Morning All,

I have a question in regards to custom weapons

So I copied the dagger script and changed a few things. such as name etc and changed the damage a little bit.

My query is, how come when ever this item drops on a corpse, it doesn't add random attribute like the normal dagger does?

Like if you have 1000 luck it will add like hit chance increase, or lower str requirements or any other random attribute. But my custom one doesn't do this.
 

Attachments

  • ChaosDagger.cs
    3.4 KB · Views: 10
just in fast "smoke view" you set "chaos" variable and a lot of others variables to 0 I dont see where you use those variables in the script... Are you missed the second part of the code?
 
Make sure to add your new weapon to the loot tables so they get the chance to become special. That is where that takes place. Just adding the item drop on the monster does not do it.
 
Make sure to add your new weapon to the loot tables so they get the chance to become special. That is where that takes place. Just adding the item drop on the monster does not do it.
I'm guessing that would be in Loot.cs? I'm fairly new to servUO as i used to use Sphere lol
 
instead of
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
set the damage


SetHits( 178, 291 );
SetMana( 80,120 );

SetDamage( 244, 350 );

SetDamageType( ResistanceType.Physical, 100 );

SetResistance( ResistanceType.Physical, 80, 105 );
SetResistance( ResistanceType.Fire, 45, 60 );
SetResistance( ResistanceType.Cold, 30, 55 );

SetSkill( SkillName.MagicResist, 155.1, 190.0 );
SetSkill( SkillName.Tactics, 103.3, 108.0 );
 
instead of
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
set the damage


SetHits( 178, 291 );
SetMana( 80,120 );

SetDamage( 244, 350 );

SetDamageType( ResistanceType.Physical, 100 );

SetResistance( ResistanceType.Physical, 80, 105 );
SetResistance( ResistanceType.Fire, 45, 60 );
SetResistance( ResistanceType.Cold, 30, 55 );

SetSkill( SkillName.MagicResist, 155.1, 190.0 );
SetSkill( SkillName.Tactics, 103.3, 108.0 );
I want those damage types as they are. What I want is when they drop on the mob random magical properties get added. For this I've been told to add them to loot tables. Just not sure where to find them
 
Yes you can add it to the loot table. But, you can also use a switch case to define specific attributes that you want to have and the amount of that attribute. As in this code
C#:
switch (Utility.Random(5))
            {
                case 0: ; Attributes.CastSpeed = Utility.RandomMinMax ( 2,4 );break;
                case 1: Attributes.CastRecovery = Utility.RandomMinMax ( 2,4 );; break;
                case 2: WeaponAttributes.HitLeechStam = Utility.RandomMinMax ( 70,90 );; break;
                case 3: WeaponAttributes.HitLeechHits = Utility.RandomMinMax ( 80,100 ); break;
                case 4: WeaponAttributes.HitLightning = Utility.RandomMinMax ( 70,90 );; break;
            }
 
Yes you can add it to the loot table. But, you can also use a switch case to define specific attributes that you want to have and the amount of that attribute. As in this code
C#:
switch (Utility.Random(5))
            {
                case 0: ; Attributes.CastSpeed = Utility.RandomMinMax ( 2,4 );break;
                case 1: Attributes.CastRecovery = Utility.RandomMinMax ( 2,4 );; break;
                case 2: WeaponAttributes.HitLeechStam = Utility.RandomMinMax ( 70,90 );; break;
                case 3: WeaponAttributes.HitLeechHits = Utility.RandomMinMax ( 80,100 ); break;
                case 4: WeaponAttributes.HitLightning = Utility.RandomMinMax ( 70,90 );; break;
            }
That's great to know to when i do some skill specific items thanks dude! but where do i edit the loot tables? is it in loot.cs?
 
Yes it is in the Loot.cs. You would need to add it into this bit of code I believe. Have not tested it.
C#:
private static readonly Type[] m_WeaponTypes = new[]
        {
            typeof(Axe), typeof(BattleAxe), typeof(DoubleAxe), typeof(ExecutionersAxe), typeof(Hatchet), typeof(LargeBattleAxe),
            typeof(TwoHandedAxe), typeof(WarAxe), typeof(Club), typeof(Mace), typeof(Maul), typeof(WarHammer), typeof(WarMace),
            typeof(Bardiche), typeof(Halberd), typeof(Spear), typeof(ShortSpear), typeof(Pitchfork), typeof(WarFork),
            typeof(BlackStaff), typeof(GnarledStaff), typeof(QuarterStaff), typeof(Broadsword), typeof(Cutlass), typeof(Katana),
            typeof(Kryss), typeof(Longsword), typeof(Scimitar), typeof(VikingSword), typeof(Pickaxe), typeof(HammerPick),
            typeof(ButcherKnife), typeof(Cleaver), typeof(Dagger), typeof(SkinningKnife), typeof(ShepherdsCrook),
            typeof(Scythe), typeof(BoneHarvester), typeof(Scepter), typeof(BladedStaff), typeof(Pike), typeof(DoubleBladedStaff),
            typeof(Lance), typeof(CrescentBlade), typeof(SmithyHammer), typeof(SledgeHammerWeapon)
        };
 
Yes it is in the Loot.cs. You would need to add it into this bit of code I believe. Have not tested it.
C#:
private static readonly Type[] m_WeaponTypes = new[]
        {
            typeof(Axe), typeof(BattleAxe), typeof(DoubleAxe), typeof(ExecutionersAxe), typeof(Hatchet), typeof(LargeBattleAxe),
            typeof(TwoHandedAxe), typeof(WarAxe), typeof(Club), typeof(Mace), typeof(Maul), typeof(WarHammer), typeof(WarMace),
            typeof(Bardiche), typeof(Halberd), typeof(Spear), typeof(ShortSpear), typeof(Pitchfork), typeof(WarFork),
            typeof(BlackStaff), typeof(GnarledStaff), typeof(QuarterStaff), typeof(Broadsword), typeof(Cutlass), typeof(Katana),
            typeof(Kryss), typeof(Longsword), typeof(Scimitar), typeof(VikingSword), typeof(Pickaxe), typeof(HammerPick),
            typeof(ButcherKnife), typeof(Cleaver), typeof(Dagger), typeof(SkinningKnife), typeof(ShepherdsCrook),
            typeof(Scythe), typeof(BoneHarvester), typeof(Scepter), typeof(BladedStaff), typeof(Pike), typeof(DoubleBladedStaff),
            typeof(Lance), typeof(CrescentBlade), typeof(SmithyHammer), typeof(SledgeHammerWeapon)
        };
I've done this and still nothing gets added. See the custom dagger and normal dagger that dropped in the images below.

attached the code and the original dagger. the only parts modified in the chaos dagger are

Added to the constructable:
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
        {
            //Chaos Damage
            chaos = Utility.RandomMinMax (25, 35);
            //Zero other aos damage types
            phys = nrgy = cold = pois = fire = direct = 0;
        }

and modfified

C#:
[Constructable]
        public ChaosDagger()
            : base(0xF52)
         
        {
            this.Weight = 1.0;

        }

To

C#:
[Constructable]
        public ChaosDagger()
            : base(0xF52)
         
        {
            Name = "Chaos Dagger";
            this.Weight = 1.0;
            this.Hue = 2075;
            Attributes.Luck = Utility.RandomMinMax (0, 5);
        }
1696344014377.png1696344028017.png
 

Attachments

  • ChaosDagger.cs
    3.4 KB · Views: 2
  • Dagger.cs
    2.9 KB · Views: 3
Last edited:
Have you tried basing your Chaos dagger directly off a dagger? Check what I did and test it that way.
 

Attachments

  • ChaosDagger.cs
    3.2 KB · Views: 5
Have you tried basing your Chaos dagger directly off a dagger? Check what I did and test it that way.
Used your code and still only these get applied (did it 5 times). Still nothing randomly gets added like the dagger image previously shown.

1696348551813.png
 
The other option to get it working the way you want would be to edit the LootPack.cs adding BaseKnife to the LootPackItem.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back