Skip to content

Commit

Permalink
Merge pull request #9 from Muriel-Salvan/add_npcs_head
Browse files Browse the repository at this point in the history
[Feature] Add NPCsHead tests suite to detect neck seams
  • Loading branch information
Muriel-Salvan authored Jan 18, 2021
2 parents 7a66819 + bf544b4 commit 5f9716e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 1 deletion.
Binary file modified Data/AutoTest.esp
Binary file not shown.
2 changes: 1 addition & 1 deletion Data/Source/Scripts/AutoTest_Suite_NPCs.psc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Scriptname AutoTest_Suite_NPCs extends AutoTest_Suite
{
Collection of script functions testing NPCs (using screenshots of nakes actors).
Collection of script functions testing NPCs (using screenshots of naked actors).
This helps in finding issues with missing textures, not fitting body types...
Dependencies:
* ConsoleUtil (https://www.nexusmods.com/skyrimspecialedition/mods/24858)
Expand Down
45 changes: 45 additions & 0 deletions Data/Source/Scripts/AutoTest_Suite_NPCsHead.psc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Scriptname AutoTest_Suite_NPCsHead extends AutoTest_Suite_NPCs
{
Collection of script functions testing NPCs head (using screenshots of naked actors).
This helps in finding issues with neck seams
Dependencies:
* ConsoleUtil (https://www.nexusmods.com/skyrimspecialedition/mods/24858)
* SKSE for StringUtil (https://skse.silverlock.org/)
}

int gPreviousFov = 90

; Initialize the script
; [API] This function is mandatory and has to use SetTestType
function InitTests()
SetTestType("NPCsHead")
endFunction

; Prepare the runs of tests
; [API] This function is optional
function BeforeTestsRun()
; Get the fov value so that we can reset it at the end of the tests run
gPreviousFov = Utility.GetINIFloat("fDefault1stPersonFOV:Display")
ConsoleUtil.ExecuteCommand("tgm")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("fov 20")
endFunction

; Finalize the runs of tests
; [API] This function is optional
function AfterTestsRun()
ConsoleUtil.ExecuteCommand("fov " + gPreviousFov)
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tgm")
endFunction

; Register a screenshot test of a given BaseID
;
; Parameters:
; * *baseId* (Integer): The BaseID to clone and take screenshot
; * *espName* (String): The name of the ESP containing this base ID
function RegisterScreenshotOf(int baseId, string espName)
RegisterNewTest(espName + "/" + baseId)
endFunction
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,39 @@ Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPC

![Example of NPCs test](https://raw.githubusercontent.com/Muriel-Salvan/AutoTest/master/docs/npcs_example.jpg)

#### NPCsHead

The `NPCsHead` tests suite will take screenshots of NPCs' head without any inventory.
This is especially useful to detect neck gaps.
Screenshots are taken in the usual game directory, the same way they are taken with the `PrintScreen` key.

The test names used by this suite have the following format: `esp_name/form_id`.
The `form_id` part can be given either directly as decimal, or hexadecimal (in this case it is prefixed with `0x`).
For example: `skyrim.esm/78433` or `skyrim.esm/0x00013261` for the NPC named Beirand in Skyrim Special Edition.

A test run will:
1. Put the player in god mode (as some NPCs can be hostile or knock the Player).
2. Disable Combat AI, so that NPCs should not attack player.
3. Disable Non-combat AI, so that NPCs should not initiate actions.
4. Change fov to 20 (as it is much easier to detect neck seams this way).
5. Teleport the player to the test cell `AutoTest_TestHall`.
6. Summon a copy of the NPC to be tested in front of him, without any inventory.
7. Take a screenshot.

Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPCsHead_Run.json`:
```json
{
"stringList": {
"tests_to_run": [
"skyrim.esm/78433",
"skyrim.esm/78434"
]
}
}
```

![Example of NPCsHead test](https://raw.githubusercontent.com/Muriel-Salvan/AutoTest/master/docs/npcshead_example.jpg)

#### Locations

The `Locations` tests suite will teleport the player to a given location and make a small camera circle around.
Expand Down

0 comments on commit 5f9716e

Please sign in to comment.