I've created a new quest on my server as an attempt to learn how to make new quests.
The problem is that once I add it to the list of trader quests, the server throws a null reference exception each time it tries to get the list. It's not game-breaking but it is annoying and so I'd like to solve it. I'm certain it has something to do with the quest I added. Here's the xml:
<append xpath="/quests">
<quest id="quest_FindMythril">
<property name="name_key" value="quest_FindMythril"/>
<property name="subtitle_key" value="quest_FindMythril_subtitle"/>
<property name="description_key" value="quest_FindMythril_description"/>
<property name="icon" value="ui_game_symbol_mining"/>
<property name="repeatable" value="true"/>
<property name="category_key" value="quest"/>
<property name="offer_key" value="quest_FindMythril_offer"/>
<property name="difficulty" value="medium"/>
<property name="difficulty_tier" value="3"/>
<property name="statement_key" value="quest_FindMythril_statement"/>
<property name="response_key" value="quest_FindMythril_response"/>
<property name="login_rally_reset" value="true"/>
<property name="completiontype" value="TurnIn"/>
<property name="completion_key" value="quest_FindMythril_completion"/>
<objective type="FetchKeep" id="resourceMythrilPowder" value="100" phase="1"/>
<objective type="ReturnToNPC">
<property name="phase" value="2"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<objective type="InteractWithNPC">
<property name="phase" value="2"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<reward type="Exp" value="5000"/>
<!--<reward type="LootItem" id="groupQuestMods" ischosen="true" value="1"/>-->
<reward type="Item" id="casinoCoin" value="800"/>
</quest>
</append>
<append xpath="/quests/quest_list[@id='trader_quests']">
<quest id="quest_FindMythril" />
</append>
And here's the error I get from the server:
NullReferenceException: Object reference not set to an instance of an object
at EntityTrader.PopulateQuestList () [0x00074] in <f6e64c46c798481d83242e5018924c0b>:0
at EntityTrader.OnUpdateLive () [0x00013] in <f6e64c46c798481d83242e5018924c0b>:0
at EntityAlive.OnUpdateEntity () [0x0001e] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntity (Entity e, System.Single _partialTicks) [0x00127] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntitiesSlice (System.Int32 count) [0x00037] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntitiesSlice () [0x00000] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.UpdateTick () [0x00026] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.gmUpdate () [0x00305] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.Update () [0x00000] in <f6e64c46c798481d83242e5018924c0b>:0
For now I'll remove the quest from the list again, but I'm baffled as to what I'm missing. I've added the appropriate entries in Localization.txt and even if I hadn't that wouldn't cause a null ref exception. Any insight from someone who is an expert in the field of adding trader quests?
Edit:
Ok so thanks to help from the community here the solution is to insert new quests before the quest_list section so that they are the last quests in the list (first in the list also works, but I chose last in the list). This is because if they are added after the quest list section, the quest list is loaded first and references a quest which hasn't been loaded yet, producing a null ref.
Here's my current xml:

<append xpath="/quests">
<quest id="quest_FindMythril">
<property name="name_key" value="quest_FindMythril"/>
<property name="subtitle_key" value="quest_FindMythril_subtitle"/>
<property name="description_key" value="quest_FindMythril_description"/>
<property name="icon" value="ui_game_symbol_mining"/>
<property name="repeatable" value="true"/>
<property name="category_key" value="quest"/>
<property name="offer_key" value="quest_FindMythril_offer"/>
<property name="difficulty" value="medium"/>
<property name="difficulty_tier" value="3"/>
<property name="statement_key" value="quest_FindMythril_statement"/>
<property name="response_key" value="quest_FindMythril_response"/>
<property name="login_rally_reset" value="true"/>
<property name="completiontype" value="TurnIn"/>
<property name="completion_key" value="quest_FindMythril_completion"/>
<objective type="FetchKeep" id="resourceMythrilPowder" value="100" phase="1"/>
<objective type="ReturnToNPC">
<property name="phase" value="2"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<objective type="InteractWithNPC">
<property name="phase" value="2"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<reward type="Exp" value="5000"/>
<!--<reward type="LootItem" id="groupQuestMods" ischosen="true" value="1"/>-->
<reward type="Item" id="casinoCoin" value="800"/>
</quest>
</append>
<append xpath="/quests/quest_list[@id='trader_quests']">
<quest id="quest_FindMythril" />
</append>
And here's the error I get from the server:
NullReferenceException: Object reference not set to an instance of an object
at EntityTrader.PopulateQuestList () [0x00074] in <f6e64c46c798481d83242e5018924c0b>:0
at EntityTrader.OnUpdateLive () [0x00013] in <f6e64c46c798481d83242e5018924c0b>:0
at EntityAlive.OnUpdateEntity () [0x0001e] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntity (Entity e, System.Single _partialTicks) [0x00127] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntitiesSlice (System.Int32 count) [0x00037] in <f6e64c46c798481d83242e5018924c0b>:0
at World.TickEntitiesSlice () [0x00000] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.UpdateTick () [0x00026] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.gmUpdate () [0x00305] in <f6e64c46c798481d83242e5018924c0b>:0
at GameManager.Update () [0x00000] in <f6e64c46c798481d83242e5018924c0b>:0
For now I'll remove the quest from the list again, but I'm baffled as to what I'm missing. I've added the appropriate entries in Localization.txt and even if I hadn't that wouldn't cause a null ref exception. Any insight from someone who is an expert in the field of adding trader quests?
Edit:
Ok so thanks to help from the community here the solution is to insert new quests before the quest_list section so that they are the last quests in the list (first in the list also works, but I chose last in the list). This is because if they are added after the quest list section, the quest list is loaded first and references a quest which hasn't been loaded yet, producing a null ref.
Here's my current xml:
Code:
<insertBefore xpath="/quests/quest_list[1]">
<quest id="tier5_find_mythril">
<property name="name_key" value="quest_FindMythril"/>
<property name="subtitle_key" value="quest_FindMythril_subtitle"/>
<property name="description_key" value="quest_FindMythril_description"/>
<property name="icon" value="ui_game_symbol_mining"/>
<property name="repeatable" value="true"/>
<property name="category_key" value="quest"/>
<property name="offer_key" value="quest_FindMythril_offer"/>
<property name="difficulty" value="Medium"/>
<property name="difficulty_tier" value="5"/>
<property name="statement_key" value="quest_FindMythril_statement"/>
<property name="response_key" value="quest_FindMythril_response"/>
<property name="login_rally_reset" value="true"/>
<property name="completiontype" value="TurnIn"/>
<property name="completion_key" value="quest_FindMythril_completion"/>
<objective type="RandomGotoNPC" phase="1">
<property name="completion_distance" value="20"/>
<property name="distance" value="100-200"/>
<property name="nav_object" value="quest" />
</objective>
<objective type="FetchKeep" id="resourceMythrilPowder" value="1000" phase="2"/>
<objective type="Craft" id="resourceMythril" value="50" phase="3"/>
<objective type="ReturnToNPC">
<property name="phase" value="4"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<objective type="InteractWithNPC">
<property name="phase" value="4"/>
<property name="nav_object" value="return_to_trader" />
</objective>
<reward type="Exp" value="5000"/>
<reward type="LootItem" id="schematicsToolsT2" ischosen="true" isfixed="true" value="5"/>
<reward type="LootItem" id="schematicsWeaponsArmorT2" ischosen="true" isfixed="true" value="5"/>
<reward type="LootItem" id="schematicsToolsT2" ischosen="true" value="5"/>
<reward type="LootItem" id="schematicsToolsT2" ischosen="true" value="5"/>
<reward type="LootItem" id="schematicsWeaponsArmorT2" ischosen="true" value="5"/>
<reward type="LootItem" id="schematicsWeaponsArmorT2" ischosen="true" value="5"/>
<reward type="Item" id="casinoCoin" value="800"/>
</quest>
</insertBefore>
<append xpath="/quests/quest_list[@id='trader_quests']">
<quest id="tier5_find_mythril" />
</append>
Last edited by a moderator: