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!

Random Quest Generator - 2.0 Final

Djeryv

Sorceror
Random Quest Generator - 2.0 Final

Here is something I made for my server. It is a random quest generator that makes simple "fetch this", "kill that" type quests. Just put the 2 scripts into your custom scripts folder and off you go. Place the QuestGiver into the game (I use only one...but you may place multiple). He will describe how the quests work to players...but basically...

- He will show the bribe amounts for the level quest you want (1-6)
- Bribe him with a bit of gold to give you a quest
- He will give a quest based off the gold amount you give him
- The quest is a simple parchment that will describe the quest

...quests are in 2 different categories - Seek or Slay. Slay quests are ones that will involve killing a certain quantity of a certain monster. When you kill one of these monsters, simply double click the parchment and then select the corpse to claim credit. Seek quests describe an item that must be sought. It will also state where the object is rumored to be (Shame Level 2 ... for example). Go to that area and start killing monsters. Use the parchment on each corpse to search the bodies for the item. Keep doing this until you find the item.

Once a quest is complete...the parchment will change color and say COMPLETE in the name. Then you can give the parchment back to the QuestGiver and they will reward you with gold and maybe a magical item. I do not have the parchments blessed...as I run this on a PVP server, but you can un-remark the code if you want them blessed.

A note...the items that are asked to seek will not be real items. A message will appear above the player's head stating they found the item...but nothing appears in their bag - the quest is merely completed and they may turn the parchment in for a reward.

Although these are "fetch this", "kill that" type quests, they give a ton a randomization to give the quests a roleplaying feel.

- Djeryv
 

Attachments

  • QuestGiver.cs
    12 KB · Views: 854
  • QuestScroll.cs
    79.4 KB · Views: 812
  • questgenerator1.jpg
    questgenerator1.jpg
    50.1 KB · Views: 936
  • questgenerator2.jpg
    questgenerator2.jpg
    48.9 KB · Views: 764

Fresshness

Wanderer
very nice, however, I have a shard with no expansion set:

Code:
private static readonly Expansion Expansion = Expansion.None;

with this setting, you do not see the extra information (I will use the screenshot examples):

screenshot #1: "It was hidden in dungeon despise (level 3) (level 2 quest)"
screenshot #2: "zaza wants revenge for their daughter's death (level 3 quest)"


For killing monsters that's ok, but for quest items not really :D

any suggestions on how to fix this?
 

Orbit Storm

Sorceror
Looks exquisite, indeed!

Two curious questions:

1 - Is it possible to change the reward amount (in gold)? Most quests only reward a few hundred gold per; and I'd like mine to actually reward a tad bit more.

2 - Loot.RandomArmorOrShieldOrWeaponOrJewelry() - I'm assuming this pertains to the reward; will this pull anything from my artifacts list? I have tons of custom artifacts; but I'd only want certain ones being rewarded for quest completions.

Thanks. =)
 

Rasmenar

Sorceror
I just want you to know, this is amazing. Definitely going to use this on my server, possibly with some heavy modification (but that's just how I roll :))

Major, major ++Karma for this one.
 

Djeryv

Sorceror
To change the gold, edit these lines in the QuestGiver.cs file...


Code:
					    if ( Utility.RandomMinMax( 1, 4 ) == 1 )
					    {
[COLOR="Red"]						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 125, 200 ) ) );[/COLOR]
					    }
					    else
					    {

[COLOR="Red"]						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 75, 150 ) ) );[/COLOR]

There are two sections here. One just gives a bunch of gold and the second gives gold and an item. You may even want to get rid of the IF ELSE statements and have him always give gold or items.

If you want any special kind of loot, then you will have to edit this section of QuestGiver.cs...

Code:
				else if( dropped is QuestScroll )
         			{
					QuestScroll m_Quest = (QuestScroll)dropped;

         				if(m_Quest.NNeed > m_Quest.NGot)
         				{
						mobile.AddToBackpack ( dropped );
						this.PrivateOverheadMessage( MessageType.Regular, 1153, false, "You have not completed this quest.", mobile.NetState );
         					return false;
         				}

						string sMessage = "";
						if (m_Quest.NType == 1){ sMessage = "I see you were victorious. Here is your reward."; }
						else { sMessage = "Ahh...you have found " + m_Quest.NItemName + "! Here is your reward"; }

					    if ( Utility.RandomMinMax( 1, 4 ) == 1 )
					    {
						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 125, 200 ) ) );
					    }
					    else
					    {

						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 75, 150 ) ) );
	
						Item item;

						if ( Core.AOS )
							item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
						else
							item = Loot.RandomArmorOrShieldOrWeapon();				

						if ( item is BaseWeapon )
						{
							BaseWeapon weapon = (BaseWeapon)item;
	
							if ( Core.AOS )
							{
								int attributeCount;
								int min, max;

								GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );
	
								BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
							}
							else
							{
								weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
								weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
								weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
							}

							mobile.AddToBackpack ( item );
						}
						else if ( item is BaseArmor )
						{
							BaseArmor armor = (BaseArmor)item;

							if ( Core.AOS )
							{
								int attributeCount;
								int min, max;
	
								GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );

								BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
							}
							else
							{
								armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
								armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
							}

							mobile.AddToBackpack ( item );
						}
						else if( item is BaseHat )
						{
							BaseHat hat = (BaseHat)item;
	
							if( Core.AOS )
							{
								int attributeCount;
								int min, max;

								GetRandomAOSStats( out attributeCount, out min, out  max, m_Quest.NLevel );
	
								BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
							}

							mobile.AddToBackpack ( item );
						}
						else if( item is BaseJewel )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );

							BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

							mobile.AddToBackpack ( item );
						}
					    }
                    				this.PrivateOverheadMessage(MessageType.Regular, 1153, false, sMessage, mobile.NetState);

						dropped.Delete();
				
						return true;
				}

It is merely written to dish out standard UO gear, so you will have to change it to your liking.

- Djeryv
 

Higlander

Sorceror
Djeryv;840980 said:
To change the gold, edit these lines in the QuestGiver.cs file...


Code:
					    if ( Utility.RandomMinMax( 1, 4 ) == 1 )
					    {
[COLOR="Red"]						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 125, 200 ) ) );[/COLOR]
					    }
					    else
					    {

[COLOR="Red"]						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 75, 150 ) ) );[/COLOR]

There are two sections here. One just gives a bunch of gold and the second gives gold and an item. You may even want to get rid of the IF ELSE statements and have him always give gold or items.

If you want any special kind of loot, then you will have to edit this section of QuestGiver.cs...

Code:
				else if( dropped is QuestScroll )
         			{
					QuestScroll m_Quest = (QuestScroll)dropped;

         				if(m_Quest.NNeed > m_Quest.NGot)
         				{
						mobile.AddToBackpack ( dropped );
						this.PrivateOverheadMessage( MessageType.Regular, 1153, false, "You have not completed this quest.", mobile.NetState );
         					return false;
         				}

						string sMessage = "";
						if (m_Quest.NType == 1){ sMessage = "I see you were victorious. Here is your reward."; }
						else { sMessage = "Ahh...you have found " + m_Quest.NItemName + "! Here is your reward"; }

					    if ( Utility.RandomMinMax( 1, 4 ) == 1 )
					    {
						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 125, 200 ) ) );
					    }
					    else
					    {

						mobile.AddToBackpack ( new Gold( m_Quest.NLevel * Utility.RandomMinMax( 75, 150 ) ) );
	
						Item item;

						if ( Core.AOS )
							item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
						else
							item = Loot.RandomArmorOrShieldOrWeapon();				

						if ( item is BaseWeapon )
						{
							BaseWeapon weapon = (BaseWeapon)item;
	
							if ( Core.AOS )
							{
								int attributeCount;
								int min, max;

								GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );
	
								BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
							}
							else
							{
								weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
								weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
								weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
							}

							mobile.AddToBackpack ( item );
						}
						else if ( item is BaseArmor )
						{
							BaseArmor armor = (BaseArmor)item;

							if ( Core.AOS )
							{
								int attributeCount;
								int min, max;
	
								GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );

								BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
							}
							else
							{
								armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
								armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
							}

							mobile.AddToBackpack ( item );
						}
						else if( item is BaseHat )
						{
							BaseHat hat = (BaseHat)item;
	
							if( Core.AOS )
							{
								int attributeCount;
								int min, max;

								GetRandomAOSStats( out attributeCount, out min, out  max, m_Quest.NLevel );
	
								BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
							}

							mobile.AddToBackpack ( item );
						}
						else if( item is BaseJewel )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );

							BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

							mobile.AddToBackpack ( item );
						}
					    }
                    				this.PrivateOverheadMessage(MessageType.Regular, 1153, false, sMessage, mobile.NetState);

						dropped.Delete();
				
						return true;
				}

It is merely written to dish out standard UO gear, so you will have to change it to your liking.

- Djeryv

hi,
sorry for the question but i´m a script noob :/
how can i edit this to become sometimes powerscroll´s 5-20 and Statscrolls ?
thx for helping & answer :)

sorry for my english i´m not good in it :(
 

koluch

Sorceror
Running patch 7.0.10.3 SVN 665 the scrolls do not display properly ;/
(see attacked screenshot)

Thanks, would love to get this back running!

Koluch ;]
 

Attachments

  • QuestScroll70103patch.jpg
    QuestScroll70103patch.jpg
    23.8 KB · Views: 305

kmekc

Wanderer
As i don't like the idea of a new System with Questscroll, i rebuild the scripts so it now uses the quest system. Also i redesigned the whole thing about places and monster type definitions. At the moment only the Kill-Missions are working. But i already have some stumbs for the Find-Mission. Maybe i can update in a few days, so also the find missions working properly.

Please keep in mind that my script is build for a runuo1.0 server. So maybe you still have to rebuild somethings to get this working. And if you are not german, please take care for the few german sentences i used. ;)

Add this to your basequester.cs. As i'm fan of talking NPCs and don't like Gumps very much.
Code:
        private TalkTimer m_Talk;

        public void TalkText(string[] text)
        {
            if ((m_Talk == null) || (m_Talk != null && m_Talk.Running == false))
            {
                m_Talk = new TalkTimer(this, text, 10);
                m_Talk.Start();
            }
        }

        public void StopTalk()
        {
            if (m_Talk != null)
                m_Talk.Stop();
            m_Talk = null;
        }

        private class TalkTimer: Timer
        {
            private string[] m_Text;
            private BaseQuester m_Quester;
            private int m_Count;

            public TalkTimer(BaseQuester talker, string[] text, int delay) : base( TimeSpan.FromSeconds( 0 ), TimeSpan.FromSeconds(delay) )
            {
                m_Quester = talker;
                m_Text = text;
                m_Count = 0;
            }

            protected override void OnTick()
            {
                if (m_Count < m_Text.Length)
                {
                    m_Quester.Say(m_Text[m_Count]);
                    m_Count++;
                }
                else
                {
                    m_Quester.StopTalk();
                }
            }
        }
 

Attachments

  • RandomQuest.zip
    22.7 KB · Views: 67

Higlander

Sorceror
Hello,

How i can change the drop chance for items in this system ? I will lower the drop for items :)
Sorry for the question but i´m not so good in sripting ^^

Thx Manny For Helping :)

PS: Very Nice system !!
 

kmekc

Wanderer
If you are using the original script you will find the rewards in the QuestGiver skript in function OnDragDrop. It's the part

Code:
if ( Core.AOS )
 item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
else
 item = Loot.RandomArmorOrShieldOrWeapon();

In my script there is at the moment only gold as a reward.
 

zamoyski

Sorceror
if you want to add single items to quest reward, i did it that way:

Code:
else if( item is BaseJewel )
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats( out attributeCount, out min, out max, m_Quest.NLevel );

                            BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

                            mobile.AddToBackpack ( item );
                        }
[COLOR=rgb(255, 0, 0)]                        //custom[/COLOR]
[COLOR=rgb(255, 0, 0)]            if ( Utility.RandomDouble() < 0.1 )[/COLOR]
[COLOR=rgb(255, 0, 0)]                mobile.AddToBackpack( new CarpentersCraftsmanSatchel() );[/COLOR]
[COLOR=rgb(255, 0, 0)]//custom ends[/COLOR]

i think that it's pretty clear - in utility.RandomDouble just put chance to item drop (above it's 10%) and type any item you want (above it's CarpentersCraftsmanSatchel) . Just copy and paste these two lines under to add more items. Couldnt't make it easier :)

Didn't test it, but it should work.
 

aberent

Page
Great script,

However I am trying to undestand the relationship between m_Places and m_Monster. When I look at the QuestScroll script I see that both are essencialy randomly selected. If this is true than would we not often get a monster that is not found in a particular place?

Code:
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, 25 );
}
 
Top