Jump to content

Applying custom item mod to a weapon results with "NullReferenceException"

Recommended Posts

Hey so I am working on a custom item modifier, Poison Ointment, pretty much everything is up (recipe craft, item icon, debuff). The issue I am running into is, when I apply the item modifier to a weapon, it results in a "NullReferenceException. Object reference not set to an instance of an object".


Searching google, it seems people say "NullReferenceException" is Unity's general way of saying something went wrong. So I'm not sure what I'm missing that would cause this issue.


Here is a video to see what is going on:



Link to comment
Share on other sites

11 minutes ago, bdubyah said:

Post up your output log. Can google where to find it if you are unfamiliar. It can give a bit more info sometimes as to what the issue is. Also maybe post your xml for the item mod.


Looks like this section is related to the issue:


NullReferenceException: Object reference not set to an instance of an object
  at XUiM_ItemStack.GetCustomDisplayValueForItem (ItemValue itemValue, DisplayInfoEntry entry) [0x00155] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiM_ItemStack.GetCustomValue (DisplayInfoEntry entry, ItemStack itemStack, System.Boolean useMods) [0x00336] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiM_ItemStack.GetStatItemValueTextWithModInfo (ItemStack itemStack, EntityPlayer player, DisplayInfoEntry infoEntry) [0x000ae] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_AssembleWindow.GetStatValue (System.Int32 index) [0x00049] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_AssembleWindow.GetBindingValue (System.String& value, BindingItem binding) [0x004fa] in <4b1a8c809f0943a384283687c21422f8>:0 
  at BindingItem.GetValue (System.Boolean forceAll) [0x00023] in <4b1a8c809f0943a384283687c21422f8>:0 
  at BindingInfo.RefreshValue (System.Boolean forceAll) [0x0001a] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.RefreshBindings (System.Boolean forceAll) [0x00010] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_AssembleWindow.set_ItemStack (ItemStack value) [0x0004e] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_ItemPartStackGrid.HandleSlotChangedEvent (System.Int32 slotNumber, ItemStack stack) [0x000ae] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_BasePartStack.set_ItemStack (ItemStack value) [0x00054] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_BasePartStack.SwapItem () [0x000b3] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_ItemPartStack.SwapItem () [0x00020] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_BasePartStack.HandleStackSwap () [0x00022] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_BasePartStack.Update (System.Single _dt) [0x0027a] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_ItemPartStackGrid.Update (System.Single _dt) [0x0001a] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiC_AssembleWindow.Update (System.Single _dt) [0x00030] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiController.Update (System.Single _dt) [0x0004f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUi.OnUpdateDeltaTime (System.Single updateDeltaTime) [0x0014d] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiUpdater.Update () [0x0003f] in <4b1a8c809f0943a384283687c21422f8>:0 
  at XUiUpdateHelper.LateUpdate () [0x00000] in <4b1a8c809f0943a384283687c21422f8>:0 
(Filename: <4b1a8c809f0943a384283687c21422f8> Line: 0)



And here is the XML for the item mod:

  <append xpath="/item_modifiers">
    <item_modifier name="modOintmentPoisonRegular" installable_tags="weapon" modifier_tags="poison" blocked_tags="noMods" type="attachment">
      <property name="CustomIcon" value="ointmentPoisonRegular"/>
      <property name="Stacknumber" value="1"/> <property name="Group" value="Mods"/>
      <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>

      <triggered_effect trigger="onSelfDamagedOther" action="AddBuff" target="other" buff="buffPoisonDoT"/>
      <triggered_effect trigger="onSelfDamagedOther" action="ModifyCVar" target="other" cvar="poisonCounter" operation="add" value="5"/>


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...