1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

BodySashofEttinStrengthv2.0

Discussion in 'Script Support' started by john burns, Feb 13, 2018.

  1. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    648
    Likes Received:
    16
    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 (C#):
    1. /*
    2. Body Sash of Ettin Strength
    3. Scripted by John Burns on 12-18-17
    4. Zak, Zaksmeer
    5.  
    6. Credits go out to:
    7.    Thank you to MondainsTriumph for creating the "Referral Sash", for which I "borrowed" & modified.
    8.    Also, thank you for whoever made the "Halloween Costumes" for which I started this project with.
    9.  
    10. THANK YOU goes out to Punkte, who discovered why my one major problem was only a minor problem, and how to fix it.
    11.  
    12. I made this after a friend of mine told me about his adventure in a previous D&D Campaign, from way back
    13. when, that involved his character finding a Girdle of Giant Strength. The Girdle was cursed. He put it on
    14. and it gave him the strength of a giant, but transformed him into a woman.
    15.  
    16. So I thought it would be kind of neat to bring that into the game, but as a "Body Sash of Ettin Strength".
    17. Just to let you know that doesn't mean it needs to stay a BodySash, you can make it anything you want.
    18.  
    19. */
    20.  
    21. using Server;
    22. using System;
    23.  
    24. namespace Server.Items
    25. {
    26.  
    27.     public class BodySashofEttinStrength20 : BodySash
    28.     {
    29.         [Constructable]
    30.         public BodySashofEttinStrength20() : base()
    31.         {
    32.             Name = "Body Sash of Ettin Strength";
    33.             Hue = 39;
    34.             Layer = Layer.MiddleTorso;
    35.             ItemID = 0x1541;
    36.             Weight = 2.0;
    37.             Attributes.BonusStr = 10; // -- You may adjust this number to your liking
    38.         }
    39.  
    40.         public BodySashofEttinStrength20(Serial serial) : base(serial)
    41.         {
    42.         }
    43.  
    44.         public override bool OnEquip( Mobile from )
    45.         {
    46.             if ( Mobile = Male ) //(base.OnEquip(from))
    47.             {
    48.                 // -- When they put the sash on - Male
    49.                 from.SendMessage("You put on the bodysash and have been transformed into a Beautiful Female Warrior!");
    50.                 from.BodyMod = 401;
    51.                 from.NameHue = 39;
    52.                 from.FacialHairItemID = 0;
    53.                 from.DisplayGuildTitle = true;
    54.             }
    55.             else
    56.             {
    57.             // -- When they put the sash on - Female
    58.                 from.SendMessage("You put on the bodysash and have been transformed into a Mighty Male Warrior!");
    59.                 from.BodyMod = 400;
    60.                 from.NameHue = 39;
    61.                 from.FacialHairItemID = 0;
    62.                 from.DisplayGuildTitle = true;
    63.             }
    64.             return false;
    65.         }
    66.        
    67.         public override void OnRemoved( object parent )
    68.         {
    69.  
    70.             if ( parent is Mobile )
    71.             {
    72.             // -- When they take the sash off - Male
    73.                 Mobile from = (Mobile)parent;
    74.                 from.SendMessage( "You take off the bodysash and return to your normal self." );
    75.                 from.BodyMod = 0;
    76.                 from.NameHue = -1;
    77.                 from.HueMod = -1;
    78.                 from.DisplayGuildTitle = true;
    79.             }
    80.             else
    81.             {
    82.                 // -- When they take the sash off - Female
    83.                 Mobile from = (Mobile)parent;
    84.                 from.SendMessage("You take off the bodysash and return to your normal self.");
    85.                 from.BodyMod = 1;
    86.                 from.NameHue = -1;
    87.                 from.HueMod = -1;
    88.                 from.DisplayGuildTitle = true;
    89.             }
    90.  
    91.             if ( parent is Mobile && ((Mobile)parent).Kills >= 5)
    92.                {
    93.                     ( (Mobile)parent).Criminal = true;
    94.                }
    95.             if( parent is Mobile && ((Mobile)parent).GuildTitle != null )
    96.                {
    97.                      ( (Mobile)parent).DisplayGuildTitle = true;
    98.                }              
    99.                 base.OnRemoved( parent );
    100.             }
    101.  
    102.         public override void Serialize(GenericWriter writer)
    103.         {
    104.             base.Serialize( writer );
    105.             writer.Write( (int) 0 );
    106.         }
    107.  
    108.         public override void Deserialize(GenericReader reader)
    109.         {
    110.             base.Deserialize( reader );
    111.             int version = reader.ReadInt();
    112.         }
    113.     }
    114.  
    115. }
     
  2. PyrO
    Offline

    PyrO Active Member

    Joined:
    Jan 27, 2015
    Messages:
    801
    Likes Received:
    40
    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 (C#):
    1. /*
    2. Body Sash of Ettin Strength
    3. Scripted by John Burns on 12-18-17
    4. Zak, Zaksmeer
    5.  
    6. Credits go out to:
    7.  Thank you to MondainsTriumph for creating the "Referral Sash", for which I "borrowed" & modified.
    8.  Also, thank you for whoever made the "Halloween Costumes" for which I started this project with.
    9.  
    10. THANK YOU goes out to Punkte, who discovered why my one major problem was only a minor problem, and how to fix it.
    11.  
    12. I made this after a friend of mine told me about his adventure in a previous D&D Campaign, from way back
    13. when, that involved his character finding a Girdle of Giant Strength. The Girdle was cursed. He put it on
    14. and it gave him the strength of a giant, but transformed him into a woman.
    15.  
    16. So I thought it would be kind of neat to bring that into the game, but as a "Body Sash of Ettin Strength".
    17. Just to let you know that doesn't mean it needs to stay a BodySash, you can make it anything you want.
    18.  
    19. */
    20.  
    21. namespace Server.Items
    22. {
    23.     public class CursedBodySashofEttinStrength : BodySash
    24.     {
    25.         public override double DefaultWeight { get { return 2; } }
    26.  
    27.         [Constructable]
    28.         public CursedBodySashofEttinStrength() : this(10)
    29.         { }
    30.  
    31.         [Constructable]
    32.         public CursedBodySashofEttinStrength(int strBonus) : base()
    33.         {
    34.             Name = "Body Sash of Ettin Strength";
    35.             Hue = 39;
    36.             Layer = Layer.MiddleTorso;
    37.             ItemID = 0x1541;
    38.             Attributes.BonusStr = strBonus; // -- You may adjust this number to your liking
    39.         }
    40.  
    41.         public CursedBodySashofEttinStrength(Serial serial) : base(serial)
    42.         { }
    43.  
    44.         public override bool OnEquip(Mobile from)
    45.         {
    46.             if (base.OnEquip(from))
    47.                 {
    48.                 if (from.BodyMod != 0)
    49.                 {
    50.                     from.SendMessage("Your transformed body refuses the sash!");
    51.                     return false;
    52.                 }
    53.                 if (from.Female)
    54.                 {
    55.                     // -- When they put the sash on - Female
    56.                     from.SendMessage("You put on the bodysash and have been transformed into a Mighty Male Warrior!");
    57.                     from.BodyMod = 400;
    58.                 }
    59.                 else
    60.                 {
    61.                     // -- When they put the sash on - Male
    62.                     from.SendMessage("You put on the bodysash and have been transformed into a Beautiful Female Warrior!");
    63.                     from.BodyMod = 401;
    64.                 }
    65.                 from.NameHue = 39;
    66.                 from.FacialHairItemID = 0;
    67.                 from.DisplayGuildTitle = from.GuildTitle != null;
    68.                 return true;
    69.             }
    70.             return false;
    71.         }
    72.  
    73.         public override void OnRemoved(object parent)
    74.         {
    75.             if (parent is Mobile)
    76.             {
    77.                 Mobile from = (Mobile)parent;
    78.                 from.SendMessage("You take off the bodysash and return to your normal self.");
    79.                 from.BodyMod = 0;
    80.                 from.NameHue = -1;
    81.                 from.HueMod = -1;
    82.                 from.DisplayGuildTitle = true;
    83.  
    84.                 if (from.Kills >= 5)
    85.                 {
    86.                     from.Criminal = true;
    87.                 }
    88.                 from.DisplayGuildTitle = from.GuildTitle != null;
    89.             }
    90.             base.OnRemoved(parent);
    91.         }
    92.  
    93.         public override void Serialize(GenericWriter writer)
    94.         {
    95.             base.Serialize(writer);
    96.             writer.Write(0);
    97.         }
    98.  
    99.         public override void Deserialize(GenericReader reader)
    100.         {
    101.             base.Deserialize(reader);
    102.             int version = reader.ReadInt();
    103.         }
    104.     }
    105. }
     
  3. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    648
    Likes Received:
    16
    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.
     
  4. PyrO
    Offline

    PyrO Active Member

    Joined:
    Jan 27, 2015
    Messages:
    801
    Likes Received:
    40
    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.
     
  5. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    648
    Likes Received:
    16
    so in other words, it would have to be race specific.

    Then make new sashes for the different races.

    ok.
     
  6. PyrO
    Offline

    PyrO Active Member

    Joined:
    Jan 27, 2015
    Messages:
    801
    Likes Received:
    40
    or you would ned to add a little bit of code so it works for all the races
     
  7. john burns
    Offline

    john burns Member

    Joined:
    Mar 12, 2014
    Messages:
    648
    Likes Received:
    16
    I like your way better