Full Version : I need help
xmlspawner >>Scripting Support >>I need help


<< Prev | Next >>

ozzy- 01-11-2007
hello all im new here. Im having trouble with the on removed method. This script uses 2 diff id's. normal robe id the player's name is as normal. The second id a shroud changes player's name to a shrouded figure. That part all works ok well did lol. My main problem is when the player name is a shrouded figure item id a shroud, and you remove the shroud the name remains a shrouded figure. I want to change this so it will change the player's name back to normal when removed, without messing up the double click name change. Here is the script.

CODE

using System;
using Server.Items;

namespace Server.Items
{
  public class RobeOfOzz : BaseArmor
  {

       public override int BasePhysicalResistance{ get{ return 70; } }
    public override int BaseFireResistance{ get{ return 70; } }
    public override int BaseColdResistance{ get{ return 70; } }
    public override int BasePoisonResistance{ get{ return 70; } }
    public override int BaseEnergyResistance{ get{ return 70; } }

       public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Cloth; } }

     [Constructable]
     public RobeOfOzz() : base( 0x1F03 )
     {
        Weight = 0.0;
        Name = "Robe Of Ozz";
        Hue = 1266;
        Attributes.AttackChance = 100;
        Attributes.BonusHits = 50;
        Attributes.BonusInt = 50;
        Attributes.BonusMana = 50;
        Attributes.BonusStam = 50;
        Attributes.BonusStr = 40;
        Attributes.BonusDex = 25;
        Attributes.CastRecovery = 10;
        Attributes.CastSpeed = 10;
        Attributes.DefendChance = 80;
  Attributes.EnhancePotions = 35;
        Attributes.LowerManaCost = 100;
        Attributes.LowerRegCost = 100;
        Attributes.Luck = 5000;
  Attributes.NightSight = 1;
        Attributes.ReflectPhysical = 100;
        Attributes.RegenStam = 15;
        Attributes.RegenHits = 50;
        Attributes.RegenMana = 20;
        Attributes.SpellDamage = 10;
        Attributes.WeaponDamage = 50;
        Attributes.WeaponSpeed = 80;
 
  LootType = LootType.Blessed;

     }

     public override void OnDoubleClick( Mobile m )
     {
        if( Parent != m )        
  {
           m.SendMessage( "You must be wearing the robe to use it!" );
        }
        else
        {
           if ( ItemID == 0x2683 )
           {
              m.SendMessage( "You lower the hood." );
              m.PlaySound( 0x57 );
              ItemID = 0x1F03;
     m.NameMod = null;
     m.DisplayGuildTitle = true;
              m.RemoveItem(this);
              m.EquipItem(this);
           }
           else if ( ItemID == 0x1F03 )
           {
              m.SendMessage( "You pull the hood over your head." );
              m.PlaySound( 0x57 );
              ItemID = 0x2683;
     m.NameMod = "A Shrouded Figure";
     m.DisplayGuildTitle = false;
              m.RemoveItem(this);
              m.EquipItem(this);
           }
        }
     }

      public override bool OnEquip( Mobile from )
     {
  from.Skills[SkillName.Hiding].Base += 20.0;
  from.Skills[SkillName.Stealth].Base += 20.0;
  return base.OnEquip(from);
     }

     public override void OnRemoved( object parent )
     {
       if ( parent is Mobile )
       {
      Mobile m = (Mobile)parent;
         m.Skills[SkillName.Hiding].Base -= 20.0;
      m.Skills[SkillName.Stealth].Base -= 20.0;
            ItemID == 0x2683;
            m.NameMod = null;
       }    
 base.OnRemoved( parent );
     }

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

  }
}


ozzy- 01-12-2007
ok never mind about this script i got it working but i posted another about hiding information