Full Version : Idols Question
xmlspawner >>Scripting Support >>Idols Question


<< Prev | Next >>

Erica- 08-03-2006
Hi ArteGordon i got a question i got a few scripts that are from 2.0 and are idol statues how would i edit the script so when you double click idol statue if mounted on a pet that it wont let you change to that creature of the statue idol while mounted im trying to add a line where if player double click idol statue that if there on any mounts wont let them and would give a message like cant change or use while on a mount heres one of the scripts.
CODE
using System;
using Server.Network;
using Server.Items;
using Server.Mobiles;

namespace Server.Items
{
  public class YamandonIdol : Item
  {
     [Constructable]
     public YamandonIdol() : base( 10097 )
     {
        Movable = true;
        Name = "Yamandon Idol";  
        LootType = LootType.Cursed;
     }

     public YamandonIdol( 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();
     }

     
     public override void OnDoubleClick( Mobile from )
     {
        if ( !from.InRange( GetWorldLocation(), 2 ) )
        {
           from.SendLocalizedMessage( 500446 ); // That is too far away.
        }
        else
        {
           if ( from.BodyValue == 0x190 || from.BodyValue == 0x191 )
           {
              from.BodyValue = 249;
              from.PlaySound( 362 );
             Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
             Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

           }
           else
           {
              if (from.Female == true )
               {
                 from.BodyValue = 0x191;
                 from.PlaySound( 362 );
                Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );
   
               }
              else
               {
                 from.BodyValue = 0x190;
                 from.PlaySound( 362 );
                Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

             }
           }
        }
     }
  }
}


Erica- 08-03-2006
Hi again ok i added a line and works tells you dismount first and cant mount but if your changed to idol monster you can double click your mount and be on him tho how can i get that to not happen as well heres the script i added the editing so cant mount using idol .
CODE
using System;
using Server.Network;
using Server.Items;
using Server.Mobiles;

namespace Server.Items
{
  public class AbyssmalIdol : Item
  {
     [Constructable]
     public AbyssmalIdol() : base( 9772 )
     {
        Movable = true;
        Name = "Abyssmal Horror Idol";  
        LootType = LootType.Cursed;
     }

     public AbyssmalIdol( 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();
     }

     
     public override void OnDoubleClick( Mobile from )
     {
        if ( !from.InRange( GetWorldLocation(), 2 ) )
        {
           from.SendLocalizedMessage( 500446 ); // That is too far away.
        }
        else if ( from.Mounted )
   {
 from.SendMessage("Please dismount first.");
   
   }

        else
        {
           if ( from.BodyValue == 0x190 || from.BodyValue == 0x191 )
           {
              from.BodyValue = 312;
              from.PlaySound( 1105 );
             Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
             Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

           }
           else
           {
              if (from.Female == true )
               {
                 from.BodyValue = 0x191;
                 from.PlaySound( 1105 );
                Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );
   
               }
              else
               {
                 from.BodyValue = 0x190;
                 from.PlaySound( 1105 );
                Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

             }
           }
        }
     }
  }
}
This is the part i added
CODE
else if ( from.Mounted )
   {
 from.SendMessage("Please dismount first.");
   
   }

Grimhawk- 08-04-2006
Not sure if this will work but it did in 1.0 can try it though Erica.

CODE

     public override void OnDoubleClick( Mobile from )
     {
        if ( !from.InRange( GetWorldLocation(), 2 ) )
        {
           from.SendLocalizedMessage( 500446 ); // That is too far away.
        }
        else
{
if ( from.Mounted == true )
{
from.SendLocalizedMessage( 1042561 );
}

Erica- 08-04-2006
It works just the sameway i added the one i did as well but when you turn into the statue monster while being that monster you can double click your horse and will let you mount it tho.

ArteGordon- 08-04-2006
you are going to need to add a bodyvalue check to the OnDoubleClick method in basemount.cs to prevent them from mounting.