Jump to content

Help to attach a simple script on CK and make it work


Recommended Posts

Hello everyone,

 

Disregard the whole help request, the engine doesn't even render the right skin tone lol  😄 Useless fix.

 

 

I have troubles attaching a script function to something that could act as a 'engine fix' for one NPC mod I published.

I've never done that, I just began to understand the scripting language and mechanics, I have already a script written by LarannKiar to integrate it in a quest or something that fits (so the script will most probably work 😛).

So it's just the operational part to make it work that I can't figure out by myself with the wikis and my poor knowledge of almost everything.

Any help would be greatly appreciated !

 

Here's everything in details :

Custom NPCs phenotypes are now possible to create directly in Chargenmenu, by importing the generated .NPC files in the CK.

NPCs phenotypes have different postblend customization layers. These layers are not natively generated by the present Starfield engine when it comes to generated leveled NPCs like specialists.

This can be fixed by a simple refresh of the NPC skin, using the SetSkinTone command (sst X, with X=0-8 skin darkness)

 

The idea is to attach a script using the new Cassiopeia Papyrus Extender's GetSkinTone and SetSkinTone functions to something that could make it happen in game.

Here is the script written kindly by LarannKiar for this purpose :

Quote

Scriptname YOURSCRIPTNAME extends Quest Const

Race Property HumanRace Auto Const

Import CassiopeiaPapyrusExtender

Event OnQuestInit()
Actor[] HighProcessActors = GetHighActors()
If HighProcessActors.Length > 0
Int Index = HighProcessActors.Length - 1
While Index >= 0
Actor LoopActor = HighProcessActors[Index]
If LoopActor && LoopActor.GetRace() == HumanRace
Int SkinToneIndex = GetSkinTone(LoopActor)
If SkinToneIndex >= 0 && SkinToneIndex <= 8
SetSkinTone(LoopActor, SkinToneIndex)
EndIf
EndIf
Index = Index - 1
EndWhile
EndIf
EndEvent

The best option of attachment of this script could be an automatic event that happens when specialists spawn.

The main quest record managing generic crew appears to be this one :  CREW_GenericCrew (0026C4EA)

 

And that's where i'm lost and could'nt find the right tutorial to continue :

The script gets compiled in pex and is accessible to add as a papyrus fragment in the kmyQuest list

I tried to compile it alone, compile it with cassipoeia script psc, this 'works' (i get a pex), I tried to add a quest stage before the specialist persuasion challenge, tried various things but nothing gave results.

Other options seems to be adding the script to Leveled NPC LCharCrew_Any (0026F938)

One viable option is to add it to the Actor Crew_LvlCrew_Any but the script is incompatible, for a perfectly good reason that I don't know of course.

 

As you can see I really don't know what I'm doing, I mix up the concepts, and that's where naive impovisation ends.

 

Keeping in mind my inexistent knowledge on the matter, every element i have in hands, what should I do from here, what particular advice would you give me ?

I know it's a lot to ask, but if you have a little moment to teach me the way with some very quick simple explicit steps (or just the magic tutorial that explains everything for a humble beginner), I would be very grateful !

Cheers!

Link to comment
Share on other sites

The script should work, just tested on the custom AmazonCrew NPC you sent in PM recently. You can test the beta .esm and script I sent in a reply on other NPCs if you'd like. GetSkinTone should return the correct Skin Tone Index of templated NPCs. Verified this again on vanilla crew members and on the AmazonCrew NPC.

What is weird is that the default appearence (the buggy one, which has no makeup) of the AmazonCrew NPC is rendered with Skin Tone Index = 2 or 3 maybe but technically the NPC has Skin Tone Index = 1 in xEdit.

GetSkinTone returns 0 - 8 for the Skin Tone Index because this is how the engine maps it. (1 - 9 in the Creation Kit and xEdit). So, in theory, this NPC should have Skin Tone Index = 0 in the Papyrus log and if the makeup is applied.

  • Thanks 1
Link to comment
Share on other sites

Thanks for responding  and for the fix !

Your fix works perfectly on specialists spawn, and it persists through saves, that's just great 🙂

I sent you the details of 2 tests that should give you some more elements. The problems seems to concern specifically the character (or specialist) generation, after that everything is rendered perfectly even if the character was not affected by your scripted refresh.

Also your fix seems to solve any skintone problem, everything seems as intended to me. The skintone of the test specialist is indeed 0, and I tested with other high value skintone specialists (6) and the rendered result is precisely what it is meant to be.

 

 

Here are the detailed results of LarannKiar's NPC fix for anyone else interested :

 

Ok, so here are the results in Cydonia :

Test1 :

- After a direct capp between specialist NPCs, the postblend don't render on the target specialist, and they are revealed by a manual activation of the script CGF "GenericNPXMakeupFix:Quest.TestApplyFix"

- I stored the fully rendered specialist reference with prid command, moved to my ship outside, HasLoaded3D returned 1.0 and the moveto player command made the character appear with full 3d of course.  I flew to the New Atlantis system, HasLoaded3D returned 0.0, and moveto player made the fully rendered specialist appear.

 

Test 2 involving saves :

- I went to Cydonia again, copied a fully rendered specialist's phenotype (sp1) to another specialist(sp2). The capp has resulted in an absence of rendered postblend layers for the target NPC (sp2).

- I didn't refresh sp2's face with anything and left the place, I kept the two references, went to NA system in some random POI, not the city, went back in my ship.

- I saved the game.

- I loaded the game.

- I made appear sp1 and sp2 with the moveto command. Both had the postblend layers correctly rendered without the script running again if I understood the papyrus log correctly.

 

And here is the papyrus log that it produced :

01:47:57 in Cydonia

between 01:48 and 01:50 I used the capp command from sp1 to sp2 in Cydonia

01:50:10 arrived at the POI in Jemison, spawned outside the ship

01:51:36 enter in the ship

after 01:52, i used the moveto commands for the 2 specialists

SkippedCount [0] | sCaller [LoadingMenu|abOpening =false]
[01:47:57] TryToFixNearbyGenericNPCs: detected Cassiopeia Papyrus Extender version: 16
[01:47:57] TryToFixNearbyGenericNPCs: beginning loop for [80] HighActors.
[01:47:58] TryToFixNearbyGenericNPCs: applying fix on LoopActor [FF02F82E | Payload Specialist] (skin tone index: 0)
[01:48:02] TryToFixNearbyGenericNPCs: applying fix on LoopActor [FF02F82B | Particle Weapons Specialist] (skin tone index: 0)
[01:48:02] TryToFixNearbyGenericNPCs: applying fix on LoopActor [FF02F825 | Outpost Security Chief] (skin tone index: 0)
[01:48:02] TryToFixNearbyGenericNPCs: applying fix on LoopActor [FF02F828 | Energy Weapons Specialist] (skin tone index: 0)
[01:48:02] TryToFixNearbyGenericNPCs: finished loop for [80] HighActors | AppliedCount [4] | SkippedCount [0] | sCaller [LoadingMenu|abOpening =false]
[01:50:10] TryToFixNearbyGenericNPCs: detected Cassiopeia Papyrus Extender version: 16
[01:50:10] TryToFixNearbyGenericNPCs: beginning loop for [53] HighActors.
[01:50:12] TryToFixNearbyGenericNPCs: finished loop for [53] HighActors | AppliedCount [0] | SkippedCount [0] | sCaller [LoadingMenu|abOpening =false]
[01:51:36] TryToFixNearbyGenericNPCs: detected Cassiopeia Papyrus Extender version: 16
[01:51:36] TryToFixNearbyGenericNPCs: beginning loop for [76] HighActors.
[01:51:39] TryToFixNearbyGenericNPCs: finished loop for [76] HighActors | AppliedCount [0] | SkippedCount [0] | sCaller [LoadingMenu|abOpening =false]
[01:52:14] Log closed

How would you interpret this last result ? (perfect rendering of sp2 without any apparent script application on this character)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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