Jump to content

NPC respawn question


Carreau

Recommended Posts

So, Iâve been curious about how the creation engine handles respawning. If a levelled NPC is moved to a different cell and then killed, does it stay in the new cell or does it revert back to the original cell when the cells reset?

 

For example, say some of the raiders inside Corvega chase the player outside and are then killed there. Will they respawn in the exterior location or will they respawn back inside where they were originally placed?

 

TIA

Link to comment
Share on other sites

Non unique spawned NPCs are totally transient. If they they move they die and disappear. No persistence.

 

Spawn points are generally static locations (unless an SKK mod generates them :) which create NPCs based on Player level * aiLevelMod of spawn * Encounter Zone they are in.

 

Have a quick read of CalculateEncounterLevel and PlaceActorAtMe. Vanilla spawned NPCs either turn up at the letter M in the render window or Xmarker locations controlled by quest references.

Link to comment
Share on other sites

That clears it up. Thanks!

 

I was worried when I saw that the M marker in the editor was a refID of the template NPC and started to think that they would have some form of persistence.

 

I was having trouble finding info on the CK wiki about how the engine cleans up dead actors.

Edited by Carreau
Link to comment
Share on other sites

It turns out that the NPCs do respawn where they die. To test it out, I had a small holding area in another cell, NPC are moved to the holding area and killed. After the request amount of time for cell reset, the NPC respawned in the holding area and not their original cell. So it does appear that the game engine is tracking RefID locations for persistence. Not sure how one would force a RefID to return to its original cell during the cleanup process.

 

Long and short, I'm working on a mod where NPCs are ported to this holding area as a visual cheat. I wonder if the workaround for this would be to disable the NPC, place them at the player's location at the time of death, and then they should ideally respawn in their original location during cell reset.

Link to comment
Share on other sites

Are you using unique named NPCs, or what function/placed object are you using to spawn at ?

 

I am interested because I would like my spawned NPCs to respawn where they die, and have had to employ some messy code that moves the spawn point marker to their OnDeath() location. If you have an automatic method I'd like to use that.

Link to comment
Share on other sites

The mod is moving any NPC the player attacks with this particular spell to a prison area for a calculated amount of time. To do this, all it's doing on the successful cast is using moveto(holdingArea) on the target. If the NPC stays in the holding area until the calculated time has passed, it's simply killed with the kill() command or killEssential() command. The NPCs stay there and respawn. As a test, I COCed myself to the holding area and saw every NPC that had been killed with this mod. This isn't my mod, but I am making some plug ins to it, so I figured I could correct this issue while I'm at it.

 

Right now, I'm thinking that after the NPC is dead, either disable them, or setCriticalStage them and use MoveToMyEditorLcoation() to return the NPC to its original spot. That'll put the NPC back as dead in the game world space and hopefully clear up all of these issues I'm seeing.

Link to comment
Share on other sites

Not sure what's causing it to act that way. The holding cell of this mod is pretty basic. boxed in interior cell with an X marker and a container to move all items from the mobs it kills for the player to still get the loot.

 

My simple solution was to set the mob's critical stage to 4 so it was derendered and uninteractable, and then use movetomyeditorlocation() on it in the loot/cleanup section of this mod's script. So far, it's working. I made a test NPC in sanctuary as a leveled raider, killed it with the mod, forced the cell to reset, and the NPC was back where I expected him. Now to play test and make sure it works on the grand scale I guess.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...