• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

NPCMod and Addons

hi there @xyth. wanted to let you know i'm making an addon mod that inserts the 0-XNPCCore entities to my custom enZombies biome groups (in entitygroups.xml) so that the nurse, baker and Harley npc's spawn outside in the wilderness for those using the enZombies mod. i see that within entitygroups.xml for 0-XNPCCore only a subset of nurse, baker and Harley variations are defined to spawn within the biome groups (ZombiesAll, ZombiesNight, SnowZombies, etc) and i'll follow that convention too. NPCMod is a great mod platform and thanks for continuing development on it. i just need to find a spot on my page for this 'powered by Score and NPCcore' banner....

 
Hey ErrorNull, if you haven't seen the expansion of the progression of spawning groups for the different packs done by khzmuzik I'd recommend looking at that too as it further reorganizes those groups entries. Idk if his implementation will matter for what you're doing but it was helpful for me when getting everything working together in what felt like appropriate variations. Everything being almost all the NPC packs, snufkins, enzombies, mickpewpews, and a few others.

 
that's interesting. well i reviewed the gamestage modlets for NPCMod that @khzmusik created and looks like they only impact the code for sleeper POI spawning. my planned NPCMod addon for enZombies only touches the wilderness biome spawning, so there's no overlap or potential conflict. you would continue doing whatever you were doing.

however, much like how khzmusik needed to provide a modlet for each NPCMode expansion pack that's out there, i will also need to do the same. my first release will just be for the base NPCCore entities (nurse, baker, and Harley), then as time goes on will create the modlets for expansions made by Xyth, DarkStarDragon, Arramus, GanTheGrey, Khzmusik, and others. the things we do to let everyone play all the mods all at once all the time. 😎

 
With this explanation would I be correct in assuming that if I wanted fewer Friendly NPC's that I would edit the entitygroups.xml in NPCCore/Packs and add the maxcount to each friendly NPC entry like how in spawning.xml maxcount is used for overall zombie count but not the randomness of the zombies as that is decided by entitygroups.xml. Like for an example below:

<entity name="npcBakerEmptyHand" prob="0.05" /> and change to <entity name="npcBakerEmptyHand" prob="0.05" maxcount="1"/>


No, you can't do this. Entity tags in entity groups do not support the "maxcount" attribute at all.

Instead you should do as Arramus suggested, and reduce the probabilities of all the NPCs in each biome group. (Or at least those that you see more than you like.)

In the default entitygroups.xml, Zombie Boe has no probability added, and for the sake of calculating appearance, we can consider that to be a 100% chance.


That's actually not how it works. There is no such thing as a 100% chance unless there is only one entity in the entity group.

In fact, if there is no probability added, then it defaults to a probability value of 1. That's not 100%, that's a probability equal to entities that also have a value of 1.

Here's how the probabilities are actually calculated.

First, the game sums up all the probabilities of all the entities in the entity group (after mods add them, if applicable). Then, it takes each individual probability, and divides it by this sum. Mathematically, this is called normalization - it means the total probability for each entity group will be exactly 1.

Now, each time an entity should be spawned from this group, it chooses a random number between 0 and 1. It goes through each entity in the entity group, in order, using the normalized probabilities. For the first entity, if the random number is less than its probability, that is the entity which is used. Otherwise, it adds that entity's probability to a running total, and moves on to the next entity in the entity group. If the random number is less than that entity's probability plus the running total, that entity is used. Otherwise... the process repeats until an entity is used.

Also note that there is no "keeping track" of entities. It's all determined by RNG, so the same entity can be chosen multiple times. (Using the terminology of probability theory, choosing an entity is an independent event.)

So, if modlets add a lot of NPCs to the zombie groups, then they can overwhelm zombies, so that there is a higher probability to spawn an NPC than a zombie. This can happen no matter how small each individual NPC's probability is.

If an entity group has 10 zombies without probabilities (meaning: a probability of 1 per zombie), then this will happen as soon as the combined probability values of all the NPCs reach 10. If you install a lot of NPC modlets, and they all add their own NPCs into the same biome spawn groups (which they do), then this is almost guaranteed to happen.

This is why I originally advocated that when NPC authors add their NPCs to a biome spawn group, the combined probabilities of all NPCs in that pack should add up to 1 in that group. This would mean there is an equal chance to spawn one of their NPCs, as there is to spawn a single zombie in that group. It also would mean that NPC packs with lots of NPCs (and/or weapon variations) wouldn't blow out NPC packs that had fewer NPCs. That didn't happen. C'est la vie.

that's interesting. well i reviewed the gamestage modlets for NPCMod that @khzmusik created and looks like they only impact the code for sleeper POI spawning.


That's correct. It's because POI spawners are the only ones that are gamestaged, at least in vanilla - biome spawns aren't. (Wandering hordes are too, but you can't spawn most NPCs into wandering hordes, that will throw exceptions because most NPCs don't descend from the C# EntityEnemy class.)

It's also easier to figure out POI spawning, since NPCs don't spawn in the same groups as zombies, so I didn't have to worry about zombie-vs.-NPC ratios like I would with biome spawns. I still don't know what most people expect that ratio to be (or even if there is any consensus at all).

 
Last edited by a moderator:
Hy, nice work @all. 7 is a very new game experiance with NPCs and more Zombies. Is there a chance to get a small addon pack wit a T-800 Terminator (one modell will be fine) that uses a Gatling Laser canon like from the wasteland mod? (of course we must ask mod owners permission). Best regards

 
Hy, nice work @all. 7 is a very new game experiance with NPCs and more Zombies. Is there a chance to get a small addon pack wit a T-800 Terminator (one modell will be fine) that uses a Gatling Laser canon like from the wasteland mod? (of course we must ask mod owners permission). Best regards
perhaps in a21

dont think any of us are adding anymore packs this alpha

i know i am not

 
I'm experiencing a significant error with the mod that only limits me to melee NPC's.

Summary: I'm only getting melee NPC's to spawn. There are no ranged NPC's spawning in my world at all. Even if I go into the entity spawner menu and select any of the ranged NPC's, for example a rifle baker NPC, I get the error "EXC Exception: Item with name "gunNPCHRfile" not found in class npcBakerHRifle"
Game Version: A20.6 (b9)
Platform: PC
Video Settings: Medium
Game mode: SP
Did you start a new game? Yes
Did you validate your files? (Yes/No)
Are you using any other mods? (Yes/No) Note: Please retest without any mods loaded in a new game.
EAC off? It's off
Bug Description: Any attempts to manually spawn NPC's other than the melee variants result in an error code such as: "EXC Exception: Item with name "gunNPCHRfile" not found in class npcBakerHRifle"
Detailed steps to reproduce the bug: I have attempted to uninstall all mods except for the NPC mods, verify game integrity files, and start multiple new games to no avail.
Actual result: Attempting to spawn any NPC has yielded the same result
Expected result: I expected the NPC's to spawn in with the selected weapon.

 
I'm experiencing a significant error with the mod that only limits me to melee NPC's.

Summary: I'm only getting melee NPC's to spawn. There are no ranged NPC's spawning in my world at all. Even if I go into the entity spawner menu and select any of the ranged NPC's, for example a rifle baker NPC, I get the error "EXC Exception: Item with name "gunNPCHRfile" not found in class npcBakerHRifle"
Game Version: A20.6 (b9)
Platform: PC
Video Settings: Medium
Game mode: SP
Did you start a new game? Yes
Did you validate your files? (Yes/No)
Are you using any other mods? (Yes/No) Note: Please retest without any mods loaded in a new game.
EAC off? It's off
Bug Description: Any attempts to manually spawn NPC's other than the melee variants result in an error code such as: "EXC Exception: Item with name "gunNPCHRfile" not found in class npcBakerHRifle"
Detailed steps to reproduce the bug: I have attempted to uninstall all mods except for the NPC mods, verify game integrity files, and start multiple new games to no avail.
Actual result: Attempting to spawn any NPC has yielded the same result
Expected result: I expected the NPC's to spawn in with the selected weapon.
Grab your log and upload it to pastebin and post a link here.

 
@Doomblade3890: I don´t wand to play with A21. After a year perhaps. There a so many good mods for A20 that doesn´t work than. I wait a year and than perhaps I play with A21. So please let me ask if someone is here to give us a Terminator 🙂

 
Grab your log and upload it to pastebin and post a link here.
Unfortunately Pastebin wouldn't let me upload it due to a 512kb limit. I have the log loaded on Google Drives here.

If you do a CTRL + F search for "Exception: Item with name" you should jump straight to the error I'm running into. Anytime I try to spawn a ranged NPC I get this error, only the melee-based NPC's work.

 
Unfortunately Pastebin wouldn't let me upload it due to a 512kb limit. I have the log loaded on Google Drives here.

If you do a CTRL + F search for "Exception: Item with name" you should jump straight to the error I'm running into. Anytime I try to spawn a ranged NPC I get this error, only the melee-based NPC's work.
Need to update your mods. You are running 20.5 versions of SCore and NPCmod.

 
I get a server crash every time I enter my linux dedicated server running this mod;  I was originally setting it up to run The Wasteland mod, but I've narrowed it down to SCore/NPCMod that seems to be the issue.

Error log: https://pastebin.com/8Q9GA8HE
Troublesome.

Caught fatal signal - signo:11 code:2 errno:0 addr:0x7f2a9551cc5e

It's been a couple of years since I ran 7D2D using Linux, and Linux specific posts are very rare if at all.

It appears this type of error can range from hardware conflicts, to data overflow going out of bounds, to something in the code which other OSs may allow through but Linux does not.

Can you try just Score on its own, without 0-XNPCCore, just to further reduce pinpointing?

 
Troublesome.

Caught fatal signal - signo:11 code:2 errno:0 addr:0x7f2a9551cc5e

It's been a couple of years since I ran 7D2D using Linux, and Linux specific posts are very rare if at all.

It appears this type of error can range from hardware conflicts, to data overflow going out of bounds, to something in the code which other OSs may allow through but Linux does not.

Can you try just Score on its own, without 0-XNPCCore, just to further reduce pinpointing?
Will do!

 
First warning:
Caught fatal signal - signo:11 code:2 errno:0 addr:0x7f2a9551cc5e

Current warning:
Caught fatal signal - signo:11 code:1 errno:0 addr:0x4f5c2529
Obtained 4 stack frames.
#0 0x007fb33f907520 in __sigaction
#1 0x0000004f5c2529 in (Unknown)
#2 0x007fb268036dc4 in (wrapper dynamic-method) EntityAlive:DMD<EntityAlive::updateCurrentBlockPosAndValue> (EntityAlive)
#3 0x007fb337f4580b in (wrapper dynamic-method) EntityAlive:DMD<EntityAlive::OnUpdateLive> (EntityAlive)

The general consensus on this type of error relates to stack overflows, coding issues, or irregularities in setup.

Can you confirm that players can join with nothing in the Mods folder at all, just to rule out any typos/mismatches/routing issues related to the serverconfig/set up?

 
arramus said:
First warning:
Caught fatal signal - signo:11 code:2 errno:0 addr:0x7f2a9551cc5e

Current warning:
Caught fatal signal - signo:11 code:1 errno:0 addr:0x4f5c2529
Obtained 4 stack frames.
#0 0x007fb33f907520 in __sigaction
#1 0x0000004f5c2529 in (Unknown)
#2 0x007fb268036dc4 in (wrapper dynamic-method) EntityAlive:DMD<EntityAlive::updateCurrentBlockPosAndValue> (EntityAlive)
#3 0x007fb337f4580b in (wrapper dynamic-method) EntityAlive:DMD<EntityAlive::OnUpdateLive> (EntityAlive)

The general consensus on this type of error relates to stack overflows, coding issues, or irregularities in setup.

Can you confirm that players can join with nothing in the Mods folder at all, just to rule out any typos/mismatches/routing issues related to the serverconfig/set up?


Yes, vanilla setup works just fine (I should have mentioned that already, my bad!).  I also wiped all saves to test vanilla, then wiped all saves to test just the NPCMod, and then just SCore.

arramus said:
It's been a couple of years since I ran 7D2D using Linux, and Linux specific posts are very rare if at all.


I've noticed, and that's a bit strange, since I'm pretty sure a large portion of hosted servers are all Linux-based.  Or maybe they no longer are (I haven't gotten a hosted server for... too many years, because I just ended up building my own).

 
Yes, vanilla setup works just fine (I should have mentioned that already, my bad!).  I also wiped all saves to test vanilla, then wiped all saves to test just the NPCMod, and then just SCore.

I've noticed, and that's a bit strange, since I'm pretty sure a large portion of hosted servers are all Linux-based.  Or maybe they no longer are (I haven't gotten a hosted server for... too many years, because I just ended up building my own).
Thanks for confirming, as it makes pinpointing it down to when you have Score installed as the common/only feature.
I saw your post has already been passed onto the Score creator and it was acknowledged the new fire feature may need a revisit with Linux builds in mind.
And yes, there are plenty of commercially hosted Linux servers out there so it may be that your message was the first to arrive unless slightly different Linux builds are responding differently.

 
Hey guys. For anyone out there enjoying NPCMod ... but not able to use enZombies due to incompatibility, i've created some patch mods you can now add so that NPCMod entities and enZombies will spawn properly together. so for now, my patch mods only work for the core entities (Nurse, Baker, and Harely) and Xyth's nice Bird, Spider and Mech expansion packs. I plan to eventually compatible-ize the remaining expansion packs too. enZombies mod page

@xyth Feel free to let me know if the way I presented and credited these NPCMod patches on my main page looks okay to you. 👍

 
Last edited by a moderator:
Back
Top