ok, I know this has to be a simple fix, but I got it this far and I cannot see where to fix this.
I am attempting to make this bodysash go either way. If you are a male, you get changed into a female. If you are female, you get changed into a male.

Help me out please.


Code:
/*
Body Sash of Ettin Strength
Scripted by John Burns on 12-18-17
Zak, Zaksmeer

Credits go out to:
   Thank you to MondainsTriumph for creating the "Referral Sash", for which I "borrowed" & modified.
   Also, thank you for whoever made the "Halloween Costumes" for which I started this project with.

THANK YOU goes out to Punkte, who discovered why my one major problem was only a minor problem, and how to fix it.

I made this after a friend of mine told me about his adventure in a previous D&D Campaign, from way back
when, that involved his character finding a Girdle of Giant Strength. The Girdle was cursed. He put it on
and it gave him the strength of a giant, but transformed him into a woman.

So I thought it would be kind of neat to bring that into the game, but as a "Body Sash of Ettin Strength".
Just to let you know that doesn't mean it needs to stay a BodySash, you can make it anything you want.

*/

using Server;
using System;

namespace Server.Items
{

    public class BodySashofEttinStrength20 : BodySash
    {
        [Constructable]
        public BodySashofEttinStrength20() : base()
        {
            Name = "Body Sash of Ettin Strength";
            Hue = 39;
            Layer = Layer.MiddleTorso;
            ItemID = 0x1541; 
            Weight = 2.0;
            Attributes.BonusStr = 10; // -- You may adjust this number to your liking
        }

        public BodySashofEttinStrength20(Serial serial) : base(serial)
        {
        }

        public override bool OnEquip( Mobile from )
        {
            if ( Mobile = Male ) //(base.OnEquip(from))
            {
                // -- When they put the sash on - Male
                from.SendMessage("You put on the bodysash and have been transformed into a Beautiful Female Warrior!");
                from.BodyMod = 401;
                from.NameHue = 39;
                from.FacialHairItemID = 0;
                from.DisplayGuildTitle = true;
            }
            else
            {
            // -- When they put the sash on - Female
                from.SendMessage("You put on the bodysash and have been transformed into a Mighty Male Warrior!");
                from.BodyMod = 400;
                from.NameHue = 39;
                from.FacialHairItemID = 0;
                from.DisplayGuildTitle = true;
            }
            return false;
        }
       
        public override void OnRemoved( object parent )
        {

            if ( parent is Mobile )
            {
            // -- When they take the sash off - Male
                Mobile from = (Mobile)parent;
                from.SendMessage( "You take off the bodysash and return to your normal self." );
                from.BodyMod = 0;
                from.NameHue = -1;
                from.HueMod = -1;
                from.DisplayGuildTitle = true;
            }
            else
            {
                // -- When they take the sash off - Female
                Mobile from = (Mobile)parent;
                from.SendMessage("You take off the bodysash and return to your normal self.");
                from.BodyMod = 1;
                from.NameHue = -1;
                from.HueMod = -1;
                from.DisplayGuildTitle = true;
            }

            if ( parent is Mobile && ((Mobile)parent).Kills >= 5)
               {
                    ( (Mobile)parent).Criminal = true;
               }
            if( parent is Mobile && ((Mobile)parent).GuildTitle != null )
               {
                     ( (Mobile)parent).DisplayGuildTitle = true;
               }               
                base.OnRemoved( parent );
            }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize( writer );
            writer.Write( (int) 0 );
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();
        }
    }

}
 
Try this one ;) and I renamed it so it doesnt have a number in its name (especially since it was the wrong value anyway ^^)

Code:
/*
Body Sash of Ettin Strength
Scripted by John Burns on 12-18-17
Zak, Zaksmeer

Credits go out to:
 Thank you to MondainsTriumph for creating the "Referral Sash", for which I "borrowed" & modified.
 Also, thank you for whoever made the "Halloween Costumes" for which I started this project with.

THANK YOU goes out to Punkte, who discovered why my one major problem was only a minor problem, and how to fix it.

I made this after a friend of mine told me about his adventure in a previous D&D Campaign, from way back
when, that involved his character finding a Girdle of Giant Strength. The Girdle was cursed. He put it on
and it gave him the strength of a giant, but transformed him into a woman.

So I thought it would be kind of neat to bring that into the game, but as a "Body Sash of Ettin Strength".
Just to let you know that doesn't mean it needs to stay a BodySash, you can make it anything you want.

*/

namespace Server.Items
{
    public class CursedBodySashofEttinStrength : BodySash
    {
        public override double DefaultWeight { get { return 2; } }

        [Constructable]
        public CursedBodySashofEttinStrength() : this(10)
        { }

        [Constructable]
        public CursedBodySashofEttinStrength(int strBonus) : base()
        {
            Name = "Body Sash of Ettin Strength";
            Hue = 39;
            Layer = Layer.MiddleTorso;
            ItemID = 0x1541;
            Attributes.BonusStr = strBonus; // -- You may adjust this number to your liking
        }

        public CursedBodySashofEttinStrength(Serial serial) : base(serial)
        { }

        public override bool OnEquip(Mobile from)
        {
            if (base.OnEquip(from))
            	{
                if (from.BodyMod != 0)
                {
                    from.SendMessage("Your transformed body refuses the sash!");
                    return false;
                }
                if (from.Female)
                {
                    // -- When they put the sash on - Female
                    from.SendMessage("You put on the bodysash and have been transformed into a Mighty Male Warrior!");
                    from.BodyMod = 400;
                }
                else
                {
                    // -- When they put the sash on - Male
                    from.SendMessage("You put on the bodysash and have been transformed into a Beautiful Female Warrior!");
                    from.BodyMod = 401;
                }
                from.NameHue = 39;
                from.FacialHairItemID = 0;
                from.DisplayGuildTitle = from.GuildTitle != null;
                return true;
            }
            return false;
        }

        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;
                from.SendMessage("You take off the bodysash and return to your normal self.");
                from.BodyMod = 0;
                from.NameHue = -1;
                from.HueMod = -1;
                from.DisplayGuildTitle = true;

                if (from.Kills >= 5)
                {
                    from.Criminal = true;
                }
                from.DisplayGuildTitle = from.GuildTitle != null;
            }
            base.OnRemoved(parent);
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
 
THANKS Pyro.

I put the number in the name because I had a copy of my server as a test server before I put anything into the "live" server to make sure things work (learn this from trial and error). But I had the original BodySash Script in there too so I just named it the way I did to let me know it was version 2.0. Thats all.

This will work even if they are gargoyle, elf, or human; or do I need to add further code to it?
Looks like I may have to.
 
well it would too but they wouldnt be the other gender of the other races. They would all turn into humans while they wear it.
 
Back