SKKmods Posted March 10, 2021 Share Posted March 10, 2021 Good point I have updated my language. ReloadScript is only safe for existing variable value changes or adding new variables. Changing the order of existing variables or removing one will generally throw a consistency error the the log. Probaly because pointers if you know what they are. Same for functions. The content of existing functions can be changed and new added, but removing functions or changing their passed parameter interfaces can also generate consistenecy errors. Once a script variable or function is in a game, its there for good. I have several mods in the field with over 20 updates that have had to preserve original variables, functions and scripts even though they are demised for update in place backward compatibility. And then call for a clean when they are purged after a major restructure Example changelog. Link to comment Share on other sites More sharing options...
PJMail Posted March 10, 2021 Share Posted March 10, 2021 Thanks for the confirmation.I hadn't considered function passed parameters as an issue since their pointers are normally constructed on-the-fly when you call that function.Are you sure about it being an issue - especially as you can make parameters optional? As long as the calls and functions have consistent type and number of parameters of course. Also what about const? Most compilers abstract constants out so they aren't part of the memory allocation/pointers. Have you had issues moving/removing const variables? Link to comment Share on other sites More sharing options...
SKKmods Posted March 10, 2021 Share Posted March 10, 2021 I have had consistency errors in the log changing function calls in the same savegame which is why you need to look at the log during any changes. YMMV. I only ever use CONST for properties. They will throw an inelegant log error if reassigned or removed, but does not seem to trigger pointer/stack issues: warning: Property Blah on script Blah attached to (num) cannot be initialized because the script no longer contains that property As I have ZERO tolerance for any of my scripts generating ANY debug log output that is not a Debug.Trace call (its a quality thing) I never dump or reassign const properties. Link to comment Share on other sites More sharing options...
GrimGrim31 Posted March 10, 2021 Author Share Posted March 10, 2021 (edited) it has been a bumpy ride so far. Welcome aboard - It'll always be like this. Renaming and/or changing the data type of properties on your script may break the script properties button in CK. It will do nothing when clicked and the properties dialog won't open.One solution is to clear out all stored properties from the relevant VMAD record in your plugin with xEdit. Removing the script in CK and then saving/reloading the plugin might work as well. Thanks! Will FO4EditQAC clean the stored properties if I run it on the esp file that has the script attached? If not, I am not sure how to use FO4Edit to clear out the stored properties from the relevant VMAD. EDIT: The Quick Auto Clean (QAC) worked but it took a while to figure that out. When I loaded the data for the esp into CK, I still wasn't able to get the property button to work. It would start but then a popup would tell me there was an error and the property window would open with no properties. I decided to try loading the data for two other files. One had an API that was referenced in the script and the other had the Actor Value variable that I used in the script. Using the data from all three files made the property button for the script work correctly. I autofilled the actor value but wasn't able to save the esp. It was locked for some reason, perhaps an aftereffect of using QAC. I closed all of my open programs, restarted my computer, and was able to repeat the process to autofill the actor value and save the esp. Unfortunately, my script function still doesn't work in the game. I tried it on a save from when I had no mods installed. The AVIF still didn't get changed by 50 when the function was called. I went back into CK and looked at the AVIF in the properties of the script for the quest. It still shows the property as filled but the name is shown as nullptr and the form id of the AVIF. Is this normal? Is the nullptr just because my AVIF is located in a different esp? Edited March 10, 2021 by GrimGrim31 Link to comment Share on other sites More sharing options...
SKKmods Posted March 10, 2021 Share Posted March 10, 2021 Holdon you seem to have changed the conditions: Originally >"The actor value is in my ESP and I also declared it at the beginning of my script." Now > "just because my AVIF is located in a different esp?" If the form is in a different ESP then you need to make that ESP a master dependency to whatever you are working on, or use Game.GetFormFromFile(). You are entering a world of complexity you do not sound ready for. Link to comment Share on other sites More sharing options...
GrimGrim31 Posted March 10, 2021 Author Share Posted March 10, 2021 Holdon you seem to have changed the conditions: Originally >"The actor value is in my ESP and I also declared it at the beginning of my script." Now > "just because my AVIF is located in a different esp?" If the form is in a different ESP then you need to make that ESP a master dependency to whatever you are working on, or use Game.GetFromFromFile(). You are entering a world of complexity you do not sound ready for.The conditions didn't change but my explanation of them was not clear enough. OK, so now I understand that the AVIF has to originate in the same ESP as the script that uses it or I have to learn a lot more about papyrus. It looks easier to just edit the two esps to relocate the AVIF along with the perks and magic spells/effects that use it. Link to comment Share on other sites More sharing options...
dylbill Posted March 10, 2021 Share Posted March 10, 2021 Another option, if you don't want to make the other esp a dependency, is to use GetFormFromFile: https://www.creationkit.com/fallout4/index.php?title=GetFormFromFile_-_Game Keep in mind though the esp you're referencing can't have both esl and esp versions because the form id could change when doing so. Link to comment Share on other sites More sharing options...
GrimGrim31 Posted March 12, 2021 Author Share Posted March 12, 2021 Thanks, the function runs correctly now that I added a line for getformfromfile. Function IncreaseNPC_Friendship() NPC_Friendship = Game.getformfromfile(0x00100D, "FriendsandEnemies.esp") as ActorValue Game.getplayer().ModValue(NPC_Friendship, 50) debug.notification("IncreaseNPC_Friendship Function Called")EndFunction I am grateful for the help. Thanks to all that replied. I had to learn about the 0x00100D part that tells getformfromfile the form id to get. The 0x00 was new to me. I was expecting to have to put 0x64 because the FriendsandEnemies.esp is 64th in my load order. Link to comment Share on other sites More sharing options...
dylbill Posted March 12, 2021 Share Posted March 12, 2021 No problem. With GetFormFromFile you don't need to worry about load order. You just replace the first two numbers in the ID with 0x Link to comment Share on other sites More sharing options...
Recommended Posts