RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Harvestable Drugs [RUNUO 2.0] [Callandor2k ML SVN]

Nuggsy

Wanderer
LdNS88;851751 said:
Hello. Sorry for my bad English :eek:
This script leads to a freeze on my server. If I start to use drugs quickly (purchased from drug dealer), the server freezes for a few seconds. There is no visible load on the processor, everything works as usual. Suppose, if I use the bong fast 4-5 times, the server freezes for a few seconds. Tried on two computers(*), it's definitely a problem on the server side. In this case, if we use the bong, etc. 1 every 15 seconds, then everything works without freezing. I do not understand what could be the problem.
Use RunUO Version 2.0, Build 3567.2838
( (*) first 1Ghz & 2GB ram DDR2 and second 3GhzX2 & 3.5GB ram DDR2 )
Thanks :)

On further testing(after some much needed sleep) I was able to get my server to repeat this. If you click the bong repeatedly about 10 times then it starts banging on the queue and shortly after everything on the server will freeze. It needs a cool down timer to keep from stacking up commands and locking up the server.
 

Thagoras

Sorceror
I was thinking about that issue too. Should have an InUse check...so you can only have one hit at a time.
 

LdNS88

Wanderer
Thank you all for your reply. If I understand correctly, you propose to introduce a delay to use the bong. But what about the situation when several people simultaneously use the bong? I think this also will freeze the server as if one person used a bong, but quickly. Once again sorry for my english, I'm trying to write correctly :eek:
 

Nuggsy

Wanderer
I was doing some testing while standing in a bunch of farm animals. I noticed the lag only occurred during one of the message routines, Case 2. Comment out the 2 Thread.Sleep lines Thagoras mentioned and it fixes it.

DrugSystem_Engine.cs
Code:
                    case 2:
                        {
                            m_Drunk.Say("What If You Were Like A Polar Bear?! Then You Like Start Dancin Like A Pixie!...");
                            m_Drunk.Say("*Breaks down laughing*");
                            m_Drunk.PlaySound(m_Drunk.Female ? 794 : 1066);
                            //Thread.Sleep(3000); <--Nuggsy #1
                            m_Drunk.PlaySound(m_Drunk.Female ? 794 : 1066);
                            //Thread.Sleep(3000); <--Nuggsy #2
                            m_Drunk.PlaySound(m_Drunk.Female ? 794 : 1066);
                            break;
                        }

To fix the problem with being able to stack them up you can add a stamina check in the public override void OnDoubleClick(Mobile from). Your stamina is dropped to 1 when you are stoned. I set it to check if your stamina is less then 50%, if it is then nothing happens.

Marijuana_WaterBong.cs OnDoubleClick
Code:
        public override void OnDoubleClick(Mobile from)
        {
            #region Nuggsy #1
            if (from.Stam > from.StamMax / 2)
            {
            #endregion
                Container pack = from.Backpack;

                if (pack != null && pack.ConsumeTotal(typeof(Marijuana_Leaves), 1))
                {
                    if (from.Body.IsHuman && !from.Mounted)
                    {
                        from.Animate(34, 5, 1, true, false, 0);

                    }
                    from.PlaySound(Utility.Random(0x20, 2));
                    from.SendMessage("You Pack A Bowl And Spark It Up!");
                    from.Meditating = true;
                    from.SendMessage("You Begin To Feel The Darkness Throughout Your Body!");
                    from.PlaySound(from.Female ? 798 : 1070);
                    from.Say("*hiccup!*");
                    Highness = 120;
                    new DrugSystem_StonedTimer(from, Highness).Start();
                }

                else
                {
                    from.SendMessage("Your Out Of Marijuana Leaves Bro!");
                    return;
                }
            #region Nuggsy #2
            }
            else
            {
            }
            #endregion
        }

Marijuana_Joint.cs OnDoubleClick
Code:
        public override void OnDoubleClick(Mobile from)
        {
            #region Nuggsy #1
            if (from.Stam > from.StamMax / 2)
            {
            #endregion
                Container pack = from.Backpack;

                if (pack != null && pack.ConsumeTotal(typeof(Marijuana_Joint), 1))
                {
                    if (from.Body.IsHuman && !from.Mounted)
                    {
                        from.Animate(34, 5, 1, true, false, 0);
                    }

                    from.SendMessage("You Ignite A Spark On A Nearby Rock And Light Up A Doobie.");
                    from.PlaySound(0x226);
                    Highness = 25;

                    if (Core.AOS)
                        from.FixedParticles(0x3735, 1, 30, 9503, EffectLayer.Waist);

                    else
                        from.FixedEffect(0x3735, 6, 30);

                    new DrugSystem_StonedTimer(from, Highness).Start();

                }
                else
                {
                    from.SendMessage("Your Must Have The Doobie In Your Pack To Toke It!");
                    return;
                }
            #region Nuggsy #2
            }
            else
            {
            }
            #endregion
        }

With the above edits and the new drug dealer I posted earlier it is running fine on my SVN 527 SA server.
 

LordBuddha

Wanderer
well, for the harvestable drugs folder


i tired # Drag And Drop The Folder In This Directory: ‘RunUO/Scripts/’

i tried it in the script folder itself, and customs, and i get errors for all the scripts....
 
nice script i was told about this after the first couple days i played well maybe something like it about a drug dealer that randomly showed up in places that sold mary jane and bongs and such wanted to add it as its cool waitin on the k9 unit till i get it workin but this is the error im havin other then netframework acting up after addin things and needin to reinstall the whole thing from scratch
Error:
+ Customs/Harvestable Drugs/System Engine/DrugSystem_Engine.cs:
CS0246: Line 160: The Type or namespace name 'Tle' could not be found <are you missing a using directive or an assembly reference?>
CS0029: Line 160: Cannot implicitly convert type 'Server.StaticTile[]' to 'Tile[]'
not sure what this is all about but eh any help would be nice :) im usin the ML SVN runuo 2.1 thats on the google check out callenders or how ever ya spell it sorry for the bad spellin
 
Top