SameOldBard Posted May 15, 2020 Share Posted May 15, 2020 Hello there, I am having a very weird situation happening to me. I have a Quest[] which is exposed to the editor, so it is a property auto const. I can add things through the editor and everything is ok. But since I am working on an update, I am adding new items to that array through code. Not much, I am still well under the 128 limit. So I do my Add calls and everything is fine and nice. I can access the new data through the array normally. I do a quick save and a quick load and the items I added are gone. Is it because it is a const? If that is the issue, I find it quite weird. What I expect from a const array is that the object itself cannot be changed, but that data inside can. That is the behaviour I have on c#. Can anyone confirm that his is how the consts works here? Thanks,SameOldBard Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 15, 2020 Share Posted May 15, 2020 Easy to test. Drop the Const tag and see if your changes stick through save and load. You could also do a maint routine that re-adds whatever as needed when the player loads the game. But I'd test behavior without the const tag before coding in a workaround solution. I've never dealt with consts as those do not exist for Skyrim. According to the FO4 CK wiki A const property is similar to an auto read-only property in that its value cannot be changed by the script, and the value is ignored in save games. However, unlike auto read-only properties the value of the property can be changed by the editor in a plugin, making it ideal for times when you want to point at a form or other object that the script will not be changing. Simply adding "const" on the end of the definition will make the property const.I think what might be happening is that because it is an array, you can still fiddle with it during run time (i.e. add or remove as needed) but any such changes won't stick when saved because it has been flagged as a const. And a reload brings back the default listing as defined on the object holding the script. Link to comment Share on other sites More sharing options...
SameOldBard Posted May 15, 2020 Author Share Posted May 15, 2020 Well, I can confirm, it is like that. I wish I have known that before. I did the test and a different one, to have a non const to do the same thing and it seems that it is like that indeed. Thanks for info. Lot's of learning with this mod. Cheers,SameOldBard Link to comment Share on other sites More sharing options...
Recommended Posts