oldrayzor Posted July 12, 2018 Posted July 12, 2018 New to scripting in Skyrim LE and would appreciate some guidance. I've created a simple mod that outfits specific NPCs (wives, followers, etc) with loose files. The outfits were created in CK and the defaults were implemented through TES5Edit but I wish to try using a script to equip the new default outfits and load their contents into the NPC's inventory. After some research, i concocted the following script: Spoiler Scriptname DebutOutfitterWives Hidden Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property MyArmorRef Auto Formlist Property myNPCList Auto Formlist property myOutfitList Auto Event OnInit() Int NPCCnt = myNPCList.GetSize() while NPCCnt NPCCnt -=1 akActorRef = myNPCList.GetAt(NPCCnt) as ACTOR akActorRef.SetOutfit (NullOutfit) DebutOutfit = myOutfitList.GetAt(NPCCnt) as Outfit akActorRef.SetOutfit (DebutOutfit) Int ArmorCnt = DebutOutfit.GetSize() while ArmorCnt ArmorCnt -=1 myArmorRef = debutOutfit.GetAt(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) EndWhile EndWhile EndEvent In CK I created a hidden quest (start game enabled, run once) and added the script with attached Formlist properties (myNPCList, myOutfitList). The compile failed. I honestly don't know if you can nest WHILE statements, couldn't find any examples. Also, don't really know how to implement a hidden quest for the express purpose of initializing a script. Would be grateful for any assistance.
Guest Posted July 12, 2018 Posted July 12, 2018 At a first look the code seems to be good. Try again to compile, and then post the errors that will be put at the bottom of the compilation window. Yes, you can nest "while"
Andy14 Posted July 12, 2018 Posted July 12, 2018 To make it clearer: Script name DebutOutfitterWives Hidden extends which_quest
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 1 hour ago, CPU said: Try again to compile, and then post the errors that will be put at the bottom of the compilation window. Spoiler Starting 1 compile threads for 1 files... Compiling "DebutOutfitterWives"... C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(15,2): variable akActorRef is undefined C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(15,2): type mismatch while assigning to a none (cast missing or types unrelated) C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(16,2): variable akActorRef is undefined C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(16,13): none is not a known user-defined type C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(18,2): variable akActorRef is undefined C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(18,13): none is not a known user-defined type C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(20,29): GetSize is not a function or does not exist C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(20,6): type mismatch while assigning to a int (cast missing or types unrelated) C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(24,28): GetAt is not a function or does not exist C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(24,44): cannot cast a none to a armor, types are incompatible C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(25,3): variable akActorRef is undefined C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(25,14): none is not a known user-defined type No output generated for DebutOutfitterWives, compilation failed. I thought Getsize and GetAt were the function for Formlists. Should I be using "GetNumParts" and "GetNthPart"?
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 1 hour ago, Andy14 said: To make it clearer: Script name DebutOutfitterWives Hidden extends which_quest Ah, so should be "Script name DebutOutfitterWives Hidden extends [Quest ID]". Which is "DebutOutfitterWivesInit". Okay. Thank you!
Guest Posted July 12, 2018 Posted July 12, 2018 5 minutes ago, oldrayzor said: Ah, so should be "Script name DebutOutfitterWives Hidden extends [Quest ID]". Which is "DebutOutfitterWivesInit". Okay. Thank you! Not really. Scriptname DebutOutfitterWives Hidden Extend Quest Literally.
Guest Posted July 12, 2018 Posted July 12, 2018 Then replace the line akActorRef = myNPCList.GetAt(NPCCnt) as ACTOR with Actor akActorRef = myNPCList.GetAt(NPCCnt) as ACTOR
Andy14 Posted July 12, 2018 Posted July 12, 2018 6 minutes ago, oldrayzor said: Ah, so should be "Script name DebutOutfitterWives Hidden extends [Quest ID]". Which is "DebutOutfitterWivesInit". Okay. Thank you! What should be initiated? Or where are the properties? Usually (not always) of quests, magic effects, actor scripts in packages, etc. It is not "independent".
Andy14 Posted July 12, 2018 Posted July 12, 2018 3 minutes ago, CPU said: Not really. Scriptname DebutOutfitterWives Hidden Extend Quest Literally. Right
Tyrant99 Posted July 12, 2018 Posted July 12, 2018 You don't have any logic on the while lines, all you're saying is 'while .getsize()', which doesn't compare anything logically. You've defined it as an integer, so you have to give it some logic to run on the integer. For instance: While NPCCnt > 0
Guest Posted July 12, 2018 Posted July 12, 2018 7 minutes ago, Tyrant99 said: You don't have any logic on the while lines, all you're saying is 'while .getsize()', which doesn't compare anything logically. You've defined it as an integer, so you have to give it some logic to run on the integer. For instance: While NPCCnt > 0 While NPCCnt > 0 can be safely written as While NPCCnt in Papyrus (and according to my tests done long time ago, it is slightly better in performance.)
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 2 hours ago, Andy14 said: Scriptname DebutOutfitterWives Hidden Extend Quest Okay. Worked much better but I didn't create the quest properly I suspect. Do I need to add a stage? Script: Spoiler Scriptname DebutOutfitterWives Hidden Extend Quest FormList Property myNPCList Auto FormList Property myOutfitList Auto Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property MyArmorRef Auto Event OnInit() Int NPCCnt = myNPCList.GetSize() while NPCCnt NPCCnt -=1 ACTOR akActorRef = myNPCList.GetAt(NPCCnt) as ACTOR akActorRef.SetOutfit (NullOutfit) DebutOutfit = myOutfitList.GetAt(NPCCnt) as Outfit akActorRef.SetOutfit (DebutOutfit) Int ArmorCnt = DebutOutfit.GetSize() while ArmorCnt ArmorCnt -=1 myArmorRef = debutOutfit.GetAt(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) EndWhile EndWhile EndEvent Compiler: Spoiler Starting 1 compile threads for 1 files... Compiling "DebutOutfitterWives"... C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(1,0): Unknown user flag Extend C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(1,0): Unknown user flag Quest No output generated for DebutOutfitterWives, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on DebutOutfitterWives
Andy14 Posted July 12, 2018 Posted July 12, 2018 There is not much information available. No conditions - it can also be dogs etc. A dog in ... That's why I do not really want to go into the script. It was all about the compilation, not the meaning of these loops. The actual question is. What do you want to achieve? How many NPC are there - or is it indefinite? Maybe it is completely possible without a script?
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 2 hours ago, Tyrant99 said: While NPCCnt > 0 I would have thought as well but found many examples of this use (even on ck dot com).
Andy14 Posted July 12, 2018 Posted July 12, 2018 Realy? EXTENDS Scriptname DebutOutfitterWives Hidden Extends Quest No one could have guessed that you copy everything - so Sorry. That was an answer to your output from Compiler.
Guest Posted July 12, 2018 Posted July 12, 2018 4 minutes ago, Andy14 said: Realy?;) EXTENDS Good catch. If I remember correctly "hidden" should be the last one. Another point, you are doing it only in the OnInit, so it will work only the very first time. Better if you put your code in a function (function setoutfits(), for example) and call it inside the OnInit. Then add a ReferenceAlias to the quest, set it to the player, add a script to it and add that inside: Event OnPlayerloadGame() (getOwningQuest() as DebutOutfitterWives).setOutfits() EndEvent With that it will work also next time you will load the game.
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 1 hour ago, Andy14 said: There is not much information available. No conditions - it can also be dogs etc. A dog in ... That's why I do not really want to go into the script. It was all about the compilation, not the meaning of these loops. The actual question is. What do you want to achieve? How many NPC are there - or is it indefinite? Maybe it is completely possible without a script? Sure. The interest is to create loose outfit files for specific NPCs (grouped as Followers, Wives, Bards. etc) which are worn on DEBUT (at first appearance) and can be implemented without the use of Tes5Edit or CK. I have created these already which include the outfit sets but of course I must go into every NPC replacer (Bijin Warmaidens, Wives, Ordinary Women, etc.) and transfer to inventory and set default outfit. If I want to change an NPC replacer then I have to do it all again and I have many replacers. SO - If I use a script I can replace NPCS and outfits at my leisure and they will still equip. I started the project because I was fussing too much with in-game outfitting and simply wanted my characters to HAVE the outfits,.
Andy14 Posted July 12, 2018 Posted July 12, 2018 Just now, oldrayzor said: Sure. The interest is to create loose outfit files for specific NPCs (grouped as Followers, Wives, Bards. etc) which are worn on DEBUT (at first appearance) and can be implemented without the use of Tes5Edit or CK. I have created these already which include the outfit sets but of course I must go into every NPC replacer (Bijin Warmaidens, Wives, Ordinary Women, etc.) and transfer to inventory and set default outfit. If I want to change an NPC replacer then I have to do it all again and I have many replacers. SO - If I use a script I can replace NPCS and outfits at my leisure and they will still equip. I started the project because I was fussing too much with in-game outfitting and simply wanted my characters to HAVE the outfits,. I was just asking, because many people only see the path with script instead of the obvious one. Alright then - then much success with your project.?
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 Compiler result when using "Scriptname DebutOutfitterWives Hidden Extends Quest" Spoiler Starting 1 compile threads for 1 files... Compiling "DebutOutfitterWives"... C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(1,38): required (...)+ loop did not match anything at input 'Extends' No output generated for DebutOutfitterWives, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on DebutOutfitterWives Compiler result when using "Scriptname DebutOutfitterWives Extends Quest Hidden " Spoiler Starting 1 compile threads for 1 files... Compiling "DebutOutfitterWives"... C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(20,29): GetSize is not a function or does not exist C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(20,6): type mismatch while assigning to a int (cast missing or types unrelated) C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(24,28): GetAt is not a function or does not exist C:\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\DebutOutfitterWives.psc(24,44): cannot cast a none to a armor, types are incompatible No output generated for DebutOutfitterWives, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on DebutOutfitterWives 2 hours ago, CPU said: Another point, you are doing it only in the OnInit, so it will work only the very first time. It probably won't overwrite saved changes to the outfits but, if it saves the default changes with the file then I don't suspect I need to do a load game function. Do you still think I should?
Tyrant99 Posted July 12, 2018 Posted July 12, 2018 52 minutes ago, oldrayzor said: I would have thought as well but found many examples of this use (even on ck dot com). Interesting that it evaluates that way, I've always had a style of avoiding ambiguity, but if it works, that's cool. I think you have an issue with these lines: Outfit Property DebutOutfit Auto Int ArmorCnt = DebutOutfit.GetSize() myArmorRef = debutOutfit.GetAt(ArmorCnt) as Armor GetSize() and GetAt() are functions for FormLists and you're trying to use them on Outfits.
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 2 hours ago, Tyrant99 said: GetSize() and GetAt() are functions for FormLists and you're trying to use them on Outfits. Oh yeah, you're right. What was I thinking? Replaced with GetNumParts() and GetNthPart(int) respectively but ended with error "GetNumParts is not a function or does not exist". Those are the functions for outfits, yes?
Guest Posted July 12, 2018 Posted July 12, 2018 Grab the SKSE files, get the scripts/sources/ folder, inside you have all valid functions for outfits and formlists. Hidden should be the last, I was remembering correctly. But looks like there is a miss match on your code somewhere. Post the last version you have again, please.
oldrayzor Posted July 12, 2018 Author Posted July 12, 2018 1 hour ago, CPU said: Post the last version you have again, please. Thank you. Scriptname DebutOutfitterWives Extends Quest Hidden FormList Property myNPCList Auto FormList Property myOutfitList Auto Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property MyArmorRef Auto Event OnInit() Int NPCCnt = myNPCList.GetSize() while NPCCnt NPCCnt -=1 ACTOR akActorRef = myNPCList.GetAt(NPCCnt) as ACTOR akActorRef.SetOutfit (NullOutfit) DebutOutfit = myOutfitList.GetAt(NPCCnt) as Outfit akActorRef.SetOutfit (DebutOutfit) Int ArmorCnt = DebutOutfit.GetNumParts() while ArmorCnt ArmorCnt -=1 myArmorRef = debutOutfit.GetNthPart(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) EndWhile EndWhile EndEvent
Tyrant99 Posted July 12, 2018 Posted July 12, 2018 That should compile fine if you have the SKSE source files.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.