WidgitLabs Posted August 28, 2017 Share Posted August 28, 2017 I've got a custom item in my current WIP mod that I've manually added to the game just to test, and it works fine. Now, I'm trying to figure out how to add it to the leveled lists. I'd prefer to do it through scripting to maximize compatibility, and I've been trying to use this post and this post as references. Unfortunately, I've been unable to get it to work. In fact, I can't even get a script recognized by the CK! Can anyone provide some insight into how to do this beyond writing the script itself? I'm pretty sure I understand the scripting aspect, just not how to actually add the script to the game. Link to comment Share on other sites More sharing options...
JonathanOstrus Posted August 28, 2017 Share Posted August 28, 2017 (edited) I've got a custom item in my current WIP mod that I've manually added to the game just to test, and it works fine. Now, I'm trying to figure out how to add it to the leveled lists. I'd prefer to do it through scripting to maximize compatibility, and I've been trying to use this post and this post as references. Unfortunately, I've been unable to get it to work. In fact, I can't even get a script recognized by the CK! Can anyone provide some insight into how to do this beyond writing the script itself? I'm pretty sure I understand the scripting aspect, just not how to actually add the script to the game. I'm not sure I follow why you can't get the CK to recognize a script. The easiest is to let the CK make it then just use the built in editor if you're not setup for external editing. Well the first link has a bad script. You wouldn't do it from a leveled item extension. You *could* do it from the quest example on the second link. Without seeing what code you have it's hard to explain why it doesn't work for you. If you followed the example from the reddit link it should work. You just call the LeveledList.AddForm(ItemToAdd, MinimumLevel, HowManyCount). You need to pass the correct forms as properties to your script so it will do its work. A quick regurgitation of the process would be like this:Create a start game enabled quest Create a script on that quest Add properties for the leveled list(s) you want to add items to Add properties for the item(s) you want to add to the list(s) In the OnInit event add the item(s) to the list(s)If you didn't want them to be added upon game start, you could do the additions in a different function or even a dialogue or quest fragment. Though most people want to add them upon mod start. You might also find this mod page of help http://www.nexusmods.com/fallout4/mods/17782/? It has the scripts already written, so you just add them to your start quest and fill in the properties as you see fit. Edited August 28, 2017 by BigAndFlabby Link to comment Share on other sites More sharing options...
WidgitLabs Posted August 28, 2017 Author Share Posted August 28, 2017 (edited) I've got a custom item in my current WIP mod that I've manually added to the game just to test, and it works fine. Now, I'm trying to figure out how to add it to the leveled lists. I'd prefer to do it through scripting to maximize compatibility, and I've been trying to use this post and this post as references. Unfortunately, I've been unable to get it to work. In fact, I can't even get a script recognized by the CK! Can anyone provide some insight into how to do this beyond writing the script itself? I'm pretty sure I understand the scripting aspect, just not how to actually add the script to the game. I'm not sure I follow why you can't get the CK to recognize a script. The easiest is to let the CK make it then just use the built in editor if you're not setup for external editing. Well the first link has a bad script. You wouldn't do it from a leveled item extension. You *could* do it from the quest example on the second link. Without seeing what code you have it's hard to explain why it doesn't work for you. If you followed the example from the reddit link it should work. You just call the LeveledList.AddForm(ItemToAdd, MinimumLevel, HowManyCount). You need to pass the correct forms as properties to your script so it will do its work. A quick regurgitation of the process would be like this:Create a start game enabled quest Create a script on that quest Add properties for the leveled list(s) you want to add items to Add properties for the item(s) you want to add to the list(s) In the OnInit event add the item(s) to the list(s)If you didn't want them to be added upon game start, you could do the additions in a different function or even a dialogue or quest fragment. Though most people want to add them upon mod start. You might also find this mod page of help http://www.nexusmods.com/fallout4/mods/17782/? It has the scripts already written, so you just add them to your start quest and fill in the properties as you see fit. It's the second step that I'm struggling with. Trying to create in the builtin editor isn't working for me (the editor doesn't allow me to edit for some reason), and I can't figure out how to get the CK to recognize a script NOT created in the editor. Below is the script I hacked together based on the reddit example (that one made the most sense when I was first trying)... ScriptName HotCInitQuestScript extends Quest Event OnInit() LLI_Loot_Food_Unique.AddForm(HotCCannedBass, 1, 1) HotCInitQuest.Stop() EndEvent LeveledItem Property LLI_Loot_Food_Unique auto MiscOject Property HotCCannedBass auto Quest Property HotCInitQuest auto I've tried every way I can think of (searching for incompatible, reloading the CK, etc) but the script never shows up, though every other script does. Am I missing something obvious? Edited August 28, 2017 by WidgetInteractive Link to comment Share on other sites More sharing options...
WidgitLabs Posted August 28, 2017 Author Share Posted August 28, 2017 The funny/annoying thing is that this particular item is completely incidental... It's only being added for immersion purposes and has no direct effect on the mod. But... it's also proving to be the most frustrating part of writing it! Link to comment Share on other sites More sharing options...
JonathanOstrus Posted August 28, 2017 Share Posted August 28, 2017 (edited) The funny/annoying thing is that this particular item is completely incidental... It's only being added for immersion purposes and has no direct effect on the mod. But... it's also proving to be the most frustrating part of writing it! When making the quest, are you hitting OK to finish the creation, then opening it back up to try adding the script? It won't let you do a lot of things until you first make the quest, close the window, then re-open. There's a lot of complex reasons for it but it's non-intuitive and a lot of people miss that step. CK will recognize a script sourced outside as long as you compile outside and put the pex in the scripts folder. Then tell CK to reload the scripts. It's qwerky. Also you don't need to do Quest Property HotCInitQuest autoYou can use Self.Stop() or even just Stop() instead since the script is running in the context of the script you want to manipulate. Edited August 28, 2017 by BigAndFlabby Link to comment Share on other sites More sharing options...
WidgitLabs Posted August 28, 2017 Author Share Posted August 28, 2017 The funny/annoying thing is that this particular item is completely incidental... It's only being added for immersion purposes and has no direct effect on the mod. But... it's also proving to be the most frustrating part of writing it! When making the quest, are you hitting OK to finish the creation, then opening it back up to try adding the script? It won't let you do a lot of things until you first make the quest, close the window, then re-open. There's a lot of complex reasons for it but it's non-intuitive and a lot of people miss that step. CK will recognize a script sourced outside as long as you compile outside and put the pex in the scripts folder. Then tell CK to reload the scripts. It's qwerky. Also you don't need to do Quest Property HotCInitQuest autoYou can use Self.Stop() or even just Stop() instead since the script is running in the context of the script you want to manipulate. That was the push I needed! Got it working, partially thanks to that tip. Had to save and re-open, plus had to copy the extracted scripts over to the FO4 data directory... Somehow I missed that part originally. Link to comment Share on other sites More sharing options...
JonathanOstrus Posted August 28, 2017 Share Posted August 28, 2017 That was the push I needed! Got it working, partially thanks to that tip. Had to save and re-open, plus had to copy the extracted scripts over to the FO4 data directory... Somehow I missed that part originally. Glad you got it. Odd that the CK installation didn't handle putting in the scripts automatically. Oh well good luck. Link to comment Share on other sites More sharing options...
Recommended Posts