Jump to content

Place NPCs in hidden cells


Guest

Recommended Posts

Posted

So I want certain NPCs to enter the Skyrim world only when certain conditions in an AI package is met. I don't want these NPCs to be present at all in the world when these conditions are not met.

 

I though my best approach would be to create a completely new cell and place my actors in it. The AI package will be linked to a marker placed where I want them to spawn in the world when the condition is met.

 

Comments to this? Anything?

Posted
51 minutes ago, Thor2000 said:

Comments to this? Anything?

That's one way to do that. Many mods have a cell outside of the world to store their stuff. Merchant chests, NPC, xmarkers, ...

 

If you have created  another (interior) cell that is supposed to be accessible for the player, you could also place the NPC in a door-less room behind some walls and surround that with an occlusion box. They will not be rendered that way. Sometimes, this is a bit more comfortable for you in the CK. Bethesda did this sometimes. 

Posted
5 minutes ago, worik said:

If you have created  another (interior) cell that is supposed to be accessible for the player, you could also place the NPC in a door-less room behind some walls and surround that with an occlusion box. They will not be rendered that way. Sometimes, this is a bit more comfortable for you in the CK. Bethesda did this sometimes. 

Nice... do you know an example of this in the vanilla game I can look at? I guess I can't use the same room? I've read some place that editing these hidden cells might lead to broken stuff... but just duplicating one of them is perhaps fine? I know little about this :-/.

Posted
1 minute ago, Thor2000 said:

but just duplicating one of them is perhaps fine?

I strongly advise against that. If you don't know what you are dooing, tjhis ☝️ is the most instable way to do that.

 

Overall, it is easy. There are very good tutorial on youtube. Personally, I recommend darkfox127 to get started.

Have a look here for links :

 

4 minutes ago, Thor2000 said:

do you know an example of this in the vanilla game I can look at?

Not by memory ? Some dungeon with quests where they hide some foes and trigger their appearence when the quest advances. And they did it in FO4.

Posted
29 minutes ago, worik said:

I strongly advise against that. If you don't know what you are dooing, tjhis ☝️ is the most instable way to do that.

 

Okay, got it. No duplicating!

 

Gonna check those tuts. Darkfox is the saint when it comes to CK tutorials.

 

Thank you for help and tip ?

Posted
1 hour ago, Thor2000 said:

So I want certain NPCs to enter the Skyrim world only when certain conditions in an AI package is met.

 

1) Packages can be quirky.  I wouldn't use them as a trigger.

 

2) Just disable the NPCs and have a quest enable them when the time is right.  This saves on AI processing, and if you use a quest for this, it can trigger from whatever you want.

Posted
15 hours ago, Seijin8 said:

 

1) Packages can be quirky.  I wouldn't use them as a trigger.

 

2) Just disable the NPCs and have a quest enable them when the time is right.  This saves on AI processing, and if you use a quest for this, it can trigger from whatever you want.

 

@OP   You can scroll down to Out of Order for some infos on making npc quest enabled

 

 

https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Quest_Loose_Ends

Posted

I think I'll first just try with an AI package and see how it goes. Scripts isn't my thing at all. I suck bigtime at it :D. I'll look into it off course, maybe some lights will show up in a tunnel, but meh....

Posted
1 hour ago, Thor2000 said:

I think I'll first just try with an AI package and see how it goes. Scripts isn't my thing at all. I suck bigtime at it :D. I'll look into it off course, maybe some lights will show up in a tunnel, but meh....


 

Scriptname YourNPCQuestScript extends Quest

Actor property YourNPC auto

Event OnInit()
     RegisterForSingleUpdate(5.0)
EndEvent

Event OnUpdate()
     If self.IsRunning()
          YourNPC.Enable()
     EndIf
EndEvent

 

Set up the quest to start with the story manager whenever the conditions are met.  Attach this script to the quest.  Fill the one and only property with your actor reference.

 

Script will start (OnInit()) when the quest starts, but this tends to throw a false positive, so instead of just doing its thing, it registers for an update in 5 seconds.

 

In 5 seconds (after the game has its shit sorted out), it updates and checks to see if the quest the script is attached to (self) is actually running (self.IsRunning()).  If so, then it enables the NPC.

 

Honestly this would be half as complicated if the engine were better, but /shrug.

 

If you have trouble compiling, just tell me what the actual quest and NPC end up being named, and I'll compile it and post it for you.

Posted
14 hours ago, Seijin8 said:


 

Scriptname YourNPCQuestScript extends Quest

Actor property YourNPC auto

Event OnInit()
     RegisterForSingleUpdate(5.0)
EndEvent

Event OnUpdate()
     If self.IsRunning()
          YourNPC.Enable()
     EndIf
EndEvent

 

Set up the quest to start with the story manager whenever the conditions are met.  Attach this script to the quest.  Fill the one and only property with your actor reference.

 

Script will start (OnInit()) when the quest starts, but this tends to throw a false positive, so instead of just doing its thing, it registers for an update in 5 seconds.

 

In 5 seconds (after the game has its shit sorted out), it updates and checks to see if the quest the script is attached to (self) is actually running (self.IsRunning()).  If so, then it enables the NPC.

 

Honestly this would be half as complicated if the engine were better, but /shrug.

 

If you have trouble compiling, just tell me what the actual quest and NPC end up being named, and I'll compile it and post it for you.

Thank you for this. I will look into it when I start with this. The script compiling I believe I can get working myself since I've done that before. But where to place the conditions I don't know.

 

Just for the sake of it, what I'm trying to achieve is to have 7-8 drowners hidden away in a cell somewhere and when it starts raining where the player is a script/AI package will trigger and place them at a marker. I guess I need some other cell specific conditions too so that this won't happen everywhere in Tamriel, but only a few selected cells where there is lakes.

 

Posted
1 hour ago, Thor2000 said:

Just for the sake of it, what I'm trying to achieve is to have 7-8 drowners hidden away in a cell somewhere and when it starts raining where the player is a script/AI package will trigger and place them at a marker. I guess I need some other cell specific conditions too so that this won't happen everywhere in Tamriel, but only a few selected cells where there is lakes.

 

Note: I haven't had my morning coffee yet, so there may be better ways of doing this that I haven't yet thought of...

 

If you are looking to detect weather, you may need a constantly-running effect on the player.  It doesn't have to be intrusive.

 

  • This could be a spell that periodically gets applied to the player.
  • The conditions for the magic effect attached to the spell could check for the conditions you need (likely IsRaining and IsCloudy, but not IsSnowing)
  • Location keywords can rule out places this shouldn't happen (LocTypeHabitation, LocTypeSettlement, LocTypePlayerHome, LocTypeCity, etc)
  • If all these checks are passed, the active effect brings the creatures to you
  • This could be a "PlaceAtMe" type command, which would create them from scratch as needed instead of "storing" them somewhere, and also solves the issue of storing dead ones or needing to resurrect them from time to time.

 

So, for this to work, you would need a spell effect that gets put on the player, probably using a quest.  The quest script would run every two or three minutes and if the player is not in combat, add the spell.  Upon adding the spell, the conditions on the spell would determine if it worked or the conditions weren't met.

 

If met, then you would need the drowners to appear.  That part is a little tricky, since they're just going to "pop-in".  You may need some kind of "summoning" effect or something to obscure them.  You would likely want the resulting spell script to drop a marker behind the player (so they're out of sight) and then spawn them on the marker.  Instead of a batch of 7-8, it could do the drop-spawn thing several times.

 

So the code for a single drop might look like this:

Marker.MoveTo(PlayerRef, -500.0 * Math.Sin(PlayerRef.GetAngleZ()), -500.0 * Math.Cos(PlayerRef.GetAngleZ()), 50) ;; this will drop a previously defined marker 500 units behind the player and slightly above to account for terrain variation.

ActorBase abDrowner = Drowner.GetBaseObject() as ActorBase ;; gets the specific type needed by the next function

Marker.PlaceActorAtMe(abDrowner) ;; plops a drowner down where the marker is, 500 units behind the player and slightly above them

 

This loop would repeat 7-8 times.

 

A different way to do this might be to have the spell constantly plopping the marker down where the player is and wait 30 seconds, then check the distance between marker and player.  If the distance is far enough and the weather is still right, then it checks for line of sight or heading to the player to make sure the player isn't looking at the marker, then PlaceActorAtMe 7-8 times to get the drowners to show up.  It could also transition the weather to dense fog right before this happens to add to the difficulty of seeing them.

 

Anyway, all totally doable, just a matter of working out the mechanics of it.

Posted
On 3/7/2022 at 12:58 PM, Seijin8 said:

Anyway, all totally doable, just a matter of working out the mechanics of it.

 

I admit that this may be more complicated for me to do than I first thought. I'll see if I can just make something more simple in the start and from there just expand it as I learn new things.

 

I'll keep track on this thread since ut holds lots of useful information. Thank you Seijin8.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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