Jump to content

A21 NPCMod and Addons


xyth

Recommended Posts

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 🤔

Also. After installing this mod, before tinkering with any of the base values I'm running into a couple of issues I wanted to ask about.

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 🙏 

Link to comment
Share on other sites

it doesnt have to be african animals it could be a modlet of any animals i  want more animals and zombies in my worlds im not into bandits as thats boring to me i dont fancy being one shotted if i go somewhere the developers of this mod used to do a seperate creature pack for a19 but cancelled it to do this one 

 

Link to comment
Share on other sites

On 10/17/2022 at 8:18 AM, Quillbeatssword said:

Any insight would be much appreciated 🙏 

For the damaging neutral NPCs, if you look into NPCmod's entityclasses.xml, there's and effect group commented out called Damage All NPCs. It details how that works. You can uncomment that effect group, or if you'd wanna make a small patch modlet to change those values separately, you can have something like
 

<append xpath="/entity_classes/entity_class[@name='playerMale']">
	<effect_group name="Damage All NPCs">
		<triggered_effect trigger="onSelfFirstSpawn" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
		<triggered_effect trigger="onSelfEnteredGame" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
		<triggered_effect trigger="onSelfRespawn" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
	</effect_group>
</append>

to set it up. The way they are coded is with the above bit used, they become hostile for 30 seconds if attacked. So if you accidentally hit one, you can run away for a bit and they will calm down. If you want all roaming NPCs to be neutral unless you attack them, you'd need to either change their factions to whiteriver or edit the bandits faction to be neutral instead of hate. Hired NPCs cannot be damaged at all, so no worries there.

 

For the factions, you should be able to do that, but adding new factions needs a new game, so that might be the source of your errors. You'd also need to edit their AI targets/tasks to add the classes of the things you want them to attack. Same for the zombies, you would need to add the classes for the stag and rabbit so they will target the passive ones. You may also need to add the "animal" tag to the UseFactionsTags values in SCore's blocks.xml so they use the factions properly.

Link to comment
Share on other sites

15 hours ago, bdubyah said:

For the damaging neutral NPCs, if you look into NPCmod's entityclasses.xml, there's and effect group commented out called Damage All NPCs. It details how that works. You can uncomment that effect group, or if you'd wanna make a small patch modlet to change those values separately, you can have something like
 

<append xpath="/entity_classes/entity_class[@name='playerMale']">
	<effect_group name="Damage All NPCs">
		<triggered_effect trigger="onSelfFirstSpawn" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
		<triggered_effect trigger="onSelfEnteredGame" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
		<triggered_effect trigger="onSelfRespawn" action="ModifyCVar" cvar="DamageRelationship" operation="set" value="450"/>
	</effect_group>
</append>

to set it up. The way they are coded is with the above bit used, they become hostile for 30 seconds if attacked. So if you accidentally hit one, you can run away for a bit and they will calm down. If you want all roaming NPCs to be neutral unless you attack them, you'd need to either change their factions to whiteriver or edit the bandits faction to be neutral instead of hate. Hired NPCs cannot be damaged at all, so no worries there.

 

For the factions, you should be able to do that, but adding new factions needs a new game, so that might be the source of your errors. You'd also need to edit their AI targets/tasks to add the classes of the things you want them to attack. Same for the zombies, you would need to add the classes for the stag and rabbit so they will target the passive ones. You may also need to add the "animal" tag to the UseFactionsTags values in SCore's blocks.xml so they use the factions properly.

I was pretty sure I had the right idea with target/tasks and Factions! Thank you! What I didn't know how to do was change that part of entityclasses. Thank you so much!

 

I do start new games in between tests.

But thanks for making sure!

 

Edit* Looking at the XNPCCORE entityclasses.xml i notice at the top it says that they stopped using class based targeting in favor of Faction based targeting. If that is the case than wouldnt i only need to define Factions and faction enemies?

 

20 hours ago, paul cornwall said:

it doesnt have to be african animals it could be a modlet of any animals i  want more animals and zombies in my worlds im not into bandits as thats boring to me i dont fancy being one shotted if i go somewhere the developers of this mod used to do a seperate creature pack for a19 but cancelled it to do this one 

 

If you open it up in notepad you can reduce the bandit spawn rates to 0 and increase animal spawns to whatever you like.

Edited by Quillbeatssword (see edit history)
Link to comment
Share on other sites

1 hour ago, Quillbeatssword said:

If you open it up in notepad you can reduce the bandit spawn rates to 0 and increase animal spawns to whatever you like.

This relates to there not being any NPC animal packs released for A20 and the desire to see them make a return since they were a positive feature in previous versions.

A20 saw some pretty fundamental changes to what classes remained and a number of mods had to pretty much begin again for some of the NPC/entity features. The animals will come back in time, but investing time in them now with A21 seeming to be pretty well developing in the background, may require a lot of time investment now and for what changes in A21.

 

Looking forward to any faction pack/NPC pack releases you may add to the collection. ^^

Link to comment
Share on other sites

3 hours ago, arramus said:

This relates to there not being any NPC animal packs released for A20 and the desire to see them make a return since they were a positive feature in previous versions.

A20 saw some pretty fundamental changes to what classes remained and a number of mods had to pretty much begin again for some of the NPC/entity features. The animals will come back in time, but investing time in them now with A21 seeming to be pretty well developing in the background, may require a lot of time investment now and for what changes in A21.

 

Looking forward to any faction pack/NPC pack releases you may add to the collection. ^^

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 😉

 

That being said. I do know that with A21 getting closer any large amount of work I do will have to be redone but atm I'm considering it practice. Trying to familiarize myself with the code and what can be accomplished with it for the moment. 

Edited by Quillbeatssword (see edit history)
Link to comment
Share on other sites

1 hour ago, Quillbeatssword said:

add occasional bandit groups and animal packs. You could try something similar or use mine if I get it to work 😉

For Wandering Hordes, we set all of the Not Medieval Mod to use only the Skeleton types pack and they are a lot of fun. A creator, Guppy, recently released some Grim Reapers and they also just joined that group. It gives the effect of the Grim Reapers leading all of the Skeleton types into battle. We also increased their numbers quite a lot to keep some alive should they be attacked by friendly armed NPCs. They will be able to overpower attacks in such situations. The same for the entities who appear when a player opens the Buried Supplies. The skeletons arrive as if they were disturbed from their slumber underground.

 

Bandit groups haven't really been a feature so far so it'll be interesting to see how it works out as you develop it. The ranged bandits in a Wandering Horde will be beastly if a single player gets caught unawares but some players live for moments like that.

Link to comment
Share on other sites

38 minutes ago, arramus said:

For Wandering Hordes, we set all of the Not Medieval Mod to use only the Skeleton types pack and they are a lot of fun. A creator, Guppy, recently released some Grim Reapers and they also just joined that group. It gives the effect of the Grim Reapers leading all of the Skeleton types into battle. We also increased their numbers quite a lot to keep some alive should they be attacked by friendly armed NPCs. They will be able to overpower attacks in such situations. The same for the entities who appear when a player opens the Buried Supplies. The skeletons arrive as if they were disturbed from their slumber underground.

 

Bandit groups haven't really been a feature so far so it'll be interesting to see how it works out as you develop it. The ranged bandits in a Wandering Horde will be beastly if a single player gets caught unawares but some players live for moments like that.

I'm going to try and keep the occurrence rare so that people don't get frustrated by encounters like that lmao 

Link to comment
Share on other sites

On 10/17/2022 at 9:18 AM, Quillbeatssword said:

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?

 

On 10/17/2022 at 9:18 AM, Quillbeatssword said:

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.

 

23 hours ago, Quillbeatssword said:

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.

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

A small update for the NPC Mod Sample Prefabs.

This is a Road Block incorporating @Darkstardragon's 1-SoldierPack. It is build on the Trader Gateway Tile because this is a sure way to ensure the Road Block appears where it should. It is a static 'POI' that will appear at every Trader area. It is as much as a test as it is for function.

The soldiers will quite potentially get wiped out during the first Blood Moon but as they are built into Sleeper Volumes like in a regular POI, they should respawn every 5 days.

It is crude but demonstrates Pathing Cubes, Sleeper Volumes, and other NPCMod features. The POI for this feature is in the folder NPCMod_Military_rwg_tile_gateway_cap.

https://github.com/arramus/A20-NPCMod-Prefabs

 

 

Link to comment
Share on other sites

14 hours ago, arramus said:

A small update for the NPC Mod Sample Prefabs.

This is a Road Block incorporating @Darkstardragon's 1-SoldierPack. It is build on the Trader Gateway Tile because this is a sure way to ensure the Road Block appears where it should. It is a static 'POI' that will appear at every Trader area. It is as much as a test as it is for function.

The soldiers will quite potentially get wiped out during the first Blood Moon but as they are built into Sleeper Volumes like in a regular POI, they should respawn every 5 days.

It is crude but demonstrates Pathing Cubes, Sleeper Volumes, and other NPCMod features. The POI for this feature is in the folder NPCMod_Military_rwg_tile_gateway_cap.

https://github.com/arramus/A20-NPCMod-Prefabs

 

 

 

This does look pretty cool. Though, if it's a trader tile, does that mean it replaces all trader tiles in the game?

 

From what I've heard from the Compo Pack folks, there can only be one trader tile used in the game, that's why I ask.

 

On a related subject - where is the best place to announce NPC Core POIs? I was going to announce them (and provide a download for them) in the Prefabs forum, since that's where most people go for custom POIs, and announcing it there might encourage POI designers to start creating NPC POIs.

 

But if the consensus is to release them in the same thread as your modlets, then that is what I'll do.

Link to comment
Share on other sites

2 hours ago, khzmusik said:

 

This does look pretty cool. Though, if it's a trader tile, does that mean it replaces all trader tiles in the game?

 

From what I've heard from the Compo Pack folks, there can only be one trader tile used in the game, that's why I ask.

 

On a related subject - where is the best place to announce NPC Core POIs? I was going to announce them (and provide a download for them) in the Prefabs forum, since that's where most people go for custom POIs, and announcing it there might encourage POI designers to start creating NPC POIs.

 

But if the consensus is to release them in the same thread as your modlets, then that is what I'll do.

It will replace all trader gateway tiles, even in areas that a Trader does not spawn (Old West and occasionally some other areas) as that is tagged to any Tile Set.
This push is somewhat in preparation for Teragon, or for creators to copy directly into a custom tile where applicable. It was also something Darkstardragon asked for from the outset and is a bit overdue.

 

I post any POI updates for this little 'bundle' directly into this thread simply to keep everything central. They haven't been added to the opening post as a download and are often out of sight out of mind soon enough. Some are being used in Overhauls as is or customised and this pack is also helpful to share as a guide for creators since it has a small readme explaining some of the basics.

Link to comment
Share on other sites

I am not sure if this is a bug or a limitation on the mod, or a limitation on the game itself. But here is the situation. My friends and I just ventured to a city that was over 2km from our base (where we had NPCs stationed). When we returned they had all vanished, even those that were inside the structure. Nothing was damaged, all doors were closed, and so on. So we are sure they were not attacked and killed. So my question is, do NPCs vanish if you get to far away from them? Any help on this would be awesome. Thanks. ;)

Link to comment
Share on other sites

1 hour ago, KailJ said:

I am not sure if this is a bug or a limitation on the mod, or a limitation on the game itself. But here is the situation. My friends and I just ventured to a city that was over 2km from our base (where we had NPCs stationed). When we returned they had all vanished, even those that were inside the structure. Nothing was damaged, all doors were closed, and so on. So we are sure they were not attacked and killed. So my question is, do NPCs vanish if you get to far away from them? Any help on this would be awesome. Thanks. ;)

This has been a troublesome issue that the team have attempted to resolve. Here is some background to what we have observed and attempted.

 

After the release of the NPC Mod, some players noticed that their hired NPCs would suddenly disappear for no apparent reason. There did not seem to be any pattern to it and it could happen very suddenly, take a long time to happen, or happen when logging out and back in. On some occasions though, the NPCs would magically reappear!

 

We tested this quite a lot and these are some of the observations:

 

1. To answer your question. Yes, NPCs can vanish when you get too far away from them. It is not a given certainty that it will happen and it may not necessarily happen to all of the NPCs you have hired. We placed 10 NPCs in a raised base. They were fine for about 7 hours or game play. We accelerated moving towards and away from the base over this period and all was just fine. At that 7 hour period we came back to base and 4 of the 10 NPCs had disappeared. We checked the logs and did see some chunk reloading warnings for that area. It also mentioned the default Trader being respawned/reset or something like that. It was at that time we lost 4 NPCs. We did not have the same safe guards in place to protect the NPCs that the trader seems to have. A current limitation.

2. The game loads and unloads chunks of the World at a time. It appears to be 100 blocks. If you move past 100 blocks away from your base/NPCs they typically disappear as that area is unloaded. Once you return to a distance of less than 100 blocks they should return again.

3. Here is what may be happening. As a player returns to the area and it reloads, the NPCs may get loaded before the blocks and terrain. This can cause them to fall 'inside' the base. At times we have seen some that were standing on top of 1 block pillars become 'merged' inside the block at the bottom of the pillar. It seems:

a) The World chunk reloaded the terrain.
b) The NPC reloaded before the blocks and landed on the terrain.
c) The blocks reloaded with the NPC inside them.

 

We could see the NPC inside the bottom block because the barrel of their weapon was poking out and they were able to pivot in a circle. This was also seen in the Oakraven Guards and Pets mod which also uses NPCs. This was also an issue in A19.

 

An alternative to this is:

a) The World chunk reloads but the NPC is loading faster than the terrain.

b) The NPC falls under the World to an 'ether' region.

 

In this scenario it seems the NPC loads out too early and sinks. However, they do not always appear to fall into oblivion and sometimes reappear. It's likely they are stored in that chunk area as an asset in the Saves Games files and have the chance to reappear if things work in their favor.

 

The team tried a number of ways to ensure the NPC could be reloaded more reliably and stably. However, it has not been successful so far. There is hardcoding at play here which is not always accessible/visible.

 

Posts continue to come about NPCs disappearing. It happens more than the posts suggest in this thread as I visit community Discords and it is a topic of discussion. Communities handle it in their own ways such as reimbursing players for the loss or telling them it is just part of the game (NPCs will feel they did their money's worth and move along ^^).

 

This can be a real pain and frustration for everyone. The traders seem to have more safe guards in place to ensure this issue doesn't happen and that is something which would benefit the NPCs. Saying that, there are occasions where a player moves back into the chunk where the Trader is and finds them at ground level where they were originally standing on raised areas (both default and custom Trader POIs).

 

We had similar sinking or disappearing issues for the vehicles which I rarely see posted about these days.
A20 then had issues for the Turret Sledge where it would sink inside a block.

It seems Voxel/Chunk rendering type Worlds can be troublesome. If you've ever played the Unreal Engine Voxel based Astroneer, we do see similar technical issues with terrain interaction.

 

Yes, this is potentially a bug, a current limitation of the NPC Mod, and possibly something the game may need to delve into more as well. That's about all we can say on that so far.

Link to comment
Share on other sites

8 hours ago, arramus said:

This has been a troublesome issue that the team have attempted to resolve.

 

 

This issue will likely remain until TFP introduces Bandits in A21.  Hopefully the new bandit class will have new code to prevent these disappearances.   Until then, there is little we can do to fix this.

Link to comment
Share on other sites

Hello Guys,

 

I have a dedicated server and play with friends...one of them hired a lot of NPC`s....He decided to stop playing this game...how can i change the owner from his npc´s ?he wont join back bc no time for this,

 

Greetings Madara

Hello Guys,

 

I have a dedicated server and play with friends...one of them hired a lot of NPC`s....He decided to stop playing this game...how can i change the owner from his npc´s ?he wont join back bc no time for this,

 

Greetings Madara

Link to comment
Share on other sites

  • 2 weeks later...
On 10/16/2022 at 3:23 AM, Redarmy45 said:

Make your own door and lock it. Didnt used to work,but new version of the NPC mod seems that NPCs adhere to not opening locked doors. Maybe someone can confirm but in my tests that seemed to work

Sorry it took me so long to reply. Life has been hectic. I have since realized it is only roll up doors they are opening, both modded ones & vanilla ones.

 

 

Edited by MandyCMoore (see edit history)
Link to comment
Share on other sites

I am using the NPC mod on my single player game, along with most of the mod packs. It seems to work great and I'm having a great time! Thanks for that.

 

My issue is with my dedi server (through HostHavoc). I installed the score and the game starts fine. So I stop the server and install the NPC mod. Opening the in-game  console I see the lobby created and entered, but nothing else ever happens. I let it sit for over 15 minutes, but nothing.

 

No red errors, no yellow warnings, no other mods used.

 

Any insight?

 

 

Link to comment
Share on other sites

6 hours ago, sandpaper600 said:

I am using the NPC mod on my single player game, along with most of the mod packs. It seems to work great and I'm having a great time! Thanks for that.

 

My issue is with my dedi server (through HostHavoc). I installed the score and the game starts fine. So I stop the server and install the NPC mod. Opening the in-game  console I see the lobby created and entered, but nothing else ever happens. I let it sit for over 15 minutes, but nothing.

 

No red errors, no yellow warnings, no other mods used.

 

Any insight?

 

 

I am also using Host Havoc. It is currently running the Wasteland Mod which uses Score, NPCCore, a multitude of NPCs which take things beyond the NPCCore base due to a custom class for melee types. It has loaded up first time every time so far without issue. Please share the server logs to show what is happening. If you were also able to share what you have installed and your IP address, we can attempt to pay a visit and experience the situation.

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I'm a big fan of the npc mod.  I used to play on a different system and it really added a lot to the game.  Now I'm on a linux system and I can't seem to get score or npc mod to work.  I get just past world creation and then the game freezes just at launch of the first person view, have to reboot to get out of it.  I may not have searched for other similar posts, its a long forum topic here. LMK if this has already been discussed.  Could do any troubleshooting or provide more information if directed, tia.

OS: ubunto 20 lts

7d2d: 20.6 b6

tested with only score and npc mods. 

No errors thrown, just freeze up after map generation.  

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...