This is an example of how to take two ItemID’s with different gumps and make a male/female item that will swap based upon gender.
This script example is great if you have wearable artwork that is not setup to swap in the mul files.
This script example is great if you have wearable artwork that is not setup to swap in the mul files.
Code:
using System;
using Server.Items;
using Server.Mobiles;
namespace Server.Items
{
[Flipable]
public class ClothingSwap_MF : BaseOuterTorso
{
public override int InitMinHits { get { return 10; } }
public override int InitMaxHits { get { return 20; } }
[Constructable]
public ClothingSwap_MF() : this( 0 )
{
}
[Constructable]
public ClothingSwap_MF( int hue ) : base( 0x7E28, hue ) //Male, default
{
Name = "Clothing Swaper Test";
Weight = 3.0;
}
public override bool OnEquip(Mobile from)
{
if( from.Female )
{
this.ItemID = 0x74A6; //Female, set to
return true;
}
else
{
this.ItemID = 0x7E28; //Male, set to
return true;
}
}
public override void OnRemoved( Object o )
{
if ( ItemID == 0x74A6 ) //IF Female
{
this.ItemID = 0x7E28; //Change back to, Male default
}
}
public ClothingSwap_MF( 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();
}
}
}