Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better head pics of kids, Hide UI , Option NonNude #19

Merged
merged 4 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Compiled scripts
Data/Scripts

Muriel-Salvan marked this conversation as resolved.
Show resolved Hide resolved

# Packaged artefact
AutoTest.7z

# Generated README for NexusMods
README.bbcode
build.cmd
Muriel-Salvan marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 1.2.0

## Features

* [NPCs] Added option to take NPC full body screen shots with default outfits.
* [NPCsHead] Added some scripting to take better headshots of child NPCs.
* [NPCsHead] [NPCs] Hide UI while taking screenshots.
* [NPCsHead] [NPCs] Added code to make sure player is in 1stPerson View.

# 1.1.0

## Features
Expand Down
Binary file added Data/Scripts/AutoTest_InGameMenu.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_Log.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_OnLoadAliasScript.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_OnLoadQuestScript.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_Suite.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_Suite_Locations.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_Suite_NPCs.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_Suite_NPCsHead.pex
Binary file not shown.
Binary file added Data/Scripts/AutoTest_TestsRunner.pex
Binary file not shown.
27 changes: 26 additions & 1 deletion Data/Source/Scripts/AutoTest_Suite_NPCs.psc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ endFunction
; Prepare the runs of tests
; [API] This function is optional
function BeforeTestsRun()
; TODO: get PC Scale
ConsoleUtil.ExecuteCommand("tgm")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tai")
; TODO disable UI
ConsoleUtil.ExecuteCommand("tm")
Muriel-Salvan marked this conversation as resolved.
Show resolved Hide resolved
endFunction

; Run a given registered test.
Expand All @@ -41,6 +44,7 @@ endFunction
; * *testName* (string): The test name to run
function RunTest(string testName)
string[] fields = StringUtil.Split(testName, "/")

int formId = 0
if (StringUtil.SubString(fields[1], 0, 2) == "0x")
formId = HexToInt(StringUtil.SubString(fields[1], 2))
Expand All @@ -54,9 +58,12 @@ endFunction
; Finalize the runs of tests
; [API] This function is optional
function AfterTestsRun()
; TODO: set PC Scale
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tgm")
; TODO enable UI
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a TODO anymore: you just implemented it :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, didn't clean up all the TODOs

ConsoleUtil.ExecuteCommand("tm")
endFunction

; Register a screenshot test of a given BaseID
Expand All @@ -74,20 +81,38 @@ endFunction
; * *baseId* (Integer): The BaseID to clone and take screenshot
; * *espName* (String): The name of the ESP containing this base ID
function ScreenshotOf(int baseId, string espName)

int formId = baseId + Game.GetModByName(espName) * 16777216
Form formToSpawn = Game.GetFormFromFile(formId, espName)
string formName = formToSpawn.GetName()
Log("[ " + espName + "/" + baseId + " ] - [ Start ] - Take screenshot of FormID 0x" + formId + " (" + formName + ")")
Game.GetPlayer().MoveTo(ViewPointAnchor)
ObjectReference newRef = TeleportAnchor.PlaceAtMe(formToSpawn)
newRef.RemoveAllItems()
; TODO: Add option for clothes here

string nonNudeNPC = GetConfig("non_nude")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition! Love it.

if nonNudeNPC != "true"
nonNudeNPC = "false"
endIf

if nonNudeNPC == "false"
newRef.RemoveAllItems()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can put the newRef.RemoveAllItems() directly in the previous if, without explicitely setting nonNudeNPC to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

endIf

; Wait for the 3D model to be loaded
while (!newRef.Is3DLoaded())
Utility.wait(0.2)
endWhile
Utility.wait(1.0)

; ensure PC 1st party view (summoning some NPCs seem to change POV)
Game.ForceFirstPerson()
Muriel-Salvan marked this conversation as resolved.
Show resolved Hide resolved
; TODO: ensure PC is looking at NPC

; Print Screen
; TODO: grab PrintScreen key from Config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So true. Thanks for the TODO :D

Input.TapKey(183)
; TODO: Rename/Relocate Screenshots
; Remove the reference
newRef.DisableNoWait()
newRef.Delete()
Expand Down
59 changes: 59 additions & 0 deletions Data/Source/Scripts/AutoTest_Suite_NPCsHead.psc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Scriptname AutoTest_Suite_NPCsHead extends AutoTest_Suite_NPCs
}

float gPreviousFov = 65.0
float gPreviousScale = 1.0

; Initialize the script
; [API] This function is mandatory and has to use SetTestType
Expand All @@ -20,19 +21,25 @@ endFunction
function BeforeTestsRun()
; Get the fov value so that we can reset it at the end of the tests run
gPreviousFov = Utility.GetINIFloat("fDefault1stPersonFOV:Display")
gPreviousScale = Game.GetPlayer().GetScale()
ConsoleUtil.ExecuteCommand("tgm")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("fov 20")
; Disable UI
ConsoleUtil.ExecuteCommand("tm")
endFunction

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

; Register a screenshot test of a given BaseID
Expand All @@ -43,3 +50,55 @@ endFunction
function RegisterScreenshotOf(int baseId, string espName)
RegisterNewTest(espName + "/" + baseId)
endFunction

; Customize ScreenShot function for better child handling.
function ScreenshotOf(int baseId, string espName)

float NPCScale = 1.0
float PlayerScale = 1.0
float PlayerFOV = 10

int formId = baseId + Game.GetModByName(espName) * 16777216
Form formToSpawn = Game.GetFormFromFile(formId, espName)
string formName = formToSpawn.GetName()
Log("[ " + espName + "/" + baseId + " ] - [ Start ] - Take screenshot of FormID 0x" + formId + " (" + formName + ")")
Game.GetPlayer().MoveTo(ViewPointAnchor)
ObjectReference newRef = TeleportAnchor.PlaceAtMe(formToSpawn)
; TODO: Add option for clothes here
newRef.RemoveAllItems()
; Wait for the 3D model to be loaded

while (!newRef.Is3DLoaded())
Utility.wait(0.2)
endWhile
Utility.wait(1.0)

; get NPC Scale
NPCScale = newRef.GetScale()
; Log("NPC Scale " + NPCScale)
; set PC Scale
ConsoleUtil.ExecuteCommand("player.setscale " + (NPCScale - 0.02))
Muriel-Salvan marked this conversation as resolved.
Show resolved Hide resolved
PlayerScale = Game.GetPlayer().GetScale()
; Log("Player Scale " + PlayerScale)
; Set FOV based on scale. Note: may still need tweaking
if PlayerScale >= 0.7
PlayerFOV = 15
endIf
if PlayerScale >= 1
PlayerFOV = 20
endIf
ConsoleUtil.ExecuteCommand("fov " + PlayerFOV)
; ensure PC 1st party view
Game.ForceFirstPerson()
; TODO: ensure PC is looking at NPC

; Print Screen
; TODO: grab PrintScreen key from Config
Input.TapKey(183)
; TODO: Rename/Relocate Screenshots
; Remove the reference
newRef.DisableNoWait()
newRef.Delete()
newRef = None
Log("[ " + espName + "/" + baseId + " ] - [ OK ] - Take screenshot of FormID 0x" + formId + " (" + formName + ")")
endFunction
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ A test run will:
2. Disable Combat AI, so that NPCs should not attack player.
3. Disable Non-combat AI, so that NPCs should not initiate actions.
4. Teleport the player to the test cell `AutoTest_TestHall`.
5. Summon a copy of the NPC to be tested in front of him, without any inventory.
5. Summon a copy of the NPC to be tested in front of him, without any inventory. (Configurable through the 'Config' file, see below)
6. Take a screenshot.

Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPCs_Run.json`:
Expand All @@ -171,6 +171,17 @@ Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPC
]
}
}

The `NPCs` tests can be configurable and accepts the following configuration options:
* `non_nude`: true or false taken by the test to determine if NPCs are unclothed during ScreenShots. Defaults to `"false"`.

Example of Config file for this tests suite, setting the non_nude value to "true"s, in `SKSE\Plugins\StorageUtilData\AutoTest_NPCs_Config.json`:
```json
{
"string": {
"non_nude": "true"
}
}
```

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