Jump to content

Spawn Errors

Pending 2.8.3

Somescrub
Somescrub

Posted

Getting this semi-frequently in console:

Failed to call hook 'SpawnNpc' on plugin 'NpcSpawn v2.8.4' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.NpcSpawn+CustomScientistNpc.UpdateInventory () [0x00116] in :0 at Oxide.Plugins.NpcSpawn+CustomScientistNpc.ServerInit () [0x00164] in :0 at BaseNetworkable.Spawn () [0x0004f] in :0 at BaseEntity.Spawn () [0x00000] in :0 at Oxide.Plugins.NpcSpawn.CreateCustomNpc (UnityEngine.Vector3 position, Oxide.Plugins.NpcSpawn+NpcConfig config) [0x0007b] in :0 at Oxide.Plugins.NpcSpawn.SpawnNpc (UnityEngine.Vector3 position, Newtonsoft.Json.Linq.JObject configJson) [0x00008] in :0 at Oxide.Plugins.NpcSpawn.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x000b0] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in :0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0

aimacak

Posted (edited)

On 11/17/2025 at 3:25 PM, Somescrub said:

Getting this semi-frequently in console:

Failed to call hook 'SpawnNpc' on plugin 'NpcSpawn v2.8.4' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.NpcSpawn+CustomScientistNpc.UpdateInventory () [0x00116] in :0 at Oxide.Plugins.NpcSpawn+CustomScientistNpc.ServerInit () [0x00164] in :0 at BaseNetworkable.Spawn () [0x0004f] in :0 at BaseEntity.Spawn () [0x00000] in :0 at Oxide.Plugins.NpcSpawn.CreateCustomNpc (UnityEngine.Vector3 position, Oxide.Plugins.NpcSpawn+NpcConfig config) [0x0007b] in :0 at Oxide.Plugins.NpcSpawn.SpawnNpc (UnityEngine.Vector3 position, Newtonsoft.Json.Linq.JObject configJson) [0x00008] in :0 at Oxide.Plugins.NpcSpawn.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x000b0] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in :0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0

Hello, most likely you made a mistake in the configuration of the NPC in any plugin that uses NpcSpawn, try to remember what you last edited before this error appeared, I can also recommend finding the `jsonlint` resource in the search engine, you can check the configuration for syntax, and if it is incorrect, it will indicate your mistake..

Edited by aimacak
Somescrub

Posted

On 12/10/2025 at 3:44 PM, aimacak said:

Hello, most likely you made a mistake in the configuration of the NPC in any plugin that uses NpcSpawn, try to remember what you last edited before this error appeared, I can also recommend finding the `jsonlint` resource in the search engine, you can check the configuration for syntax, and if it is incorrect, it will indicate your mistake..

This is occurring across plugins that leverage NPC Spawn and those that do not - which tells me it is a coding issue holistically. For instance, the same behavior is being identified with Botrespawn and ZombieHorde NPCs, but those do not leverage the NPC Spawn plugin. This seems to be a more holistic issue with custom NPC spawning in general, but does warrant some additional investigation on the part of the spawn plugin devs. 

These issues surfaced after the November update - @Steenamaroo attempted some fixes for BotReSpawn, but I am still seeing the issue occur even with the fix version in place (haven't had a chance to open a support ticket on that one).

  • Administrator
Steenamaroo

Posted

Hi,

The error you pasted is in custom behaviour code for NPCSpawn npcs.
You won't see that error in relation to BotReSpawn or ZombieHorde npcs, as they won't have that custom component.

If you're seeing a different error with BotReSpawn npcs please do let me know, but all issues arising from November wipe userID changes have been fixed, to the best of my knowledge.

  • Administrator
Steenamaroo

Posted

and I agree - looking at the error and the code, you most likely have a config file issue.
Undoing your last changes and/or checking with jsonlint.com is good advice. 👍

  • Like 1
aimacak

Posted

14 minutes ago, Somescrub said:

This is occurring across plugins that leverage NPC Spawn and those that do not - which tells me it is a coding issue holistically. For instance, the same behavior is being identified with Botrespawn and ZombieHorde NPCs, but those do not leverage the NPC Spawn plugin. This seems to be a more holistic issue with custom NPC spawning in general, but does warrant some additional investigation on the part of the spawn plugin devs. 

These issues surfaced after the November update - @Steenamaroo attempted some fixes for BotReSpawn, but I am still seeing the issue occur even with the fix version in place (haven't had a chance to open a support ticket on that one).

I also have my own server and have been using NpcSpawn, BetterNpc and some events that use NpcSpawn for a long time, I have not seen such an error, so I assumed an error in recent changes.
You can provide your configuration/data files, and I can help you with the search if you want.

Somescrub

Posted (edited)

24 minutes ago, Steenamaroo said:

Hi,

The error you pasted is in custom behaviour code for NPCSpawn npcs.
You won't see that error in relation to BotReSpawn or ZombieHorde npcs, as they won't have that custom component.

If you're seeing a different error with BotReSpawn npcs please do let me know, but all issues arising from November wipe userID changes have been fixed, to the best of my knowledge.

I realize the error is specific to NPCSpawn, hence why opening the ticket here. To your point though, I am seeing the same behavior with BotReSpawn NPCs and also got a report today for ZombieHorde NPCs being invisible. Identical behavior happening across multiple plugins that spawn NPCs, but leveraging different spawn methods. 

The JSON checks out, at least for the BossMonster files. I haven't made any recent changes to BotReSpawn or ZombieHorde since November that would explain those. 

These invisible NPCs also happen randomly. It is not an entire profile or anything that it triggers exclusively to, or an entire profile population. Just a random one here or there across the map. 

I attached a boss config for reference (the one in the provided screenshots over on my BossMonster ticket: https://codefling.com/files/support/25268-invisible-bosses/).

Cobalt Captain Kael Durn(1).json

Edited by Somescrub
Added config file for reference
  • Administrator
Steenamaroo

Posted

Sounds like you've got more than one issue going on,
but for the immediate issue, it would be NPCSpawn's config file you'd need to verify.

aimacak

Posted

8 minutes ago, Somescrub said:

I realize the error is specific to NPCSpawn, hence why opening the ticket here. To your point though, I am seeing the same behavior with BotReSpawn NPCs and also got a report today for ZombieHorde NPCs being invisible. Identical behavior happening across multiple plugins that spawn NPCs, but leveraging different spawn methods. 

The JSON checks out, at least for the BossMonster files. I haven't made any recent changes to BotReSpawn or ZombieHorde since November that would explain those. 

These invisible NPCs also happen randomly. It is not an entire profile or anything that it triggers exclusively to, or an entire profile population. Just a random one here or there across the map. 

I attached a boss config for reference (the one in the provided screenshots over on my BossMonster ticket: https://codefling.com/files/support/25268-invisible-bosses/).

Cobalt Captain Kael Durn(1).json 12.68 kB · 0 downloads

It's a bit of a strange question, but is the weapon visible to all invisible NPCs? Have you checked if they are invisible to all players, or only to some? For example, if both screenshots with an invisible boss and screenshots with invisible NPCs were sent to you by the same player, it is possible that this player has problems with the client and he should try reinstalling the game, I heard about a situation where one player did not see Lightsight, and I was even shown a screenshot 🙂 If they're invisible to everyone, and you're pretty sure of it, I guess it gets harder.. As the developer told me, making everything invisible is not so difficult, but making only the NPC texture invisible, but leaving the weapon visible is difficult)

Somescrub

Posted

2 minutes ago, Steenamaroo said:

Sounds like you've got more than one issue going on,
but for the immediate issue, it would be NPCSpawn's config file you'd need to verify.

That checked out as well - I don't think I ever edited it from default to be honest. Attached it for reference.

NpcSpawn.json

Somescrub

Posted

5 minutes ago, aimacak said:

It's a bit of a strange question, but is the weapon visible to all invisible NPCs? Have you checked if they are invisible to all players, or only to some? For example, if both screenshots with an invisible boss and screenshots with invisible NPCs were sent to you by the same player, it is possible that this player has problems with the client and he should try reinstalling the game, I heard about a situation where one player did not see Lightsight, and I was even shown a screenshot 🙂 If they're invisible to everyone, and you're pretty sure of it, I guess it gets harder.. As the developer told me, making everything invisible is not so difficult, but making only the NPC texture invisible, but leaving the weapon visible is difficult)

It is happening to multiple players - I have experienced it myself several times, and the screenshots I provided over at my other support ticket were taken by me. All reports, with the exception of today's for zombiehorde, have been for invisible Botrespawn npcs and Bossmonster npcs.

aimacak

Posted (edited)

21 minutes ago, Somescrub said:

It is happening to multiple players - I have experienced it myself several times, and the screenshots I provided over at my other support ticket were taken by me. All reports, with the exception of today's for zombiehorde, have been for invisible Botrespawn npcs and Bossmonster npcs.

I'll try to play with your preset on my server.. And when you took screenshots of the invisible boss in another ticket, was he initially invisible? If not, maybe you can remember some small nuances before he became invisible?


ADDED:
If I were you, I would also try to leave only 1 plugin on the NPC, NpcSpawn / BotRespawn / ZombieHorde for a while and see if this situation repeats, in this case I would also consider increasing the number of NPCs to compensate for disabling the other two plugins and try to keep the load on the server, which probably can also somehow influence it.

Edited by aimacak
ADDED
  • Administrator
Steenamaroo

Posted

These issues come from having multiple npcs share the same userID.


It's only an issue in cases where plugins issue a specific userID, rather than letting vanilla code handle it.
BotReSpawn is one such plugin, but I took measures to check if a userID is in use before using it, so it shouldn't be causing problems.

It does rely on existing npcs having been added to the vanilla bots list, though, which, I suppose, isn't a guarantee.


NPCSpawn doesn't appear to issue custom userIDs, so it shouldn't be a problem either,
but all it takes is one npc plugin spawning npcs with custom userIDs, without checking.

 

I guess my advice would be to roundup all the plugins which spawn npcs and figure out which are assigning userIDs by searching .cs for
 ".userID = ", making sure to include the space.

Out of those plugins, I'd temporarily unload any which haven't had recent updates

 

Somescrub

Posted

16 minutes ago, aimacak said:

I'll try to play with your preset on my server.. And when you took screenshots of the invisible boss in another ticket, was he initially invisible? If not, maybe you can remember some small nuances before he became invisible?


ADDED:
If I were you, I would also try to leave only 1 plugin on the NPC, NpcSpawn / BotRespawn / ZombieHorde for a while and see if this situation repeats, in this case I would also consider increasing the number of NPCs to compensate for disabling the other two plugins and try to keep the load on the server, which probably can also somehow influence it.

I don't know if they spawn invisible, or turn that way... only time I have ever caught them they are already invisible, and players report the same. 

I suppose load could be a factor, but I'm not really in a position to completely disable any of them - they are all doing it, so something more broadly must be causing the issue... whether it is load, code, or gremlins. Only thing that is consistent is that this all started after the November update... 

aimacak

Posted (edited)

12 minutes ago, Somescrub said:

I don't know if they spawn invisible, or turn that way... only time I have ever caught them they are already invisible, and players report the same. 

I suppose load could be a factor, but I'm not really in a position to completely disable any of them - they are all doing it, so something more broadly must be causing the issue... whether it is load, code, or gremlins. Only thing that is consistent is that this all started after the November update... 

The fact is that the invisibility of NPCs in all plugins is a consequence, but if you turn off one of the plugins and the problem disappears, we will find the cause.


ADDED:
And yes, I believe that they become invisible when they spawn, i.e. if the NPC is already invisible, then disabling the problematic plugin will not make the NPC visible.

Edited by aimacak
ADDED
Somescrub

Posted

3 minutes ago, Steenamaroo said:

These issues come from having multiple npcs share the same userID.


It's only an issue in cases where plugins issue a specific userID, rather than letting vanilla code handle it.
BotReSpawn is one such plugin, but I took measures to check if a userID is in use before using it, so it shouldn't be causing problems.

It does rely on existing npcs having been added to the vanilla bots list, though, which, I suppose, isn't a guarantee.


NPCSpawn doesn't appear to issue custom userIDs, so it shouldn't be a problem either,
but all it takes is one npc plugin spawning npcs with custom userIDs, without checking.

 

I guess my advice would be to roundup all the plugins which spawn npcs and figure out which are assigning userIDs by searching .cs for
 ".userID = ", making sure to include the space.

Out of those plugins, I'd temporarily unload any which haven't had recent updates

 

 

If I am understanding that correctly you are saying that any plugin spawning NPCs that utilizes userID could make any other plugin spawning NPCs, regardless of userID use, become invisible? That's a pretty shitty situation to pass off to both devs and admins from the framework side - has this not been a consideration to solve for broadly? I mean even an oxide debug warning that calls out userID collisions sounds like an appropriate thing for something so impactful. 

I did a quick search on my December backup plugins folder:

Based on what you described, it looks like maybe XDQuest or TalkingNpcs could be the offenders? I see XDQuest it is making a hardcoded ID for the questgiver NPC. To compound that issue a bit, I do reload the plugin every hour to ensure the building gets pasted correctly, so I could see how that might cause conflicts randomly. I have quite a few TalkingNpc NPCs as well, and those are basically hardcoded IDs in practice - so I could see how that might also affect it. However, both of those plugins have been running un-altered for quite some time... is this userID logic something FP introduced specifically in November?

image.png

  • Like 1
aimacak

Posted

1 minute ago, Somescrub said:

 

If I am understanding that correctly you are saying that any plugin spawning NPCs that utilizes userID could make any other plugin spawning NPCs, regardless of userID use, become invisible? That's a pretty shitty situation to pass off to both devs and admins from the framework side - has this not been a consideration to solve for broadly? I mean even an oxide debug warning that calls out userID collisions sounds like an appropriate thing for something so impactful. 

I did a quick search on my December backup plugins folder:

Based on what you described, it looks like maybe XDQuest or TalkingNpcs could be the offenders? I see XDQuest it is making a hardcoded ID for the questgiver NPC. To compound that issue a bit, I do reload the plugin every hour to ensure the building gets pasted correctly, so I could see how that might cause conflicts randomly. I have quite a few TalkingNpc NPCs as well, and those are basically hardcoded IDs in practice - so I could see how that might also affect it. However, both of those plugins have been running un-altered for quite some time... is this userID logic something FP introduced specifically in November?

image.png

Yes, it was in November that she appeared..

  • Administrator
Steenamaroo

Posted

Every npc has a userID, just like real players.
In vanilla code Facepunch issue them sequentially, and retire them to a pool for reuse, so there's never two npcs with the same ID,
but plugins can spawn npcs with any ID they like so, yeah...any plugin that is manually setting userIDs for its npcs, and isn't checking if that id is in use first, could cause all sorts of problems.

I haven't had a report like this since updating in November, and I believe Nivex took measures to plug it at his end.
 

I think I'd temporarily unload the others then see how you go.

Somescrub

Posted

20 minutes ago, Steenamaroo said:

Every npc has a userID, just like real players.
In vanilla code Facepunch issue them sequentially, and retire them to a pool for reuse, so there's never two npcs with the same ID,
but plugins can spawn npcs with any ID they like so, yeah...any plugin that is manually setting userIDs for its npcs, and isn't checking if that id is in use first, could cause all sorts of problems.

I haven't had a report like this since updating in November, and I believe Nivex took measures to plug it at his end.
 

I think I'd temporarily unload the others then see how you go.

Those two I mentioned are core to my server design, so I will probably just investigate fixing them myself for the time being until they get an update. However, I do appreciate you explaining what is happening here - I did not realize that was what was going on, but it does make sense. 

  • Administrator
Steenamaroo

Posted

It's your choice, of course, but when dealing with major issues and a range of plugins it's always best to isolate and prove.
I'm sure your players would sacrifice a plugin or two for a day if the reward was solving the npc issues.

 

Certainly check to make sure all the relevant plugins, and Vanish (if you use it) are up to date.
I didn't confirm anything but a few people reported issues with Vanish prior to 2.0.5 which may or may not have compounded things.

2.1m

Downloads

Total number of downloads.

9.8k

Customers

Total customers served.

143k

Files Sold

Total number of files sold.

3m

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.