Jump to content

BetterNpc - NullReference Issue in DieNpc() Causing Default Loot Drops

Pending 1.3.1

Cr7ytpo
Cr7ytpo

Posted

Hey, I've noticed an occasional issue with BetterNpc where NPCs drop default loot instead of custom loot (own loot). It happens when this error shows up:

Failed to execute OnFrame callback (Object reference not set to an instance of an object)
at void Oxide.Plugins.BetterNpc+ControllerSpawnPoint.DieNpc(ScientistNPC npc, NPCPlayerCorpse corpse)+() => { } [1] in /carbon/plugins/BetterNpc.cs:line 452

It seems like corpse can sometimes be null in DieNpc(), causing the plugin to fail before applying custom loot.

Suggestion:
Just adding a simple if (corpse == null) return; check at the start of DieNpc() would prevent this issue i think.

Thanks for the great work, just wanted to report it properly.

Jbird

Posted

8 hours ago, Cr7ytpo said:

Hey, I've noticed an occasional issue with BetterNpc where NPCs drop default loot instead of custom loot (own loot). It happens when this error shows up:

Failed to execute OnFrame callback (Object reference not set to an instance of an object)
at void Oxide.Plugins.BetterNpc+ControllerSpawnPoint.DieNpc(ScientistNPC npc, NPCPlayerCorpse corpse)+() => { } [1] in /carbon/plugins/BetterNpc.cs:line 452

It seems like corpse can sometimes be null in DieNpc(), causing the plugin to fail before applying custom loot.

Suggestion:
Just adding a simple if (corpse == null) return; check at the start of DieNpc() would prevent this issue i think.

Thanks for the great work, just wanted to report it properly.

Running this past KpucTaJl. Just to ask, have you narrowed this down to any specific NPC sets? NRE can also often be a configuration error for example, so just checking while I share the information with him.

Cr7ytpo

Posted

On 3/30/2025 at 11:31 PM, Jbird said:

Running this past KpucTaJl. Just to ask, have you narrowed this down to any specific NPC sets? NRE can also often be a configuration error for example, so just checking while I share the information with him.

Hey, I just had time to test it. This happens when I spawn a Personal NPC guard. When the guard kills a BetterNPC, I get that console error, and the NPC drops the default scientist loot. (Not every kill)

1.7m

Downloads

Total number of downloads.

7.9k

Customers

Total customers served.

119.1k

Files Sold

Total number of files sold.

2.4m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.