Hello everyone! I just recently started toying with some personal mods. I've modded other games in the past and typically catch on quickly but I'm having trouble getting anything I do for this game to work correctly.
Initially I was working on a "Faction pack" using the base npc.xml. When it failed I noticed that this mod also alters that file so I opened it and took a look. I've noticed you've added several new Factions. "Aggressiveanimalssmall" etc. But, I don't see that you have changed the vanilla Factions for any of the animals from the default "Animals" faction. What I was trying to do is seperate animals into their own Factions. Things like rabbits, chickens and deer would still share the same passive animals function but things like Wolves, bears and mountain lions would be hostile towards eachother. I also wanted to make zombies actively aggressive towards animals as well. So would I need to pull the original strings from the vanilla npc.xml and add them to this one after editing? Trying to do it separately gave me red errors and I'm unsure why
The NPC Core mod
does add the new animal factions to vanilla animals. It's done in entityclasses.xml:
https://github.com/7D2D/A20Mods/blob/main/0-XNPCCore/Config/entityclasses.xml#L60
NPC Core should also add the C# classes to the vanilla AI targeting tasks:
https://github.com/7D2D/A20Mods/blob/main/0-XNPCCore/Config/entityclasses.xml#L24
The issue is that animals don't use factions by default.
There is a "config feature block" in SCore that determines which tags an entity must have in order to use faction-based targeting/damage rules:
https://github.com/SphereII/SphereII.Mods/blob/master/0-SCore/Config/blocks.xml#L160
Add the "animal" tag for animals to use it.
I thought zombies already attacked animals though?
When I see an NPC off in the distance there's not really a way to determine if it's friendly or a bandit until it's too late.
So often times I'd treat it like a pvp encounter and take a shot at them. But I noticed that hireable npc cannot be shot. I was considering making them work like boars. Friendly until fired upon. However I assume that doing so would also make it possible to shoot an NPC AFTER I hire them and trigger them into attacking me or am I mistaken? If so. Is there a way around this? To make an NPC neutral until either hired "Allied" or fired upon "Enemy"?
Any insight would be much appreciated
By default, human (and only human) NPCs cannot be damaged unless their faction relationship is "dislike" or lower. So any faction with a "*" value of "neutral" is immune from damage from the player, and NPCs from different factions that are neutral to each other also can't damage each other.
I also don't like that - I think the player should be able to damage
any entity, just like they can damage vanilla neutral entities such as boars. It's also necessary for the faction-related quests I'm doing, which reward the player with a higher faction standing upon completion.
So, I set players to damage anything with a faction relationship below 1001 - which is all factions, since the maximum faction relationship value is 1000.
Here's the code where I did that in my modlet:
https://gitlab.com/karlgiesing/7d2d-a20-modlets/-/blob/main/1-khzmusik_Human_Factions_Reputation_Quests/Config/entityclasses.xml
That also shows the values for all the faction relationships (hate, dislike, neutral, like, love).
Note that
hired NPCs are always damage immune from their bosses (and vice versa). In MP, this should also apply to other players, depending on the P2P damage rules set up on the server. This can't be changed and is independent of NPC faction.
I'm working on something for that atm for personal use. I'm trying to use Khaines wandering horde mod to also add occasional bandit groups and animal packs. You could try something similar or use mine if I get it to work
Unfortunately you can't spawn most NPCs into hordes (neither wandering hordes nor blood moon hordes). The vanilla code assumes that the entity's C# class descends from EntityEnemy. The vast majority of NPC Core entities don't, and neither do the majority of entities in packs. So if you try to spawn them into hordes, you'll get big red null reference errors in the console.
There are two exceptions: my Whisperers pack, and my Rogues and Psychos packs. Those have both "advanced" (hireable) versions and "basic" versions. The "basic" versions
can be spawned into wandering hordes, and in fact the Whisperers already do. I figured most people would want that for enemies, so the "basic" ones are the ones that are used by default.
You can get those packs from my thread on these forums:
https://community.7daystodie.com/topic/27333-a20-khzmusiks-modlets/
In order to get those to work, I made the "basic" versions descend from the NPC Core "blood moon" templates. Those templates have "BM" in their names (like "npcBMClubTemplate"). If you want, you could try changing the other NPCs (in either Core or whatever packs you're using) to use those same templates.
Using those templates will mean that NPCs can't be hired or interacted with (those features are in the NPC Core class that doesn't descend from EntityEnemy).
There is no problem spawning any NPCs into
biome spawns. There is also no problem with spawning them into sleeper volumes in POIs. If you're interested, NPC Core contains a lot of custom spawn groups for sleeper volumes, so you can create NPC POIs just like you would vanilla POIs (just use the different spawn groups).
Hope that helps.