rossjcorbett Posted December 20, 2012 Share Posted December 20, 2012 I am having a weird scripting error. If the player chooses a specific option within a Message Box, a function with a series of if statements gets called. I can confirm that the function is getting called with a debug message, but the logic for the if statements doesn't seem to work. Scriptname MTWritingTable extends ObjectReference Quest Property MTQ020 AutoQuest Property MTQ030 AutoQuest Property MTQ030a AutoQuest Property MTQ045 AutoQuest Property MTQ048 AutoQuest Property MTQ050 AutoQuest Property MTQ051 AutoQuest Property MTQ052 AutoQuest Property MTQ060 AutoQuest Property MTQ070 AutoQuest Property MTQ080 AutoQuest Property MTQ085 AutoQuest Property MTQ090 AutoQuest Property MTQ095 AutoQuest Property MTQ100 AutoQuest Property MTQ110 AutoQuest Property MTQ120 AutoQuest Property MTQ140 Auto Message Property MTWritingDeskMessage Auto bool showMessageAgain = TRUE function displayMessage() int option = MTWritingDeskMessage.show() if option == 1 MTQ020.setstage(25) Utility.wait(5) elseif option == 2 MTQ030.setstage(5) Utility.wait(5) elseif option == 3 MTQ030a.setstage(5) Utility.wait(5) elseif option == 4 deliverOrnateWrit() Utility.wait(5) elseif option == 0 showMessageAgain = FALSE endIfendFunction function deliverOrnateWrit() if MTQ045.getStage() == 20 MTQ045.setStage(30) elseif MTQ048.getStage() == 20 MTQ048.setStage(30) elseif MTQ050.getStage() == 20 MTQ050.setStage(30) MTQ051.setStage(30) MTQ052.setStage(30) elseif MTQ060.getStage() == 40 MTQ060.setstage(50) elseif MTQ070.getStage() == 20 MTQ070.setStage(30) elseif MTQ080.getStage() == 20 MTQ080.setStage(30) elseif MTQ085.getStage() == 20 MTQ085.setStage(30) elseif MTQ090.getStage() == 20 MTQ090.setStage(30) elseif MTQ095.getStage() >= 20 && MTQ095.getStage() < 50 (MTQ095 as MTQ095QuestScript).getWrit() elseif MTQ100.getStage() == 20 MTQ100.setStage(30) elseif MTQ110.getStage() == 20 MTQ100.setStage(30) elseif MTQ120.getStage() == 20 MTQ100.setStage(30) elseif MTQ140.getStage() == 20 MTQ140.setStage(30) else Debug.Trace(self + "Logic failure in deliverOrnateWrit.") endIfendFunction The script compiles and all the properties are filled correctly on the object base to which the script is attached. In the deliverOrnateWrit() function, though, the logic tree goes to else. Outputting getStage() to a debug box shows that it returns 0. Checking with sqv in the console, the quest is running and the stage is higher than 0. The logic attached to the MessageBox itself that determines which buttons will be displayed also gets a sensible return from getStage(). I've also tried making it so the script extends Furniture rather than ObjectReference (it is attached to the base object rather than each instance of it) Is there something that I'm missing, like ObjectReference not being allowed to see a quest stage? Link to comment Share on other sites More sharing options...
majistik Posted December 20, 2012 Share Posted December 20, 2012 I know little about scripting, However last time I created a script as a quest i wrote on top "extends ObjectReference" and someone told me to turn it to "extends ReferenceAlias" :psyduck: Link to comment Share on other sites More sharing options...
rossjcorbett Posted December 21, 2012 Author Share Posted December 21, 2012 I know little about scripting, However last time I created a script as a quest i wrote on top "extends ObjectReference" and someone told me to turn it to "extends ReferenceAlias" Thanks, but this script isn't attached to a quest alias. It is attached to an object instantiated at several places in the world that checks the status of various quests and acts accordingly. Link to comment Share on other sites More sharing options...
rossjcorbett Posted December 21, 2012 Author Share Posted December 21, 2012 Turns out it was a property fill problem. The activator script's properties were not refilling when a save game was loaded, so the script kept calling getStage() on a NONE object. Starting with a clean save and just setStage()-ing my way to the middle of the quest fixed it. Link to comment Share on other sites More sharing options...
steve40 Posted December 22, 2012 Share Posted December 22, 2012 (edited) Sometimes, when adding/removing/renaming properties in scripts, I've noticed that they don't update correctly in the esp. This can cause some odd errors about missing properties in the Papyrus log. The fix is to remove the script from the Form, then add it back, refill the properties and then save the esp again. Also, I've found that roughly 1 out of 10 times when loading a save game, I'll get a lot of "none object" errors like you describe (properties not filling correctly). This seems to be a bug - I think data sometimes randomly gets misread or corrupted when loading savegames. Maybe this is one way that savegame bloat/corruption is caused? The solution was simply to restart the game and reload the save. Edited December 22, 2012 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts