Discussion in   Coding Corner   started     11 years ago   July 14, 2013, 08:53:35 PM   by   Keldon

Weapon shipment box

Keldon
Offline
223 Posts
Topic :   Weapon shipment box
11 years ago  July 14, 2013, 08:53:35 PM

Kyn,


Take a look over this.  I am not certain I have the identifiers correct for all of the weapons and artys.  On the weapons I did kind of go over powered I think but hey they would be fun to have.


Let me know if anything is out of place so I can fix it as a script base to learn from.

Kyn
Offline
336 Posts
#1 Re :   Weapon shipment box
11 years ago  July 14, 2013, 08:56:52 PM

Kyn,


Take a look over this.  I am not certain I have the identifiers correct for all of the weapons and artys.  On the weapons I did kind of go over powered I think but hey they would be fun to have.


Let me know if anything is out of place so I can fix it as a script base to learn from.


I only had time to quickly glance at it before supper time but it looks fine to me. Its great to see someone experimenting with the basics and really taking their time to try and make something cool. :)

Keldon
Offline
223 Posts
#2 Re :   Weapon shipment box
11 years ago  July 14, 2013, 09:49:36 PM

I wanted to make something cool as well as have a general file for weapon identifiers for future scripts.  This was the best way I could think of to get both.

Keldon
Offline
223 Posts
#3 Re :   Weapon shipment box
11 years ago  July 16, 2013, 02:50:07 AM

New zip file and this one might actually be compile-able.


I got myself set up with Visual studio 2010 for C#.  I corrected all of my item pointers and realized I forgot a closing bracket in one spot on each file and added an extra one at the end.  I had the weapon attributes in the wrong section of the code and I had the slayer pointers wrong.

Keldon
Offline
223 Posts
#4 Re :   Weapon shipment box
11 years ago  July 16, 2013, 03:25:25 AM

I also have taken the executioner mob and modified it to beef it up and add the drop.


I think I am starting to get the basics down for this.


Next I will have to try and expand this with maybe a quest NPC giving directions to where they might be found.

Kyn
Offline
336 Posts
#5 Re :   Weapon shipment box
11 years ago  July 16, 2013, 04:24:47 AM

I also have taken the executioner mob and modified it to beef it up and add the drop.


I think I am starting to get the basics down for this.


Next I will have to try and expand this with maybe a quest NPC giving directions to where they might be found.




Why don't you add a little depth by making him talk?


Code: [Select]

private static bool m_Talked;
          string[]WeaponSmugglerSay = new string[]
          {
"He who knows when he can fight and when he cannot, will be victorious.",
"All war is based on deception.",
"feign inferiority and encourage his arrogance.",
"If you are far from the enemy, make him believe you are near.",
"If ignorant both of your enemy and yourself, you are certain to be in peril.",
"Thus, what is of supreme importance in war is to attack the enemy's strategy.",
};


I prefer to make my talking mobiles talk with a few restrictions and a spam timer is always good for realism.


Code: [Select]

 public override void OnMovement( Mobile m, Point3D oldLocation )
            {


                 if( m_Talked == false )
                 {
                      if ( m.InRange( this, 3 ) && m is PlayerMobile)
                       {


                             m_Talked = true;
                             SayRandom(WeaponSmuggerSay, this );
                             this.Move( GetDirectionTo( m.Location ) );
                             SpamTimer t = new SpamTimer();
                             t.Start();
                        }
                   }
              }


              private class SpamTimer : Timer
              {
                   public SpamTimer() : base( TimeSpan.FromSeconds( 12 ) )
                   {
                        Priority = TimerPriority.OneSecond;
                   }


                   protected override void OnTick()
                   {
                           m_Talked = false;
                   }
               }


Also, not sure if you have played around with the base on death method at all but if this is a mobile that is going to be farmed I always like to add a specific drop chance as opposed to something that can be stolen from their pack. Maybe you could create greater/lesser boxes that drop that have a chance to drop differen't types and qualities of items?


Code: [Select]

public override void OnDeath(Container c)
        {
            base.OnDeath(c);
 
            if ( 0.20 > Utility.RandomDouble() ) //Drop chance
            {
            switch(Utility.Random(4))
                {
                case 0: default: c.DropItem( new NoDachi() ); break;
                case 1: c.DropItem( new ArmsOfTacticalExcellence() ); break;
                case 2: c.DropItem( new AncientSamuraiDo() ); break;
                case 3: c.DropItem( new Dagger() ); break;
               
                }
            }
        }

Keldon
Offline
223 Posts
#6 Re :   Weapon shipment box
11 years ago  July 16, 2013, 04:30:36 AM

Hmm, all great stuff.  I will see what I can stick together when I get up.  For now its off to bed.