ServUO Version
Publish 58
Ultima Expansion
Endless Journey
Hello there!

I've read a few older posts about this problem but between reading them and just trying for myself I am stumped. I have been trying to add a secondary reward to the trainer quests in New Haven for the Gargoyle race. I've added the following code and it compiles but the quest giver no longer gives the quest. You can still train and buy from them but the quest is broken. Any help would be greatly appreciated.
Race condition reward:
            PlayerMobile m = Owner as PlayerMobile;
            if (m.Race==Race.Gargoyle)
            AddReward(new BaseReward(typeof(GargishBulwarkLeggings), "Gargish Bulwark Leggings"));
            else
            AddReward(new BaseReward(typeof(BulwarkLeggings), 1077727));

 
I could be wrong, but I don't think you can separate AddObjective and AddReward. Make it something like:

Sample Code:
            PlayerMobile pm = Owner as PlayerMobile;
           
            if (pm != null)
            {
                if (pm.Race == Race.Gargoyle)
                {
                     AddObjective(new QuestObjective("Name of Objective"));
                     AddReward(new BaseReward(typeof(GargishBulwarkLeggings), "Gargish Bulwark Leggings"));
                }
                else
                {
                     AddObjective(new QuestObjective("Name of Objective"));
                     AddReward(new BaseReward(typeof(BulwarkLeggings), 1077727));
                }
            }

I believe that should work, though you might need some other null checks and such.
 
I thought it was something like that. So I followed your advice and changed the code to:
C#:
           PlayerMobile m = Owner as PlayerMobile;
            if (pm != null)
            {
              if (m.Race==Race.Gargoyle)
                {
                  AddReward(new BaseReward(typeof(GargishBulwarkLeggings), "Gargish Bulwark Leggings"));
                  AddObjective(new ApprenticeObjective(SkillName.Chivalry, 50, "Old Haven Training", 1077720, 1077721));
                }
                else
                {
                  AddReward(new BaseReward(typeof(BulwarkLeggings), 1077727));
                  AddObjective(new ApprenticeObjective(SkillName.Chivalry, 50, "Old Haven Training", 1077720, 1077721));
                }
It still doesn't work but it does compile without any errors. I am uncertain what other null checks I would need. I've been out of the coding world for too long. Thank you so much for your help.
Scratch that I just noticed I forgot to change the m to pm. It does work as is. Thanks again!
C#:
           PlayerMobile pm = Owner as PlayerMobile;
            if (pm != null)
            {
              if (pm.Race==Race.Gargoyle)
                {
                  AddReward(new BaseReward(typeof(GargishBulwarkLeggings), "Gargish Bulwark Leggings"));
                  AddObjective(new ApprenticeObjective(SkillName.Chivalry, 50, "Old Haven Training", 1077720, 1077721));
                }
                else
                {
                  AddReward(new BaseReward(typeof(BulwarkLeggings), 1077727));
                  AddObjective(new ApprenticeObjective(SkillName.Chivalry, 50, "Old Haven Training", 1077720, 1077721));
                }
 
Last edited:
I honestly have not touched the quest system in years now, however you may want to place the AddObjective above the AddReward. Not sure if it makes a difference or not, but it might use the previous listed objective instead of the one after the AddReward. It may not be necessary, but I believe the other quests follow that pattern and at least it will conform to the others if nothing else.

Glad to hear it works though. Happy to help.
 
I'll give that a try a bit later. The quest is currently showing as failed and that might explain why.
So I tried switching it and it compiles and I can interact with the NPC and the quest comes up but it comes up as failed already. The quest doesn't show the objective or the reward. Also the accelerated skill gain doesn't seem to activate when in the correct area.
 
Last edited:
Back