Fisher

Member
I want to set a skill and stat loss on resurrection. I changed this from resurrectiongump.cs

Code:
 if (!Core.AOS)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss

                    if (loss < 0.85)
                        loss = 0.85;
                    else if (loss > 0.95)
                        loss = 0.95;

                    if (from.RawStr * loss > 10)
                        from.RawStr = (int)(from.RawStr * loss);
                    if (from.RawInt * loss > 10)
                        from.RawInt = (int)(from.RawInt * loss);
                    if (from.RawDex * loss > 10)
                        from.RawDex = (int)(from.RawDex * loss);

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                            from.Skills[s].Base *= loss;
                    }
                }

To this:
Code:
 if (!Core.AOS)
                {
                  if ( from.RawStr > 80 )
                          {
                          from.RawStr -= 1;
                          }
				  if ( from.RawDex > 80 )
                          {
                          from.RawDex -= 1;
                          }
					if ( from.RawInt > 80 )
                          {
                          from.RawInt -= 1;
                          }
				  if ( from.RawDex > 80 )
                          {
                          from.RawDex -= 1;
                          }
					for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base > 60)
                            from.Skills[s].Base - 1;
                    }
                }

These are my errors.

Code:
----------------------------------------------------------------------------
ServUO - [http://www.servuo.com] Version 0.5, Build 5487.4755
Publish 54
Core: Optimizing for 1 64-bit processor
RandomImpl: CSPRandom (Software)
Scripts: Compiling C# scripts...Failed with: 1 errors, 2 warnings
Warnings:
+ custom/BoxerChat/OnlineGump.cs:
    CS0219: Line 20: The variable 'ArrowPM' is assigned but its value is never u
sed
+ Mobiles/BaseCreature.cs:
    CS0429: Line 300: Unreachable expression code detected
Errors:
+ custom/ResurrectGump.cs:
    CS0103: Line 249: The name 'RawStr' does not exist in the current context
    CS0103: Line 253: The name 'RawDex' does not exist in the current context
    CS0103: Line 257: The name 'RawInt' does not exist in the current context
    CS0103: Line 261: The name 'RawDex' does not exist in the current context
    CS0201: Line 268: Only assignment, call, increment, decrement, and new objec
t expressions can be used as a statement
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Scripts: Compiling C# scripts...Failed with: 1 errors, 2 warnings
Warnings:
+ custom/BoxerChat/OnlineGump.cs:
    CS0219: Line 20: The variable 'ArrowPM' is assigned but its value is never u
sed
+ Mobiles/BaseCreature.cs:
    CS0429: Line 300: Unreachable expression code detected
Errors:
+ custom/ResurrectGump.cs:
    CS0103: Line 249: The name 'RawStr' does not exist in the current context
    CS0103: Line 253: The name 'RawDex' does not exist in the current context
    CS0103: Line 257: The name 'RawInt' does not exist in the current context
    CS0103: Line 261: The name 'RawDex' does not exist in the current context
    CS0201: Line 268: Only assignment, call, increment, decrement, and new objec
t expressions can be used as a statement
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Here is the complete file
Code:
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Network;

namespace Server.Gumps
{
    public enum ResurrectMessage
    {
        ChaosShrine = 0,
        VirtueShrine = 1,
        Healer = 2,
        Generic = 3,
        SilverSapling = 102034,
    }

    public class ResurrectGump : Gump
    {
        private readonly Mobile m_Healer;
        private readonly int m_Price;
        private readonly bool m_FromSacrifice;
        private readonly double m_HitsScalar;
        private readonly ResurrectMessage m_Msg;
        public ResurrectGump(Mobile owner)
            : this(owner, owner, ResurrectMessage.Generic, false)
        {
        }

        public ResurrectGump(Mobile owner, double hitsScalar)
            : this(owner, owner, ResurrectMessage.Generic, false, hitsScalar)
        {
        }

        public ResurrectGump(Mobile owner, bool fromSacrifice)
            : this(owner, owner, ResurrectMessage.Generic, fromSacrifice)
        {
        }

        public ResurrectGump(Mobile owner, Mobile healer)
            : this(owner, healer, ResurrectMessage.Generic, false)
        {
        }

        public ResurrectGump(Mobile owner, ResurrectMessage msg)
            : this(owner, owner, msg, false)
        {
        }

        public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg)
            : this(owner, healer, msg, false)
        {
        }

        public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg, bool fromSacrifice)
            : this(owner, healer, msg, fromSacrifice, 0.0)
        {
        }

        public ResurrectGump(Mobile owner, Mobile healer, ResurrectMessage msg, bool fromSacrifice, double hitsScalar)
            : base(100, 0)
        {
            this.m_Healer = healer;
            this.m_FromSacrifice = fromSacrifice;
            this.m_HitsScalar = hitsScalar;

            this.m_Msg = msg;

            this.AddPage(0);

            this.AddBackground(0, 0, 400, 350, 2600);

            this.AddHtmlLocalized(0, 20, 400, 35, 1011022, false, false); // <center>Resurrection</center>

            this.AddHtmlLocalized(50, 55, 300, 140, 1011023 + (int)msg, true, true); /* It is possible for you to be resurrected here by this healer. Do you wish to try?<br>
            * CONTINUE - You chose to try to come back to life now.<br>
            * CANCEL - You prefer to remain a ghost for now.
            */

            this.AddButton(200, 227, 4005, 4007, 0, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(235, 230, 110, 35, 1011012, false, false); // CANCEL

            this.AddButton(65, 227, 4005, 4007, 1, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(100, 230, 110, 35, 1011011, false, false); // CONTINUE
        }

        public ResurrectGump(Mobile owner, Mobile healer, int price)
            : base(150, 50)
        {
            this.m_Healer = healer;
            this.m_Price = price;

            this.Closable = false;

            this.AddPage(0);

            this.AddImage(0, 0, 3600);

            this.AddImageTiled(0, 14, 15, 200, 3603);
            this.AddImageTiled(380, 14, 14, 200, 3605);

            this.AddImage(0, 201, 3606);

            this.AddImageTiled(15, 201, 370, 16, 3607);
            this.AddImageTiled(15, 0, 370, 16, 3601);

            this.AddImage(380, 0, 3602);

            this.AddImage(380, 201, 3608);

            this.AddImageTiled(15, 15, 365, 190, 2624);

            this.AddRadio(30, 140, 9727, 9730, true, 1);
            this.AddHtmlLocalized(65, 145, 300, 25, 1060015, 0x7FFF, false, false); // Grudgingly pay the money

            this.AddRadio(30, 175, 9727, 9730, false, 0);
            this.AddHtmlLocalized(65, 178, 300, 25, 1060016, 0x7FFF, false, false); // I'd rather stay dead, you scoundrel!!!

            this.AddHtmlLocalized(30, 20, 360, 35, 1060017, 0x7FFF, false, false); // Wishing to rejoin the living, are you?  I can restore your body... for a price of course...

            this.AddHtmlLocalized(30, 105, 345, 40, 1060018, 0x5B2D, false, false); // Do you accept the fee, which will be withdrawn from your bank?

            this.AddImage(65, 72, 5605);

            this.AddImageTiled(80, 90, 200, 1, 9107);
            this.AddImageTiled(95, 92, 200, 1, 9157);

            this.AddLabel(90, 70, 1645, price.ToString());
            this.AddHtmlLocalized(140, 70, 100, 25, 1023823, 0x7FFF, false, false); // gold coins

            this.AddButton(290, 175, 247, 248, 2, GumpButtonType.Reply, 0);

            this.AddImageTiled(15, 14, 365, 1, 9107);
            this.AddImageTiled(380, 14, 1, 190, 9105);
            this.AddImageTiled(15, 205, 365, 1, 9107);
            this.AddImageTiled(15, 14, 1, 190, 9105);
            this.AddImageTiled(0, 0, 395, 1, 9157);
            this.AddImageTiled(394, 0, 1, 217, 9155);
            this.AddImageTiled(0, 216, 395, 1, 9157);
            this.AddImageTiled(0, 0, 1, 217, 9155);
        }

        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == this.m_Msg && 1 == info.ButtonID)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (null != pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map = pm.SSSeedMap;
                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map = pm.Map;
                    }
                    pm.Resurrect();
                }
                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (this.m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, this.m_Price))
                        {
                            from.SendLocalizedMessage(1060398, this.m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (this.m_Healer != null && from != this.m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(this.m_Healer, VirtueName.Compassion);

                    switch( level )
                    {
                        case VirtueLevel.Seeker:
                            from.Hits = AOS.Scale(from.HitsMax, 20);
                            break;
                        case VirtueLevel.Follower:
                            from.Hits = AOS.Scale(from.HitsMax, 40);
                            break;
                        case VirtueLevel.Knight:
                            from.Hits = AOS.Scale(from.HitsMax, 80);
                            break;
                    }
                }

                if (this.m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List<Item> items = new List<Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                                pack.DropItem(item);
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS)
                {
                   if ( from.RawStr > 80 )
                          {
                          from.RawStr -= 1;
                          }
				   if ( from.RawDex > 80 )
                          {
                          from.RawDex -= 1;
                          }
					if ( from.RawInt > 80 )
                          {
                          from.RawInt -= 1;
                          }
				   if ( from.RawDex > 80 )
                          {
                          from.RawDex -= 1;
                          }
					for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base > 60)
                            from.Skills[s].Base - 1;
                    }  
                }

                if (from.Alive && this.m_HitsScalar > 0)
                    from.Hits = (int)(from.HitsMax * this.m_HitsScalar);
            }
        }
    }
}
I have no idea what I am doing BTW.
THANKS!
 
Last edited:
I cant help you.... But I salute your "Just get in there and do it attitude"! You are not alone! GL finding the solution.
 
There should be no problem with referencing RawInt, RawStr, RawDex. Could be the error is actually somewhere else:

Change this:

Code:
                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base > 60)
                            from.Skills[s].Base - 1;
                    }

...to this:
Code:
                for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base > 60)
                            from.Skills[s].Base -= 1;
                    }
 
Thank you Lokai
This is what I ended up with at the end of the day

Code:
if (!Core.AOS)
                {
                    double loss = 1; // 5 to 15% loss

                  
                switch        (Utility.Random (3))
				 {
					case 1:
					if(from.RawStr * loss > 80)
                        from.RawStr -= 1;; break;
					
                    case 2:
					if(from.RawInt * loss > 80)
                      from.RawInt -= 1;; break;
                  
					case 3:
					if (from.RawDex * loss > 80)
                        from.RawDex -= 1;; break;
				 }
                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 60)
                            from.Skills[s].Base -= .5;
						else if (from.Skills[s].Base * loss > 70)
                            from.Skills[s].Base -= 1;
                    }
				
                }

And it works!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back