becauseofreasons Posted March 19, 2013 Share Posted March 19, 2013 I'm having some issues getting the following code to execute properly in my quest script. The whole thing compiles, which is a good first step. The second, longer, if statement works, but the first doesn't. I'm not sure if there's just some sort of quirk to Bethesda's scripting language that I'm not picking up, or if I made some newbie mistake regarding multiple if statements in a single block of code or whatever. scn Mister880QuestScript begin gameMode ; if the player has Joad's note if (getStage Mister880 < 30 && getHasNote Mister880JoadLetter == 1) setStage Mister880 35 endif if (getStage Mister880 < 90) ; assume the player pickpocketed Josephine's letter if (Mister880JosephineJacobsREF.getDead == 0 && getHasNote Mister880JosephineLetter == 1) setStage Mister880 50 endif ; assume the player killed her if (Mister880JosephineJacobsREF.getDead == 1 && getHasNote Mister880JosephineLetter == 1) setStage Mister880 50 endif endif end Anyway, thanks y'all. Link to comment Share on other sites More sharing options...
viennacalling Posted March 19, 2013 Share Posted March 19, 2013 (edited) As it is written, it is highly probable that the first if statement does execute and you do not notice the result because the second if statement immediately executes. The game will try to run both of the if statements in the gamemode block, and the way you have your logic written the conditions in the second if statement overlap the conditions of the first if statement. Edited March 19, 2013 by viennacalling Link to comment Share on other sites More sharing options...
becauseofreasons Posted March 20, 2013 Author Share Posted March 20, 2013 (edited) As it is written, it is highly probable that the first if statement does execute and you do not notice the result because the second if statement immediately executes. The game will try to run both of the if statements in the gamemode block, and the way you have your logic written the conditions in the second if statement overlap the conditions of the first if statement. Thanks. I'm pretty sure that isn't the issue, because I didn't have the second letter in my inventory at any point during the test run. Other setStages wouldn't get called. scn Mister880QuestScript begin gameMode ; If the player is partway through the beginning third of the quest and gets Joad's letter, you get to move up to find the farmstead. if (getStage Mister880 < 30 && getStage Mister880 > 6 && getHasNote Mister880JoadLetter) setStage Mister880 35 endif ; If the player has the evidence from the farm, bring back the evidence. if (player.getItemCount CounterfeitCaps >= 1 && getHasNote Mister880HomesteadNote) if (getStage Mister880 == 75) setStage Mister880 77 endif if (getStage Mister880 == 85) setStage Mister880 87 endif endif ; If the player takes Josephine's letter, ascertain the context and plan accordingly. if (getStage Mister880 < 90 && getStage Mister880 > 35) if (Mister880JosephineJacobsREF.getDead == 0 && getHasNote Mister880JosephineLetter) setStage Mister880 50 endif if (Mister880JosephineJacobsREF.getDead && getHasNote Mister880JosephineLetter) setStage Mister880 50 endif endif end It compiles, yet neither the getItemCount or getHasNote calls ever return anything other than zero. Edited March 20, 2013 by becauseofreasons Link to comment Share on other sites More sharing options...
jazzisparis Posted March 20, 2013 Share Posted March 20, 2013 I rearranged your script into a single if statement: scn Mister880QuestScript begin GameMode if (GetStage Mister880 > 6) && (GetStage Mister880 < 30) && GetHasNote Mister880JoadLetter ; If the player is partway through the beginning third of the quest and gets Joad's letter, you get to move up to find the farmstead. SetStage Mister880 35 elseif player.GetItemCount CounterfeitCaps && GetHasNote Mister880HomesteadNote ; If the player has the evidence from the farm, bring back the evidence. if GetStage Mister880 == 75 SetStage Mister880 77 elseif GetStage Mister880 == 85 SetStage Mister880 87 endif elseif (GetStage Mister880 > 35) && (GetStage Mister880 < 90) && player.GetItemCount Mister880JosephineLetterItem ; If the player takes Josephine's letter, ascertain the context and plan accordingly. player.RemoveItem Mister880JosephineLetterItem 1 1 SetStage Mister880 50 endif end Notice that I replaced 'GetHasNote Mister880JosephineLetter' with 'GetItemCount Mister880JosephineLetterItem', with 'Mister880JosephineLetterItem' being a misc item that will add the note the moment the player picks it up, and once the other conditions are met will be silently removed. Otherwise, it is very probable that 'SetStage Mister880 50' will execute repeatedly, even when it should not.(I also removed a few redundant conditions, such as checking if Josephine Jacobs was dead, as the result was the same either way). Link to comment Share on other sites More sharing options...
becauseofreasons Posted March 20, 2013 Author Share Posted March 20, 2013 You're awesome. Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts