ServUO Version
Publish Unknown
Ultima Expansion
The Second Age
Hello! I have a strange problem with the Quest Scrolls I am using from the Random Quest Generator script. I have them set up so that when the scroll is generated instead of using object properties to display the quest information I have story, mostertype and person displayed as the name of the scroll. I did this because it is a T2A style shard and there aren't Context Menus and OPL isn't used. This works fine until the server saves and you log back in. At which point the name is only the first line. Is there a way to fix this? I will link an example below.

Before Save
QuestScroll 1.png

After Save
QuestScroll 2.png

Here is where I have been working:
C#:
[Constructable]
        public QuestScroll( int level ) : base( 5360 )
        {
            LootType = LootType.Blessed;
            Hue = ( Utility.RandomMinMax( 2, 400 ) );

            NType = Utility.RandomMinMax( 1, 2 ); // TYPE OF QUEST
            //NType = ( 2 ); // TYPE OF QUEST

            if ( level > 0 )
            {
                NLevel = level; // QUEST LEVEL

                int tName = Utility.RandomMinMax( 1, 100 );

                if ( tName > 90 )
                {
                    NItemName = m_Items5[Utility.Random(m_Items5.Length)] + "'s Scroll of " + m_Items6[Utility.Random(m_Items6.Length)] + " " + m_Items7[Utility.Random(m_Items7.Length)];
                }
                else if ( tName > 45 )
                {
                    NItemName = "the " + m_Items3[Utility.Random(m_Items3.Length)] + " " + m_Items1[Utility.Random(m_Items1.Length)] + " of " + m_Items4[Utility.Random(m_Items4.Length)];
                }
                else
                {
                    NItemName = "the " + m_Items1[Utility.Random(m_Items1.Length)] + " of " + m_Items2[Utility.Random(m_Items2.Length)];
                }
            }

            if ( level == 1 )
            {
                NLocation = m_Places1[Utility.Random(m_Places1.Length)];
                NMonsterType = m_Monster1[Utility.Random(m_Monster1.Length)];
                NChance = Utility.RandomMinMax( 5, 30 );
                NNeed = Utility.RandomMinMax( 1, 10 );
            }

            else if ( level == 2 )
            {
                NLocation = m_Places2[Utility.Random(m_Places2.Length)];
                NMonsterType = m_Monster2[Utility.Random(m_Monster2.Length)];
                NChance = Utility.RandomMinMax( 10, 35 );
                NNeed = Utility.RandomMinMax( 1, 10 );
            }

            else if ( level == 3 )
            {
                NLocation = m_Places3[Utility.Random(m_Places3.Length)];
                NMonsterType = m_Monster3[Utility.Random(m_Monster3.Length)];
                NChance = Utility.RandomMinMax( 15, 40 );
                NNeed = Utility.RandomMinMax( 1, 10 );
            }

            else if ( level == 4 )
            {
                NLocation = m_Places4[Utility.Random(m_Places4.Length)];
                NMonsterType = m_Monster4[Utility.Random(m_Monster4.Length)];
                NChance = Utility.RandomMinMax( 20, 45 );
                NNeed = Utility.RandomMinMax( 1, 10 );
            }

            else if ( level == 5 )
            {
                NLocation = m_Places5[Utility.Random(m_Places5.Length)];
                NMonsterType = m_Monster5[Utility.Random(m_Monster5.Length)];
                NChance = Utility.RandomMinMax( 25, 55 );
                NNeed = Utility.RandomMinMax( 1, 5 );
            }

            else if ( level == 6 )
            {
                NLocation = m_Places6[Utility.Random(m_Places6.Length)];
                NMonsterType = m_Monster6[Utility.Random(m_Monster6.Length)];
                NChance = Utility.RandomMinMax( 30, 60 );
                NNeed = 1;
            }
            
            if ( NType == 1 )
            {
                string sPerson = "";

                if ( Utility.RandomMinMax( 1, 2 ) == 1 )
                {
                    sPerson = NameList.RandomName( "female" );
                }
                else
                {
                    sPerson = NameList.RandomName( "male" );
                }

                if ( Utility.RandomMinMax( 1, 3 ) > 1 )
                {
                    NStory = sPerson + " " + m_Story2[Utility.Random(m_Story2.Length)];
                }
                else
                {
                    NStory = m_Story3[Utility.Random(m_Story3.Length)] + " " + sPerson;
                }
              
                   Name = "Slay a " + NMonsterType + " (" + NGot.ToString() + " of " + NNeed.ToString() + ")" + " : (Lvl " + NLevel + " Quest)" + " " + NStory +".";
                
              
            }
            else
            {
                NNeed = 1;
                NStory = m_Story1[Utility.Random(m_Story1.Length)] + " " + NLocation;
                Name = "Seek " + NItemName + ". " + NStory + " : (Lvl " + NLevel + " Quest)";
              
            }
        }

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

Attachments

  • QuestScroll.cs
    80.3 KB · Views: 3
Well looking at the code, for some reason you reset the name on deserialize, and you do not include the full text.

You dont need to rename the item in the deserialize since the Name is already serialized and read correctly
 
Well looking at the code, for some reason you reset the name on deserialize, and you do not include the full text.

You dont need to rename the item in the deserialize since the Name is already serialized and read correctly
Oh that is odd. I don't remember doing that. Well thank you Pyro! I removed the code from renaming at deserialize and it works great now.
 
Not that it was needed, but I felt like cleaning up the script a little and giving it a little bit more maintainability.

Should be easier to edit for new types and so on
 

Attachments

  • QuestScroll.cs
    71.1 KB · Views: 4
Not that it was needed, but I felt like cleaning up the script a little and giving it a little bit more maintainability.

Should be easier to edit for new types and so on
Wow! Thank you soo much! You're a Rockstar!
 
Give it a good test though, from my little testing it seemd to work fine
Oh yeah you are right it does not like that at all hahaha but I am on RunUO 2.3 also not servuo
C#:
Errors:
 + Custom/Mobiles/Random Quest Generator/QuestGiver.cs:
    CS1061: Line 216: 'Server.Items.QuestScroll' does not contain a definition for 'NNeed' and no extension method 'NNeed' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 216: 'Server.Items.QuestScroll' does not contain a definition for 'NGot' and no extension method 'NGot' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 224: 'Server.Items.QuestScroll' does not contain a definition for 'NType' and no extension method 'NType' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 225: 'Server.Items.QuestScroll' does not contain a definition for 'NItemName' and no extension method 'NItemName' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 229: 'Server.Items.QuestScroll' does not contain a definition for 'NLevel' and no extension method 'NLevel' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 234: 'Server.Items.QuestScroll' does not contain a definition for 'NLevel' and no extension method 'NLevel' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 304: 'Server.Items.QuestScroll' does not contain a definition for 'NLevel' and no extension method 'NLevel' accepting a first argument of type 'Server.Items.QuestScroll' could be found (are you missing a using directive or an assembly reference?)
 + Custom/Mobiles/Random Quest Generator/QuestScroll.cs:
    CS1502: Line 885: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 885: Argument 1: cannot convert from 'Server.Items.MonsterEntry[]' to 'int[]'
    CS1502: Line 907: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 907: Argument 1: cannot convert from 'Server.Items.NamedRegion[]' to 'int[]'
    CS1502: Line 961: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 961: Argument 1: cannot convert from 'byte[]' to 'int[]'
    CS1502: Line 974: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 974: Argument 1: cannot convert from 'Server.Items.MonsterEntry[]' to 'int[]'
    CS1502: Line 980: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 980: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 984: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 984: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 991: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 991: Argument 1: cannot convert from 'Server.Items.NamedRegion[]' to 'int[]'
    CS1502: Line 996: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 996: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 996: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 996: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 996: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 996: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1000: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1000: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1000: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1000: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1000: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1000: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1004: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1004: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1004: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1004: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS1502: Line 1007: The best overloaded method match for 'Server.Utility.RandomList(params int[])' has some invalid arguments
    CS1503: Line 1007: Argument 1: cannot convert from 'string[]' to 'int[]'
    CS0246: Line 320: The type or namespace name 'ToxicElemental' could not be found (are you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 
Yea, xD well the QuestGiver ok, those errors come because I named / renamed the Properties slightly different.

the QuestScroll itself? Well thats related to RunUO2.3, didnt know it didnt have the RandomList method.
Will grab a 2.3 RunUO Copy and give it a go there to make it work
 
Yea, xD well the QuestGiver ok, those errors come because I named / renamed the Properties slightly different.

the QuestScroll itself? Well thats related to RunUO2.3, didnt know it didnt have the RandomList method.
Will grab a 2.3 RunUO Copy and give it a go there to make it work
if its easier I can just share mine with you haha
 
Compiles fine now, just did it the old way now :p and adjusted the QuestGiver.cs too
 

Attachments

  • QuestScroll.cs
    71.9 KB · Views: 3
  • QuestGiver.cs
    12 KB · Views: 3
  • QuestScroll.cs
    71.9 KB · Views: 2
Back