Jump to content

[LE] Change Outfit at end of Quest for NPC


Exoclyps

Recommended Posts

So I started messing with a mod that replaces a few NPC's outfits to give a better theme to the faction. However one of the NPC's joins the faction after a quest is finished and thus changing their clothes beforehand is something I'd like to avoid.

 

I googled around and figured it'd be possible to have an NPC change outfit with a quest, but I have no idea how this is done as I've yet to do anything quest/script related besides modding some property names in scripts.

 

So my question is, how would I do so that the game checks for a certain quest to be done and then have the NPC of choice change outfit?

Thanks in advance

Link to comment
Share on other sites

Here is what I envision as the steps you need for doing this:

 

First: Find the quest you want to check for being finished (I.E. DLC1MQ01)

Second: In your script have the quest as a Quest Property

Third: Have your outfit as an Outfit Property

Fourth: Have your NPC as an Actor Propety (might not need if you attach the script to the NPC)

Fifth: Decide on an attachment point for your script. I personally think your NPC will be the appropriate place for the script based on the current information, although there are other ways to do it.

 

Here is an implementation I see, going to run with DLC1MQ01 as the example (forgive me if that is not the exact name of that quest):

 

 

Scriptname EXOCNpcOutfitChangeAfterQuestScript extends Actor

;The quest we are listening for
Quest Property DLC1MQ01 Auto

;The faction outfit you want to give
Outfit Property EXOCNpcFactionOutfit Auto

;The Actor NPC you are giving the outfit to
Actor Property EXOCNpcToAdd Auto

Event OnInit()
	;Register for an update event game time for every 2 min in-game
	;A lot faster than waiting for real-time updates
	RegisterForSingleUpdateGameTime(0.03)
EndEvent

Event OnUpdateGameTime()
	;Check to see if the quest is done via quest stages
	;Have no idea in this example if this is the right stage number...just approximating
	if (DLC1MQ01.GetStage >= 60)
		;Set our NPC outfit
		EXOCNpcToAdd.SetOutfit(EXOCNpcFactionOutfit)
	;In all other cases
	Else
		RegisterForSingleUpdateGameTime(0.03)
	EndIf	
EndEvent	

 

 

 

Note: It will change their outfit immediately once that quest is finished. So if you wanted to do this through NPC dialogue, you will need to call akSpeaker.SetOutfit(YourOutfit) in the End script fragment.

 

Hope this helps out.

Edited by Arron Dominion
Link to comment
Share on other sites

Thank you for your reply! Will check this out.

 

If I got this right, this script runs at start, automatically, then every 2 minutes check if the quest have been done?

While I appreciate this, I wonder if there is no way to say, edit said quest instead to run the script once it reached the last stage? Never been a fan of rotating scripts to be honest.

Link to comment
Share on other sites

Thank you for your reply! Will check this out.

 

If I got this right, this script runs at start, automatically, then every 2 minutes check if the quest have been done?

While I appreciate this, I wonder if there is no way to say, edit said quest instead to run the script once it reached the last stage? Never been a fan of rotating scripts to be honest.

 

 

To clarify it will run every 2 in-game minutes, and in real time much less.

 

It is definitely possible to change the outfit after a particular quest stage. Here are the steps for doing this (Note you will probably want to edit so you can reuse the script or reduce on properties):

 

1) Make sure you have a ReferenceAlias to your NPC

2) In your quest, there will be a Scripts tab.

3) Create a quest script with a ReferenceAlias property to your NPC and Outfit property to your outfit

4)Write a function that looks something like this:

 

 

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Inputs: None
;
;The purpose of this function is to set the NPC's outfit when the appropriate quest stage is called
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function SetFactionOutfit()
    EXOCNpcToAddRef.GetActorRef().SetOutfit(EXOCNpcFactionOutfit)
EndFunction

 

 

5) In your quest stage, set kmyQuest to this script. If you have another script in use for kmyQuest, you will want to remove your new script and add the changes to that script

6) Call the following in the quest stage script block:

 

 

 

kmyQuest.SetFactionOutfit()

 

 

 

That should be it for the basics, but again you probably want to redo for your mod's needs.

Link to comment
Share on other sites

  • 2 years later...

I'm trying to achieve the same effect in a script, I've attempted the first example resolution:


Scriptname EXOCNpcOutfitChangeAfterQuestScript extends Actor

;The quest we are listening for
Quest Property DLC1MQ01 Auto

;The faction outfit you want to give
Outfit Property EXOCNpcFactionOutfit Auto

;The Actor NPC you are giving the outfit to
Actor Property EXOCNpcToAdd Auto

Event OnInit()
    ;Register for an update event game time for every 2 min in-game
    ;A lot faster than waiting for real-time updates
    RegisterForSingleUpdateGameTime(0.03)
EndEvent

Event OnUpdateGameTime()
    ;Check to see if the quest is done via quest stages
    ;Have no idea in this example if this is the right stage number...just approximating
    if (DLC1MQ01.GetStage >= 60)
        ;Set our NPC outfit
        EXOCNpcToAdd.SetOutfit(EXOCNpcFactionOutfit)
    ;In all other cases
    Else
        RegisterForSingleUpdateGameTime(0.03)
    EndIf    
EndEvent



When attached to the NPC it simply gives errors on compilation:

Starting 1 compile threads for 1 files...
Compiling "CW_VignarClothes"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\CW_VignarClothes.psc(18,18): GetStage is not a property on script quest or one of its parents
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\CW_VignarClothes.psc(18,27): cannot compare a none to a int (cast missing or types unrelated)
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\CW_VignarClothes.psc(18,27): cannot relatively compare variables to None

 

No output generated for CW_VignarClothes, compilation failed.

Basically I can't get around that. I've also tried to sneak into an vanilla script to make the changes, all to no effect at all... I'm pretty confused because the way scripts work in this engine are quite illogical... It's a "can't do this can't do that" feast...

I'm also confused towards the second example... What on earth is that supposed to mean?

HALP PLOX!
Edited by Guest
Link to comment
Share on other sites

  • Recently Browsing   0 members

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