xEthann Posted August 1, 2020 Share Posted August 1, 2020 (Reposting here as it seems a more appropriate place) So I am trying to create a script that resets an NPCs outfit back to its default state. A previous script (which works perfectly) Uses the SetOutfit() function to make the NPC wear a ragged outfit and is triggeed with dialogue Now I am trying to create a script that will reverse this (also triggered with dialogue) however when I try to compile it, I get the error saying GetOutfit() does not exist. Now, I have installed SKSE and plugins such as SkyUI work fine. I have also ensured that both the pex and psc files have been copied and replaced in both the data\scripts\source and data\source\scripts folders (Note: I am playing Skyrim Special Edition) Here is the script sample: (WhiterunBeggar01 is a quest alias which can be filled by any unique NPC in a different script triggered by dialogue) if akSpeaker as objectreference == WhiterunBeggar01.GetReference() WhiterunBeggar01.clear() akSpeaker.SetOutfit(akSpeaker.GetOutfit())My thinking is that since the GetOutfit() function returns the default outfit for the actors BaseID (I might be wrong on that) then the end result will be that the NPC gets its default outfit back and no longer looks like a beggar. However when I try to compile this code, Im given the following error Starting 1 compile threads for 1 files... Compiling "TIF__01002DCD"... G:\Games\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\TIF__01002DCD.psc(12,30): GetOutfit is not a function or does not exist No output generated for TIF__01002DCD, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on TIF__01002DCDI have also tried to have a script that is simply akSpeaker.GetOutfit() just to test but it still refuses to compile with the same error. Is the error to do with my SKSE installation or am I perhaps using the GetOutfit function in the wrong context. Or, can anyone offer me an alternative to resetting an NPCs outfit? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 1, 2020 Share Posted August 1, 2020 SetOutfit and GetOutfit are ActorBase functions. This means that they need to be ran with the NPCs ActorBase. Example:(akSpeaker as Actor).GetActorBase().GetOutFit() But running GetOutFit after having used SetOutFit will return the new outfit and not the original outfit. This is because SetOutFit replaces the default outfit. If you need to know the original outfit, then it will need to be stored to a variable prior to changing the outfit with SetOutfit. Link to comment Share on other sites More sharing options...
xEthann Posted August 1, 2020 Author Share Posted August 1, 2020 Ahh Thank you so much! I'm glad to know my SKSE works correctly and that I just made a rookie mistake. I had a feeling a variable would have to come into play somehow but I am very new to using the creation kit and Papyrus - I started about a week ago and this is my first project. I'm going to assume that I'd need to create a variable to store the original outfit in the script that uses the SetOutfit() function however I am unsure on how to define variables in Papyrus or how I would be able to call that variable in a different script. I haven't actually used variables in Papyrus before - just properties Do you know how I would set up the scope of the variable so I can use it in multiple scripts? Thanks again for the quick reply and your help :) Link to comment Share on other sites More sharing options...
foamyesque Posted August 1, 2020 Share Posted August 1, 2020 SetOutfit and GetOutfit are ActorBase functions. This means that they need to be ran with the NPCs ActorBase. Example:(akSpeaker as Actor).GetActorBase().GetOutFit() But running GetOutFit after having used SetOutFit will return the new outfit and not the original outfit. This is because SetOutFit replaces the default outfit. If you need to know the original outfit, then it will need to be stored to a variable prior to changing the outfit with SetOutfit.There is also a SetOutfit() Actor function, though it lacks a corresponding one for GetOutfit(), which is why the SetOutfit side of things worked. How that interacts with the GetOutfit() ActorBase function, I have not tested. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 1, 2020 Share Posted August 1, 2020 Ahh Thank you so much! I'm glad to know my SKSE works correctly and that I just made a rookie mistake. I had a feeling a variable would have to come into play somehow but I am very new to using the creation kit and Papyrus - I started about a week ago and this is my first project. I'm going to assume that I'd need to create a variable to store the original outfit in the script that uses the SetOutfit() function however I am unsure on how to define variables in Papyrus or how I would be able to call that variable in a different script. I haven't actually used variables in Papyrus before - just properties Do you know how I would set up the scope of the variable so I can use it in multiple scripts? Thanks again for the quick reply and your help :smile:See if this wiki page helps you figure out how to access property variables on one script from other scripts: https://www.creationkit.com/index.php?title=Variables_and_Properties_(Papyrus)#Getting_Properties_From_Any_Other_Script Link to comment Share on other sites More sharing options...
Recommended Posts