Jump to content
xyth

A19 NPCs DMT Mod

Recommended Posts

1. Tracking turns of in the entitiyClasses.xml, comment out this: <property name="MapIcon" value="ui_game_symbol_bullet_point"/>

 

It would take a bit of code to make that hired only.

 

2. Never tried so many at once, try it and let us know.

 

3. Vanilla NPCs wont work as you said, at this time you cant do what you ask.

 

1. That's good, it means turning off tracking should be easily done via a modlet. Point taken about the code needed to only track hired NPCs.

 

2. Well, I tried this, with mixed results.

 

First, it seems that NPCs de-spawn when you leave the chunk. That's actually not a big deal to me personally, and it actually might make NPC-heavy worlds not consume a huge amount of resources.

 

Second, I tested this by adding them to many of the vanilla spawn groups. This worked somewhat, but not quite as intended.

 

Part of my plan was to have NPCs spawn inside POIs along with the zombies. The idea was that you would go to loot a POI, only to find one or more survivors who are already fighting for their lives, and you could help them or not.

 

They did spawn in these cases, but the NPCs didn't do anything. They just stood there, and didn't fight any woken zombies, or wander around, or anything like that. (They did work if you hire them after they spawn.)

 

I'm pretty sure this is because POI spawns are sleeper volumes, and the NPCs (zombies in vanilla) spawn in a sleeping state. In this state all AI is shut off. Waking zombies probably involves calling some kind of method that your NPCs simply aren't programmed to respond to.

 

Zombies would also not wake in their presence, I'm guessing because 7D2D codes them to only wake up to players. That could be OK if the NPCs did spawn in a woken state, because then they could target the sleepers, which I'm guessing would wake them.

 

So, I think they will only work if they are spawned into groups that aren't initially sleeping. Friendly/hostile animals are in this category, which is why your modlet works as is.

 

(I'm not expecting you to add the "wake up" code, just letting you know what I found.)

 

3. That is a pity, but it was a long shot anyway. C'est la vie.

Share this post


Link to post
Share on other sites

NPCs should not despawn if they entered the world using the games biome spawner. Also, if you are using F6, make sure you don't use the default dynamic spawner, change to biome spawner. The dynamic spawner wont maintain them outside of the current chunk.

 

Once we get the A18 version of the Winter Project shipped we can look at NPC sleepers.

Share this post


Link to post
Share on other sites
NPCs should not despawn if they entered the world using the games biome spawner. Also, if you are using F6, make sure you don't use the default dynamic spawner, change to biome spawner. The dynamic spawner wont maintain them outside of the current chunk.

 

Once we get the A18 version of the Winter Project shipped we can look at NPC sleepers.

 

Actually, during test play, I did spawn in the first few NPCs using F6 (I hadn't seen Pest or Ghost before and wanted to get a feel for which zombies they should spawn with). I thought more had spawned in from sleeper hordes, but I could easily have been wrong about that. That probably explains why they de-spawned.

 

Don't knock yourself out trying to support NPC sleepers. I'd be very happy if you did, but I'm not expecting it, especially since I have no idea if anyone else wants them.

 

Also, if you need some help let me know, I'm not a game developer but do work with C# professionally.

Share this post


Link to post
Share on other sites

Interesting, now that you mention it we only biome spawned the npcs from this mod in a17 fantasy mod. We were going to add them to pois this time around, so should be interesting to see whats up with that. We can use custom spawners instead if its an issue, but im curious to see if they do spawn and why they arent moving around when in sleeper groups. The custom bandits and monsters we had in a17 version spawned fine in sleeper groups.

Share this post


Link to post
Share on other sites

One thing I also noticed: The "Pest" NPC attacks all the other NPCs (but not the player, unless attacked). Is this intentional?

Share this post


Link to post
Share on other sites
NPCs should not despawn if they entered the world using the games biome spawner. Also, if you are using F6, make sure you don't use the default dynamic spawner, change to biome spawner. The dynamic spawner wont maintain them outside of the current chunk.

 

Once we get the A18 version of the Winter Project shipped we can look at NPC sleepers.

 

Very useful tip there,didnt know this.

Share this post


Link to post
Share on other sites

So, when I gave you folks leeway with spawning sleepers, I may have been a bit premature.

 

It turns out that you can't spawn sleepers in POIs unless they are associated with sleeper spawns, in which case they need to be able to have their sleeper volumes be "woke" as a default. AFAIK this is not the default behavior, so sleeper volumes won't spawn NPC spawners correctly.

 

Meaning, you can't currently spawn NPCs in POIs such that they are in a state that they would be active (wandering, whatever).

 

Therefore, I would love it if you solved the issue where NPCs spawn without AI in sleeper volumes.

 

Still not saying I expect anything, just saying this feature would make a bunch of things possible.

 

Thanks for listening to a rambling lunatic. :smile-new:

Share this post


Link to post
Share on other sites

Well, because I'm basically a PITA, I have another question.

 

I'm trying to do a "dead is mostly dead" playthrough. I've got all of it working as far as the base game is concerned - you can't craft or pick up bedrolls, and your skill points are reset upon dying (technically, upon respawning).

 

But, because I also like these NPCs, I would also like the ability to "unhire" them. Specifically on dying, but just the general ability to trigger this would be helpful.

 

Is there any way to do this?

 

EDIT: Well, I just looked in SphereII's C# code, and the answer is currently "no." It wouldn't be too difficult to make a method that would dismiss all entities associated with the player, but I have no idea how you could make it so that it is an event you could trigger through XML (as an "action" property in a triggered_effect tag). This is probably a question for the SphereIICore thread.

Edited by khzmusik (see edit history)

Share this post


Link to post
Share on other sites

Need some help here. For some reason I cannot seem to hire NPCs in one of my worlds because the option is missing. If I start a new world I'm able to hire them just fine. I tried uninstalling the mod and reloading the world, then reinstalling it to see if it would fix it, but it doesn't look like that works.

 

https://imgur.com/PyLSv9w

Share this post


Link to post
Share on other sites

Xyth I'm running into an issue where the displayed dialogue options are limited, and if I order an NPC to learn a patrol route the option to "Dismiss" goes away, is there a workaround this?

Share this post


Link to post
Share on other sites
Xyth I'm running into an issue where the displayed dialogue options are limited, and if I order an NPC to learn a patrol route the option to "Dismiss" goes away, is there a workaround this?

 

Stupid question, but after you ask them to "Follow me for your patrol route", did you try to dismiss them at that point, or did you say "Patrol your route" before trying to dismiss them?

 

If you only asked them to follow, then my guess is the NPC is still waiting to finish learning the patrol route, and it's not possible to dismiss them until they've started patrolling (and therefore left that state).

 

That's a guess though. If you haven't tried that yet, try it and see if it works.

Share this post


Link to post
Share on other sites
+1 very interesting stuff!!

Mod(idea)s like 7 Days to Fallout are getting into range...

 

LuL ur Late honey :D im working since 2017 on my Mod and move it in the direction of Fallout IV :D

 

#FatMan

 

#FatMan+NeverEnding

 

#RadStorm (bugged) but allready fixed :D

Share this post


Link to post
Share on other sites
Stupid question, but after you ask them to "Follow me for your patrol route", did you try to dismiss them at that point, or did you say "Patrol your route" before trying to dismiss them?

 

If you only asked them to follow, then my guess is the NPC is still waiting to finish learning the patrol route, and it's not possible to dismiss them until they've started patrolling (and therefore left that state).

 

That's a guess though. If you haven't tried that yet, try it and see if it works.

 

This is likely the solution.

 

- - - Updated - - -

 

Need some help here. For some reason I cannot seem to hire NPCs in one of my worlds because the option is missing. If I start a new world I'm able to hire them just fine. I tried uninstalling the mod and reloading the world, then reinstalling it to see if it would fix it, but it doesn't look like that works.

 

https://imgur.com/PyLSv9w

 

Trying to add DMT mods into an existing save will likely cause issues, sorry.

Share this post


Link to post
Share on other sites
This is likely the solution.

I tried again now just to be sure, doesn't work.

 

NPC is patrolling his route, but still had it's option for dismissal overridden by (Patrol your route) none of the other options can alter this either.

Share this post


Link to post
Share on other sites
Need some help here. For some reason I cannot seem to hire NPCs in one of my worlds because the option is missing. If I start a new world I'm able to hire them just fine. I tried uninstalling the mod and reloading the world, then reinstalling it to see if it would fix it, but it doesn't look like that works.

 

https://imgur.com/PyLSv9w

 

I think i had this issue, you are missing a spherii mod that adds the dialogues. Try installing that, and if it was already installed, then maybe reinstalling it?

Share this post


Link to post
Share on other sites
Trying to add DMT mods into an existing save will likely cause issues, sorry.

 

The world was made with this mod installed actually, it wasn't added in the middle of one. I also just realized the other day that it's the specific map I'm using and not the save game itself. The map was made using Nitrogen, but it seems to be working just fine on another Nitrogen map I made.

Share this post


Link to post
Share on other sites

Update on adding these NPCs to POIs...

 

Rather than add them to sleeper volumes, I tried creating a spawn block, modeled after the "spawnTrader" block:

<block name="spawnNPCGeneric">
   <property name="Extends" value="spawnTrader" />
   <property name="CustomIcon" value="apparelSweatshirt" /> <!-- just to tell which is which-->
   <property name="SpawnClass" value="NPCBaker,NPCNurse,NPCFarmer,NPCAmmo,Hunter,Pest" />
</block>

(Note: I've also done it the "explicit" way, by copying-and-pasting the entire "spawnTrader" block, and only changing the "SpawnClass" value.)

 

This spawn block can then be placed in the POI like any other block.

 

This works, in the sense that the NPCs are awake and wandering when spawned in.

 

But, it works a bit too well... because the NPCs keep spawning until some predetermined limit is reached. I have no idea what that limit is. Depending upon the NPC, it could be only one, or it could be anywhere from five to nine.

 

Am I missing something really stupid? Some XML property that I need to include/modify, or perhaps some way to customize the "settings" of the block in the prefab editor?

Share this post


Link to post
Share on other sites
Update on adding these NPCs to POIs...

 

Rather than add them to sleeper volumes, I tried creating a spawn block, modeled after the "spawnTrader" block:

<block name="spawnNPCGeneric">
   <property name="Extends" value="spawnTrader" />
   <property name="CustomIcon" value="apparelSweatshirt" /> <!-- just to tell which is which-->
   <property name="SpawnClass" value="NPCBaker,NPCNurse,NPCFarmer,NPCAmmo,Hunter,Pest" />
</block>

(Note: I've also done it the "explicit" way, by copying-and-pasting the entire "spawnTrader" block, and only changing the "SpawnClass" value.)

 

This spawn block can then be placed in the POI like any other block.

 

This works, in the sense that the NPCs are awake and wandering when spawned in.

 

But, it works a bit too well... because the NPCs keep spawning until some predetermined limit is reached. I have no idea what that limit is. Depending upon the NPC, it could be only one, or it could be anywhere from five to nine.

 

Am I missing something really stupid? Some XML property that I need to include/modify, or perhaps some way to customize the "settings" of the block in the prefab editor?

 

The NPC spawner block continually spawns a trader in; they despawn because another trader is already standing there. This porevents trader prefabs from having 'empty' stations. You would probably need a custom spawner to get the effect you want.

 

Was there an issue with spawning the NPCs in as sleepers?

Share this post


Link to post
Share on other sites
The NPC spawner block continually spawns a trader in; they despawn because another trader is already standing there. This porevents trader prefabs from having 'empty' stations. You would probably need a custom spawner to get the effect you want.

 

Thanks. That matches what I observed, but seems like a really weird way to do it, so I thought I must be doing something wrong.

 

By "custom spawner" I assume you mean a modified version of the C# code, compiled with DMT? As far as I know there isn't any other spawner available in the XML - but I could be wrong.

 

EDIT: There are "entityspawner" tags in spawning.xml, but I don't think they're connected to POI spawning, are they? The spawn groups in the UI map to a "group" in gamestages.xml, and each group's "spawner" name is an entity class in entityclasses.xml. That's how I was initially trying to add NPC spawners.

 

Searching for "entityspawner" in the forums didn't turn up any recent posts, and the old posts all seemed to do with either biome or blood moon spawning, which don't work the same in modern alphas. Are those even used any more?

 

Was there an issue with spawning the NPCs in as sleepers?

 

The NPCs never wake up, unless you directly interact with them. (Or, possibly, until you get close enough to trigger their dialogue and the animation to put the weapon away - I can do more tests if you like.)

 

My intent is to have them immediately be active (wandering around, fighting any nearby zombies) when they're spawned in.

Edited by khzmusik (see edit history)

Share this post


Link to post
Share on other sites
Thanks. That matches what I observed, but seems like a really weird way to do it, so I thought I must be doing something wrong.

 

By "custom spawner" I assume you mean a modified version of the C# code, compiled with DMT? As far as I know there isn't any other spawner available in the XML - but I could be wrong.

 

EDIT: There are "entityspawner" tags in spawning.xml, but I don't think they're connected to POI spawning, are they? The spawn groups in the UI map to a "group" in gamestages.xml, and each group's "spawner" name is an entity class in entityclasses.xml. That's how I was initially trying to add NPC spawners.

 

Searching for "entityspawner" in the forums didn't turn up any recent posts, and the old posts all seemed to do with either biome or blood moon spawning, which don't work the same in modern alphas. Are those even used any more?

 

 

 

The NPCs never wake up, unless you directly interact with them. (Or, possibly, until you get close enough to trigger their dialogue and the animation to put the weapon away - I can do more tests if you like.)

 

My intent is to have them immediately be active (wandering around, fighting any nearby zombies) when they're spawned in.

 

I made a change to the SphereII.Mods repo for EntityAliveSDX

 

If you add the following line to the NPCs, it should give you the desired result for your NPC snoozing problem:

 

<property name="isAlwaysAwake" value="true" />

Share this post


Link to post
Share on other sites
I made a change to the SphereII.Mods repo for EntityAliveSDX

 

If you add the following line to the NPCs, it should give you the desired result for your NPC snoozing problem:

 

<property name="isAlwaysAwake" value="true" />

 

Wow, that's quick work, thank you! Is this change already pushed to your repo?

 

EDIT: It is, and I hunted down the commit:

https://github.com/SphereII/SphereII.Mods/commit/0050d7b5e959892466e5cbd31182682f9b421422

 

But from the added code, it seems like the property name should be "SleeperInstantAwake" correct? ("isAlwaysAwake" is the name of the local variable.)

 

Also - by "the NPCs" I assume you mean their entity classes, correct? The same XML that has the AI targets and such?

Edited by khzmusik (see edit history)

Share this post


Link to post
Share on other sites
Wow, that's quick work, thank you! Is this change already pushed to your repo?

 

Also - by "the NPCs" I assume you mean their entity classes, correct? The same XML that has the AI targets and such?

 

Yes, just add that line in above the AI stuff.

Share this post


Link to post
Share on other sites

Unfortunately, I can't seem to get this to work. I'm going to give details here, but let me know if this should be done over PM instead.

 

I am testing this by modifying a renamed "survivor" POI, using the Prefab Editor, then hitting "playtest" in the editor menu.

 

The only time the NPCs spawn in moving around, is when the "xuiSleeperVolumeTrigger" value is set to "Attack" in the sleeper volume. But this leads to undesirable behavior - if there are no zombies around, the NPCs wake by attacking the player, and once awoken, often attack other NPCs.

 

I've tried using both other "xuiSleeperVolumeTrigger" values ("Passive" and "Active") but it does not seem to make a difference.

 

They do animate, but all they do is look around; I assume this is their idle animation. And that's only for NPCs like Hunter that have idle animations - for instance, it seems the Nurse and Farmer do not.

 

Also - I was mistaken before; the NPCs don't wake up even after you interact with them (unless they're attacking you in "Attack" mode). They won't "wake up" and start moving around until they are attacked - even after being hired.

 

For instance, if you hire one and tell it to follow you, it will just stand there until you're far enough away for it to "teleport" to your location - and it won't even "wake" after being teleported. I only got them to start wandering by spawning in a zombie Boe (using F6) next to one of them; after the NPC was attacked and fought back, it behaved as normal.

 

I did notice that the Mod Launcher hasn't picked up the SphereII Core changes yet; in the UI it says it was last modified on December 9th. To make sure I have the latest updated version, I downloaded the .zip file directly from GitHub, then uncompressed the "0-SphereIICore" folder directly into the "Mods" folder. I double-checked that the changes from the commit, above, were in the "EntityAliveSDX.cs" file.

 

I launched the game using the Mod Launcher at that point, and it all seemed to work as expected, there were no compilation errors or anything like that. Though maybe the Mod Launcher compiling from a different folder than "Mods" or something? Don't know.

 

This is a sample of the XPath I used to put in the "isAlwaysAwake" flag:

 

<!-- entityclasses.xml -->
<configs>
   <append xpath="/entity_classes/entity_class[starts-with(@name, 'NPC')]">
       <!-- Also tried: <property name="SleeperInstantAwake" value="true" /> -->
       <property name="isAlwaysAwake" value="true" />
   </append>
</configs>

 

Here's a sample of how I modified the XML so sleeper volumes can spawn NPCs:

 

<!-- gamestages.xml -->
<configs>
   <insertAfter xpath="/gamestages/group[last()]">
       <group name="S_-Group_NPC_Generic" emptyChance="0" decoyChance="0" decoy1hpChance="0">
           <spawner name="NPCGenericHorde" count="5,6" />
       </group>
   </insertAfter>
   <insertAfter xpath="/gamestages/spawner[last()]">
       <spawner name="NPCGenericHorde">
           <gamestage stage="1">
               <spawn group="NPCGenericGroup" num="1" maxAlive="1" duration="1" />
           </gamestage>
       </spawner>
   </insertAfter>
</configs>

<!-- entitygroups.xml -->
<configs>
<append xpath="/entitygroups">
	<entitygroup name="NPCGenericGroup">
		<entity name="NPCBaker" />
		<entity name="NPCNurse" />
		<entity name="NPCFarmer" />
		<entity name="NPCHarleyQuinn" />
		<entity name="NPCAmmo" />
		<entity name="Hunter" />
		<entity name="Pest" />
		<entity name="Ghost" />
	</entitygroup>
</append>
</configs>

 

I double-check the XPath by doing a config dump while play testing the POI, and the changes were there and in the expected places.

 

Can you see anything that I'm doing wrong?

Share this post


Link to post
Share on other sites

I've been digging into this more, and I'm pretty sure the issue is with the C# code. It's too technical to go into here, so I sent a PM to SphereII with my findings.

Share this post


Link to post
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...