Discussion in   Coding Corner   started     10 years ago   February 11, 2014, 09:14:31 PM   by   Jericho

Dragon Of Descolence

Jericho
Offline
10 Posts
Topic :   Dragon Of Descolence
10 years ago  February 11, 2014, 09:14:31 PM

Dragon i made that Spawns Dragons when health gets below 100, took the idea and copied the layout from Baracoon file

Kyn
Offline
336 Posts
#1 Re :   Dragon Of Descolence
10 years ago  February 11, 2014, 09:18:11 PM

Dragon i made that Spawns Dragons when health gets below 100, took the idea and copied the layout from Baracoon file


Code: [Select]
int newDragon = Utility.RandomMinMax( 1, 2 );


         for ( int i = 0; i < newDragon; ++i )
         {
            Dragon Dragon = new Dragon();


            Dragon.Team = this.Team;
            Dragon.FightMode = FightMode.Closest;


            bool validLocation = false;
            Point3D loc = this.Location;


            for ( int j = 0; !validLocation && j < 10; ++j )
            {
               int x = X + Utility.Random( 3 ) - 1;
               int y = Y + Utility.Random( 3 ) - 1;
               int z = map.GetAverageZ( x, y );


               if ( validLocation = map.CanFit( x, y, this.Z, 16, false, false ) )
                  loc = new Point3D( x, y, Z );
               else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
                  loc = new Point3D( x, y, z );
            }


            Dragon.MoveToWorld( loc, map );
            Dragon.Combatant = target;
         }
      }



OnGotMeleeAttack
Code: [Select]
public override void OnGotMeleeAttack( Mobile attacker )
      {
         base.OnGotMeleeAttack( attacker );


         if ( 0.1 >= Utility.RandomDouble() )
            SpawnDragon( attacker );
      }