oldrayzor Posted February 19, 2019 Posted February 19, 2019 I have created a number of MODS for outfitting NPCS and rely on TES5Edit to change the npc's defaultoutfit settings. But I wrote a script which should do this automatically but I'm not experienced with quest creation and what information I have been using doesn't seem to work. For testing, I have been trying to fit a few npcs in solitude. Any help you could provide would be appreciated. Quest Setup: Spoiler Quest Data Provided ID & Name Left type as None Set priority to 60 Checked Start Game enabled and run once Quest Stages Set index to 10 "empty" Select "Start Up Satge" Quest Aliases Alias Name "PlayerRefAlias" Optional N, Type Ref Forced: PlayerRef (00000014) Scripts (See spoiler below) DebutOutfitter, Along with Prooperties settings for myNPCList and myOutfitList Script (includes 2 formlist properties. First, lists the NPC ids and 2nd, the npc-respective Outfit ids). Compiles without error. Spoiler Scriptname DebutOutfitter Extends Quest {Sets DefaultOutfit for listed NPCs} FormList Property myNPCList Auto FormList Property myOutfitList Auto Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property MyArmorRef Auto Event OnInit() SetDebutOutfits() EndEvent Function SetDebutOutfits() 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) akActorRef.equipItem (myArmorRef,0,TRUE) EndWhile EndWhile EndFunction
egon123 Posted February 19, 2019 Posted February 19, 2019 I don't think you need quest stages and the alias in that quest, since you don't use it. First, make sure that the quest starts. You checked the "start game enabled" but you also need to create an SEQ file. That file, from my understanding, basically tells the game which quest is "start game enabled". Yeah, I know.. :D You can easy do that via TES5Edit. Next, when something doesn't work, use Debug.Notification("Your Text") I do often do that when I try to find out why a script isn't execute correct. Best use an Utility.wait(1) before that to reduce the speed a bit. You can later take it out when the script works as it should. In your case: Spoiler Event OnInit() Debug.Notification("Quest Start") SetDebutOutfits() EndEvent Function SetDebutOutfits() Int NPCCnt = myNPCList.GetSize() Utility.wait(1) Debug.Notification("NPCCnt: " + NPCCnt) while NPCCnt Utility.wait(1) Debug.Notification("While. NPCLeft: " + 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 Utility.wait(1) Debug.Notification("While. Armor: " + ArmorCnt) ArmorCnt -=1 myArmorRef = debutOutfit.GetNthPart(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) akActorRef.equipItem (myArmorRef,0,TRUE) EndWhile EndWhile Utility.wait(1) Debug.Notification("Script Complete") EndFunction
Ruffled Pigeon Posted February 19, 2019 Posted February 19, 2019 On 2/19/2019 at 10:13 PM, egon123 said: I don't think you need quest stages and the alias in that quest, since you don't use it. First, make sure that the quest starts. You checked the "start game enabled" but you also need to create an SEQ file. That file, from my understanding, basically tells the game which quest is "start game enabled". Yeah, I know.. :D You can easy do that via TES5Edit. Next, when something doesn't work, use Debug.Notification("Your Text") I do often do that when I try to find out why a script isn't execute correct. Best use an Utility.wait(1) before that to reduce the speed a bit. You can later take it out when the script works as it should. In your case: Hide contents Event OnInit() Debug.Notification("Quest Start") SetDebutOutfits() EndEvent Function SetDebutOutfits() Int NPCCnt = myNPCList.GetSize() Utility.wait(1) Debug.Notification("NPCCnt: " + NPCCnt) while NPCCnt Utility.wait(1) Debug.Notification("While. NPCLeft: " + 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 Utility.wait(1) Debug.Notification("While. Armor: " + ArmorCnt) ArmorCnt -=1 myArmorRef = debutOutfit.GetNthPart(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) akActorRef.equipItem (myArmorRef,0,TRUE) EndWhile EndWhile Utility.wait(1) Debug.Notification("Script Complete") EndFunction SEQ Files are only needed for Start Game Enabled Quests that contain dialogue.
oldrayzor Posted February 19, 2019 Author Posted February 19, 2019 Thanks for the reply. I removed the quest stage and alias. 2 hours ago, egon123 said: First, make sure that the quest starts. You checked the "start game enabled" but you also need to create an SEQ file. Went into Tes5Edit and created Seq file (doesn't ask much, just writes to the overwrite sub-directory, am using MO) Moved it to a Seq folder in the main Skyrim data. 2 hours ago, egon123 said: Next, when something doesn't work, use Debug.Notification("Your Text") Inserted the notification as suggested, but nothing seems to happen. It could be because of the Solitude Opening Quest overwriting so I'm going to try it on other NPCs just for a test.
Holzfrau Posted February 19, 2019 Posted February 19, 2019 Have you saved your game since adding the quest and script? OnInit will only ever fire once in a given playthrough, when the script is first loaded by the game. From the CK wiki, it looks like SetOutfit applies the new outfit automatically. I think you'll be adding a second set of clothes with your equip loop. 22 minutes ago, oldrayzor said: Went into Tes5Edit and created Seq file (doesn't ask much, just writes to the overwrite sub-directory, am using MO) Moved it to a Seq folder in the main Skyrim data. As mentioned above, there is absolutely no need for a SEQ file here. Quote Inserted the notification as suggested, but nothing seems to happen. It could be because of the Solitude Opening Quest overwriting so I'm going to try it on other NPCs just for a test. For startup tasks like this, I find that Debug.MessageBox often works better, because other mods are usually dropping a bunch of stuff in the notifications and it's easy to lose the message you're looking for. Shouldn't be an issue with the sample code you got which spams them at every step of the loop, but something to keep in mind if you only want to check like a single thing. At any rate, I think it's highly doubtful the Solitude scene is messing with people's outfits.
oldrayzor Posted February 19, 2019 Author Posted February 19, 2019 2 hours ago, Holzfrau said: Have you saved your game since adding the quest and script? OnInit will only ever fire once in a given playthrough, when the script is first loaded by the game. I am simply coc-ing in the console from the main menu. I just removed the SEQ file and replaced the debug.notification with debug.messagebox (not sure of syntax but assume it is identical to the other). I have 4 npcs and 4 outfits listed in the 2 FormLists. I changed one NPC to Gerdur in Riverwood which should be free of any opening quests. I then set MO profile to one I keep without any MODS and tried to run it (again from main menu). Absolutely nothing happened. No message. No outfit. Totally confused. ? Would I need to save before it would fire?
oldrayzor Posted February 19, 2019 Author Posted February 19, 2019 2 hours ago, Holzfrau said: From the CK wiki, it looks like SetOutfit applies the new outfit automatically. I think you'll be adding a second set of clothes with your equip loop. Yes, that's correct but it is the only way to get the outfit in the inventory. I will play around with the option once something is actually working.
Holzfrau Posted February 19, 2019 Posted February 19, 2019 28 minutes ago, oldrayzor said: Would I need to save before it would fire? Nah, it looks to me like you're doing everything right. I am stumped for now. Could it be possible that you forgot to enable the ESP somehow?
GenioMaestro Posted February 20, 2019 Posted February 20, 2019 3 hours ago, egon123 said: Next, when something doesn't work, use Debug.Notification("Your Text") I do often do that when I try to find out why a script isn't execute correct. Best use an Utility.wait(1) before that to reduce the speed a bit. You can later take it out when the script works as it should. A lot of disgregated info... If you mix it correctly maybe you can make as you want after some mix an tries. The first and unavoidable is activate the mark "Start Game Enabled" but "Run Once" is NOT recomended. The mark "Start Game Enabled" guaranty that the quest start with the game. But "Run Once" prohibit stop and start the quest and sometimes you must make it for solve some problems. The Second and again unavoidable is the START SCRIPT of the quest and that is EXACTLY your problem. You have two options and i personally preffer the second. One way for start the quest is add a Script in the script section of the quest, as you has been made. But that script NEED an event like egon123 have in their spoiler. Strange but they not mention it. Event OnInit() Debug.Notification("Quest Start") SetDebutOutfits() EndEvent That event is fired when the game start and, as egon123 have make, you must call your function SetDebutOutfits() from inside the Event OnInit. But as Holzfrau say, the game call the OnInit() event ONE TIME AND ONLY ONE TIME for start the Quest and NEVER MORE call again the OnInit() event. The game call the OnInit() event in EVERY NEW GAME for start the quest but after the NEW GAME has been started NEVER MORE call again the OnInit() event. In this way, when you save the game and load it the game NOT CALL the OnInit() event. This mean, for example, if you make a error in your code like forgot call your function SetDebutOutfits() or write any bad, as the OnInit() event is fired ONE TIME AND ONLY ONE TIME, you only have ONE oportunity and you must make it good. For have ANOTHER oportunity you must START A NEW GAME. Other option for have ANOTHER oportunity is use the console and write the comands for stop the quest, reset it and start it again and for that the "Run Once" is NOT recomended, because prohibit the use of console commands for restart the quest. The other way for start the quest, and i prefer it a lot because give much less problems, is add a Script to the Alias "PlayerRefAlias" and put and Event OnPlayerLoadGame() inside the script. As you can understand, the event OnPlayerLoadGame() is fired every time you load a savegame and you simply need load your savegame for have ANOTHER oportunity for run your code. The only disavantage of this metod is that the script not fire when start the game. You MUST save the game and load it for run your code for the FIRST TIME. Additionally, as Holzfrau say, is much better use Debug.MessageBox for verify if your code really run because the Debug.Notification("Your Text") indicated by egon123 only show some seconds mixed with a lot of others notifications from others mods and is too easy lost it. The message box is permanent and you must press OK for close it and is near imposible lost it.
oldrayzor Posted February 20, 2019 Author Posted February 20, 2019 @Holzfrau @GenioMaestro @egon123 Thank you for the replies. Much appreciated. First I apologize for the failure to trigger. I had a latent version of the PEX tucked inside MO's overwrite file. Now it triggers and displays the sequence of execution, which is great help so thx Egon123. However, I am having problems with the akActorRef. Using the below script, at Debug.MessageBox("While "+ akActorRef+": "+debutoutfit) displays "None" for the akActorRef followed by the proper DebutOutfit ID. Here are the various settings for the property. Spoiler This is my first quest/script and so I'm certain I made a dumb mistake somewhere. Be grateful if you can let me know if you see anything. Scriptname DebutOutfitter Extends Quest {Sets DefaultOutfit for listed NPCs} FormList Property myNPCList Auto FormList Property myOutfitList Auto Outfit Property DebutOutfit Auto Outfit Property NullOutfit Auto Armor Property MyArmorRef Auto Event OnInit() Debug.MessageBox("Quest DebutOutfitter Start") SetDebutOutfits() EndEvent Function SetDebutOutfits() Int NPCCnt = myNPCList.GetSize() Utility.wait(1) Debug.MessageBox("NPCCnt: " + NPCCnt) while NPCCnt Utility.wait(1) Debug.MessageBox("While. NPCLeft: " + 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 Utility.wait(1) Debug.MessageBox("While "+ akActorRef+": "+debutoutfit) ArmorCnt -=1 myArmorRef = debutOutfit.GetNthPart(ArmorCnt) as Armor akActorRef.additem (myArmorRef,1,TRUE) akActorRef.equipItem (myArmorRef,0,TRUE) EndWhile EndWhile Utility.wait(1) Debug.MessageBox("Script Complete") EndFunction
egon123 Posted February 21, 2019 Posted February 21, 2019 @oldrayzor When I see this right, you need to get the name for the npc first. String Name = akActorRef.GetLeveledActorBase().GetName() Debug.MessageBox("While "+ NAME +": "+ debutoutfit)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.