Snufflesdog Posted September 28, 2014 Share Posted September 28, 2014 I'm having some trouble with my reusable chem set script. There are two problems, as far as I can tell. They are as follows: On first use, regardless of which button is pressed, the following message is not shown until the chem set is activated again (e.g. when used != 1 && button == 0, SnufflesChemSetMsg03 is not displayed until the chem set is activated again). After re-activating the chem set (and receiving SnufflesChemSetMsg03), SnufflesChemSetMsg shows, but the buttons do not actually give the player the corresponding chem. To receive a chem, one must re-activate the chem set (again), and select the chem.I believe that the two problems are related, and that solving the first may solve the second, but I cannot seem to solve the first. scn SnufflesChemSetSCRIPT int button float resetTimer short active short used begin OnActivate if IsActionRef player if ( used == 1 ) if ( GameDaysPassed - resetTimer >= 1 ) set active to 1 endif if ( active == 1 ) ShowMessage SnufflesChemSetMsg elseif ( active == 0 ) ShowMessage SnufflesChemSetMsg01 else endif else ShowMessage SnufflesChemSetMsg02 endif endif end begin MenuMode 1001 set button to GetButtonPressed if ( used == 1 && button == 1 ) player.AddItem Stimpak 1 set resetTimer to GameDaysPassed set active to 0 elseif ( used == 1 && button == 2 ) player.AddItem Mentats 1 set resetTimer to GameDaysPassed set active to 0 elseif ( used == 1 && button == 3 ) player.AddItem NVSteadyChem 1 set resetTimer to GameDaysPassed set active to 0 elseif ( used == 1 && button == 4 ) player.AddItem Psycho 1 set resetTimer to GameDaysPassed set active to 0 elseif ( used == 1 && button == 5 ) player.AddItem Buffout 1 set resetTimer to GameDaysPassed set active to 0 elseif ( used == 1 && button == 6 ) player.AddItem NVReboundChem 1 set resetTimer to GameDaysPassed set active to 0 else endif if ( used != 1 && button == 0 ) ShowMessage SnufflesChemSetMsg03 set used to 1 set resetTimer to GameDaysPassed - 2 set active to 1 elseif ( used != 1 && button == 1 ) ShowMessage SnufflesChemSetMsg04 set used to 1 set resetTimer to GameDaysPassed - 2 set active to 1 elseif ( used != 1 && button == 2 ) elseif ( used != 1 && button == 3 ) elseif ( used != 1 && button == 4 ) elseif ( used != 1 && button == 5 ) elseif ( used != 1 && button == 6 ) else endif end Link to comment Share on other sites More sharing options...
Snufflesdog Posted September 28, 2014 Author Share Posted September 28, 2014 Nevermind. I decided to just change to an OnLoad check. Posting revised code for anyone with a similar question. scn SnufflesChemSetSCRIPT int button float resetTimer short active short used begin OnLoad if ( used == 1 ) else set resetTimer to GameDaysPassed - 2 set active to 1 set used to 1 endif end begin OnActivate if IsActionRef player if ( GameDaysPassed - resetTimer >= 1 ) set active to 1 endif if ( active == 1 ) ShowMessage SnufflesChemSetMsg elseif ( active == 0 ) ShowMessage SnufflesChemSetMsg01 endif endif end begin MenuMode 1001 set button to GetButtonPressed if ( button == 1 ) player.AddItem Stimpak 1 set resetTimer to GameDaysPassed set active to 0 elseif ( button == 2 ) player.AddItem Mentats 1 set resetTimer to GameDaysPassed set active to 0 elseif ( button == 3 ) player.AddItem NVSteadyChem 1 set resetTimer to GameDaysPassed set active to 0 elseif ( button == 4 ) player.AddItem Psycho 1 set resetTimer to GameDaysPassed set active to 0 elseif ( button == 5 ) player.AddItem Buffout 1 set resetTimer to GameDaysPassed set active to 0 elseif ( button == 6 ) player.AddItem NVReboundChem 1 set resetTimer to GameDaysPassed set active to 0 else endif end Link to comment Share on other sites More sharing options...
Recommended Posts