majinshinsa Posted April 18, 2011 Share Posted April 18, 2011 i want to have different levels of drunkenness in a mod and cant get it to quite work. It will always set off the first imagespace modifier but wont change if more beer is drunk. i have it run as an effect on beer. latest (have tried quite a few different versions, latest is using a global var i made)scn drunkeneffect begin ScriptEffectStart GetGlobalValue drinkingbeer if drinkingbeer == 5 RemoveImageSpaceModifier Drinking5 ApplyImageSpaceModifier Drinking6 endif if drinkingbeer == 4 RemoveImageSpaceModifier Drinking4 ApplyImageSpaceModifier Drinking5 set drinkingbeer to 5 endif if drinkingbeer == 3 RemoveImageSpaceModifier Drinking3 ApplyImageSpaceModifier Drinking4 set drinkingbeer to 4 endif if drinkingbeer == 2 RemoveImageSpaceModifier Drinking2 ApplyImageSpaceModifier Drinking3 set drinkingbeer to 3 endif if drinkingbeer == 1 RemoveImageSpaceModifier Drinking1 ApplyImageSpaceModifier Drinking2 set drinkingbeer to 2 endif if drinkingbeer == 0 ApplyImageSpaceModifier Drinking1 set drinkingbeer to 1 endif end begin ScriptEffectFinish RemoveImageSpaceModifier Drinking1 RemoveImageSpaceModifier Drinking2 RemoveImageSpaceModifier Drinking3 RemoveImageSpaceModifier Drinking4 RemoveImageSpaceModifier Drinking5 RemoveImageSpaceModifier Drinking6 set drinkingbeer to 0 end also using just has my global increase from 0 to 1 but not any higher. if i could just figure how to increase the global i can get this thing to work since i could do just a regular script that runs if my global is set to anything higher than 1. am i just missing something really simple???? int beers begin ScriptEffectStart set beers to drinkingbeer set beers to beers + 1 set drinkingbeer to beers end Link to comment Share on other sites More sharing options...
rickerhk Posted April 18, 2011 Share Posted April 18, 2011 Don't use this in a script: GetGlobalValue. It's for conditions (like in topics) only.Just use the variable name: drinkingbeer Edit - In the second script snippet, beers always starts as zero when the effect is applied. It isn't preserved. Link to comment Share on other sites More sharing options...
majinshinsa Posted April 19, 2011 Author Share Posted April 19, 2011 all im trying to do is attach a script to beer (for now) that increases a global setting. i have realized any script variable isnt saved because each beer will run its own version of the script, which is why i want to use the global value. all i need to figure out is how to permanently raise my global. i cant get the global to report anything higher than 1 unless i set it manually. its almost like its either 0 (off) or 1 (on) could i possibly need script extender to get this to work? scn drunkeneffectbeer begin ScriptEffectStart set drinkingbeer to ++1 end no matter what i type for addition (ie set drinkingbeer to drinkingbeer + 1, set drinkingbeer to +1) it will always read 1 but never higher... Link to comment Share on other sites More sharing options...
rickerhk Posted April 19, 2011 Share Posted April 19, 2011 I don't think this is doing what you expect:set drinkingbeer to ++1The script is just setting it to one - not incrementing it. Do it this way:set drinkingbeer to drinkingbeer + 1 Link to comment Share on other sites More sharing options...
tunaisafish Posted April 19, 2011 Share Posted April 19, 2011 majinshinsa, you mentioned NVSE. It's a good idea to use while debuging your scripts even if you don't actually need the features in the release version. Use the printc function to see if your script is actually running when you think it is.Put this line in your block, and view the console when testing your mod ingame.printc "Beer ScriptEffectStart" I'm guessing that this is only running when you consume the first beer, and is skipped on subsequent beers as the effect has already started.Does the global increase if you let the beer effect wear off first?(I've not had use myself for an effect script so this is just speculation) The other thing I'd do is right click on the global and choose 'Use Info' to see if I'd written anything else that changes it. Link to comment Share on other sites More sharing options...
Recommended Posts