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

A19 NPCs DMT Mod

Status
Not open for further replies.
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.

 
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:

 
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.

 
Last edited by a moderator:
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

 
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?

 
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.

 
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.

 
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.

 
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?

 
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.

 
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:

Code:
<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?

 
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:

Code:
<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?

 
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.

 
Last edited by a moderator:
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:

Code:
<property name="isAlwaysAwake" value="true" />
 
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:

Code:
<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?

 
Last edited by a moderator:
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.

 
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:

Code:
<!-- 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:

Code:
<!-- 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?

 
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.

 
Status
Not open for further replies.
Back
Top