gpthree Posted April 22, 2021 Share Posted April 22, 2021 Does this script make any sense? It compiles but doesnt work in game. I'm just starting to mess with scripts. I can get a formlist to attach to another formlist. Is it possible to get multiple ones inside a singel script? As and example I have formlist1 and formlist2. I would like formlist1 to attach to formlist1a and formlist2 to attach to formlist2a. ScriptName AddFormListBasicScript extends Quest ; ------------ Properties ------------------------------Group FormlistToAddFormlist property FormlistToAdd auto{FormlistToAdd} ;The armor thats being addedFormlist property FormlistToAdd2 auto{FormlistToAdd} ;The armor thats being addedEndGroup Group ArmourFormListFormlist property ArmourFormList auto{ArmourFormList} ;The formlist you are adding it toFormlist property ArmourFormList2 auto{ArmourFormList} ;The formlist you are adding it toEndGroup ; ------------ Events -----------------------Event OnQuestInit()install()RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") EndEvent ;Calls the install function everytime the player loads his game. If you are adding many categories, you should stop ;the time first. If your script runs longer then a few seconds, remove this event and the line ;RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") above;This event is a safety feature, in case some other mod calls the revert() function on one of the formlists you want ;to edit.Event Actor.OnPlayerLoadGame(Actor actorref)install() EndEvent Function install()ArmourFormList.AddForm(FormlistToAdd)ArmourFormList2.AddForm(FormlistToAdd2)EndFunction Link to comment Share on other sites More sharing options...
dylbill Posted April 22, 2021 Share Posted April 22, 2021 That looks like it should work. I don't think you need to do it OnGameLoad though cause AddForm should carry over between saves. Did you fill the formlist properties in the Creation Kit? Also what are you using the formlists for? Link to comment Share on other sites More sharing options...
gpthree Posted April 22, 2021 Author Share Posted April 22, 2021 I'm trying to patch armor and clothing for Nuclear Winter mod. The mod has a bunch of formlist for various protection levels. I made formlists in xedit of armors for each protection in my patch. I'm trying to match my formlists to the ones in Nuclear Winter. I was able to do 1 formlist or 1 piece of armor, but doing multiples in one script doesnt work. Link to comment Share on other sites More sharing options...
dylbill Posted April 22, 2021 Share Posted April 22, 2021 So, if I understand correctly, you're trying to add protection levels to new armors in the Nuclear Winter mod? If that's so, I don't think you can just add formlists of armors to the armor formlists. Instead, use a while loop to add the armors in the formlists directly. Function install() InjectFormsFromList(FormlistToAdd, ArmourFormList) InjectFormsFromList(FormlistToAdd2, ArmourFormList2) EndFunction Function InjectFormsFromList(Formlist SourceList, Formlist DestinationList) ;add all forms from SourceList to DestinationList Int M = SourceList.GetSize() While M > 0 M -= 1 DestinationList.AddForm(SourceList.GetAt(M)) EndWhile EndFunction Link to comment Share on other sites More sharing options...
gpthree Posted April 22, 2021 Author Share Posted April 22, 2021 Nuclear Winter puts vanilla armors in formlist dependant on what Insulation value he wants to give them, Winter_ArmorExposure_5, 10, 15, etc. Horizon has about 30 non-vanilla armors I put in formlist to match the ones in Nuclear Winter. So I wanted Horizon_5 formlist to populate in Winter_ArmorExposure_5, Horizon 10 in Winter 10 etc. Link to comment Share on other sites More sharing options...
dylbill Posted April 23, 2021 Share Posted April 23, 2021 So I took a look at the Nuclear Winter formlists, and it looks like they don't have other formlists inside of them. So, if you try to put a formlist in the Nuclear Winter formlists, as you tried to do in your original script, it won't work correctly. The script I posted will work because it's putting the actual armor forms from a formlist in the Nuclear Winter formlists. If you do this: Formlist Property Horizon_5 Auto Formlist Property Winter_ArmorExposure_5 Auto Event OnInit() Winter_ArmorExposure_5.AddForm(Horizon_5) EndEvent It doesn't add each form from Horizon_5 to the list, but only 1 form, the Horizon_5 formlist. If you do this: Formlist Property Horizon_5 Auto Formlist Property Winter_ArmorExposure_5 Auto Event OnInit() Int M = Horizon_5.GetSize() While M > 0 M -= 1 ;subract 1 from M. Cycle through each form in Horizon_5 list Winter_ArmorExposure_5.AddForm(Horizon_5.GetAt(M)) EndWhile EndEvent It will add each form that's in Horizon_5, in this case each armor form that's in the list to the Winter_ArmorExposure_5 formlist, which is what you want. Above I just wrote a function that makes it easy to do that multiple times. Link to comment Share on other sites More sharing options...
gpthree Posted April 23, 2021 Author Share Posted April 23, 2021 I'm incredibly new to scripts but I recall reading earlier formlists could be cleaned to only have whats in it originally? I'm wondering if thats what happening because the above script didnt work. It looks like he has another set of formlist with the same names except they end in _Dyn and they are empty. I used your script above and populated those lists instead and it seemed to work. So thanks a lot! This helped me out immensely I believe. Fueled my modding addiction to a whole new level I think. :smile: edit: I also changed the Priority in the quest and made it 50. Not sure if that made a difference. Link to comment Share on other sites More sharing options...
dylbill Posted April 23, 2021 Share Posted April 23, 2021 No problem. I assume the _Dyn stands for Dynamic, which would make sense. Glad it's working! You can also put a debug.notification("Done") or something at the end of your script to tell when it's finished. Link to comment Share on other sites More sharing options...
gpthree Posted April 25, 2021 Author Share Posted April 25, 2021 Just as a small update. I went back to the script and used the formlist without the _Dyn as you originally posted. This time though in the Quest record I made it a Priority of 50 and it worked. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts