Clearable Exteriors
Hello landscapers!
Morrowind uses unique NPCs in almost every location. Unique NPCs do not respawn, so this means that after the player has cleared out location, it will be empty for the rest of the game. This guide shows you how to set up these types of locations to add in creature spawners after the location has been cleared. This guide assumes you have already set up the location for what you want it to look like before & after.
You can visit the cell WETestGrazelands in the WETestWorld wordlspace for an example of this method.
Step 1
First, you will need to create a quest for your location. Do this by finding the fbmw_Enc_ClearedLocationTemplate and duplicating it. Rename your new quest to fbmw_Enc_Cleared[LocationName].
Step 2
Open up your location in the Render Window, and place an XMarker. This XMarker will serve as the "enable parent" that lets you enable or disable things based on whether the area has been cleared. If you need a reminder on how to set Enable Parents, see the Coding Basics for Landscapers page.
If something should exist before the location is cleared and get disabled after, set that reference to have the XMarker as it's Enable Parent (left). If something should only exist after the location is cleared, set that reference to have the XMarker as it's Enable Parent and select the "Set Enable State to Opposite of Parent".
Step 3
Next, we need to set up some script properties. Again, if you need a refresher on this, reread the Coding Basics for Landscapers page.
Open the quest, navigate to the Scripts tab, select the fbmw_ClearedLocationQuestScript, and then click properties. There are 4 properties for you to fill out:
myEnableMarker: Fill this property with the XMarker you placed and set up as an enable parent. Select the property, then click "Edit Value", click "Pick Reference in Render Window", and then double-click on the marker you placed earlier.
npcCount: This property tells the script how many NPCs the player must kill at this location for it to register as "cleared". Select the property, click "Edit Value", and enter the number of NPCs at this location.
3. PlayerRef: This is just the player. Select the property, then click the "Auto-Fill" button. (This property might already be filled.)
4. waitTime: This is how much time must pass (in hours) before the location changes its state. The default is 72 hours. If that's what you want, then you don't have to do anything. If you want it to be something different, then select the property, click "Edit Value", and enter the new numbe of hours.
Step 4
Now we need to add all the NPCs as "Aliases" to the quest. This is a way for the Creation Engine to track the NPCs without needing to keep them loaded in-game.
Navigate to the "Quest Aliases" tab. You should already see some Aliases filled out with dummy NPCs. What you need to do is:
Duplicate or remove the existing aliases until you have enough for your location. For example, the template has 3 aliases to start. If you need 4, then duplicate one. If you need 2, the delete one.
Go through each alias and selector the NPCs at your location from the "Unique Actor" drop-down list. Make sure you get all of them, and make sure you don't have any repeats.
Verify that each alias has the "fbmw_ClearedLocationAliasScript" attached. If it does, click "Add" under the "Papyrus Scripts" section and find this script.
Step 5
The final step is ensuring that this quest will start once the player is close to the location. This is done through the "Story Manager". KM or another coder will take care of this fore you once your quest is merged, because multiple people working on the story manager could cause merge conflicts. So, you don't have to worry about this step.
Note: If you want to test your quest before it gets merged and added to the story manager, use the console in-game to start the quest. Use the command:
setstage fbmw_Enc_Cleared[LocationName] 0
Testing
Once your quest is set up, you can test it as follows:
Start your quest through the console if it hasn't been merged & added to the story manager.
Travel to the location and kill the NPCs there.
Wait the amount of time you specified on the WaitTime property.
Travel far away from the location. It won't update if the player is nearby! You need to either travel far enough away that the cell unloads, or to a different interior or worldspace.
Return to the location. The environment should now have changed!