Markyevansy Posted October 31, 2017 Share Posted October 31, 2017 (edited) I've been working on the second version of my mod M0rk's Lighting which now features a dynamic weather system and all that jazz.But I've been wondering, is it possible to lower the perception value of all NPCs during a sandstorm? Cheers. (sorry if i posted this in the wrong place) Edited October 31, 2017 by Markyevansy Link to comment Share on other sites More sharing options...
EPDGaffney Posted November 2, 2017 Share Posted November 2, 2017 (edited) I'm a little surprised no-one has come by yet, because this is relatively simple if I'm not mistaken. Unless there's something I'm missing, it just needs an effect associated with the weather. I've never worked with weathers, so if there's no place to assign an effect, you can script it. The only ways I know of to get the script to run would be using a Begin block with either OnLoad or GameMode as the blocktype. With OnLoad, it should be more efficient if it works, as the script doesn't constantly need to check the weather, but it's probably safer to use the GameMode one, which if you use the default of checking every five seconds, shouldn't be a gigantic performance hit. So, if an effect works, you need to set up an effect, which is simple to do and there are countless tutorials if you don't find it intuitive. If you need to script it, you'll need a way to apply the ModAV command to all loaded actors, and whilst I've never needed to do that, this looked helpful: https://forums.nexusmods.com/index.php?/topic/5863193-trying-to-write-a-script-that-will-effect-all-loaded-npcs/ So, something like: scn MySandstormsIsTheBestSandstorms array_var aEntry ref rActor begin gamemode if GetIsCurrentWeather SandstormWeatherThatYouWishToUse foreach (aEntry <- GetRefs 200, -1) let rActor := *aEntry rActor.ModAV Perception -2 loop endif endThat script I wrote is not tested and uses NVSE, so it won't compile unless you run G.E.C.K. with NVSE, which I never got working but that's because I didn't try too hard. There's a lot of stuff on-line about it, so I'm sure that bit's easy enough. If it doesn't work, at least you have a starting point. You can try printing messages for testing to make sure the script is being run. I didn't think about it but maybe the sandstorm isn't actually a weather in and of itself, so maybe you can look into setting an effect on that, rather than the weather. Edited November 4, 2017 by EPDGaffney Link to comment Share on other sites More sharing options...
Markyevansy Posted November 2, 2017 Author Share Posted November 2, 2017 Thank you a lot for the help! I'll see what i can do with the script. Link to comment Share on other sites More sharing options...
EPDGaffney Posted November 2, 2017 Share Posted November 2, 2017 (edited) Sure. I'm interested to know if you get it working or not. If you keep posting back, I'll keep trying to help until someone better at this comes along. Or alternatively, if you get it working, perhaps I can put it on my CV and get a promotion. Note that I've removed the == operator in the script. Forgot that I learnt recently it's not necessary unless you want to get a specific value rather than simply making sure it's above 0, and it's more efficient to take advantage of that where possible. Edited November 2, 2017 by EPDGaffney Link to comment Share on other sites More sharing options...
Markyevansy Posted November 2, 2017 Author Share Posted November 2, 2017 (edited) Bad news, I couldn't get the script working. This line: let rActor := *aEntry gives me an error, "Invalid operands for operator :=", and I couldn't get it working due to my inexperience with NVSE scripts so I replaced it with a simpler script that only edits the player's PER only, though I wish every NPC gets the same treatment too. Oh well.Thanks for your help nonetheless. Edited November 2, 2017 by Markyevansy Link to comment Share on other sites More sharing options...
EPDGaffney Posted November 2, 2017 Share Posted November 2, 2017 Oh, I think that's because I forgot to declare it in the script because I'm a genius. I'm editing it now. Link to comment Share on other sites More sharing options...
Markyevansy Posted November 3, 2017 Author Share Posted November 3, 2017 (edited) Nope, same error. Edited November 3, 2017 by Markyevansy Link to comment Share on other sites More sharing options...
EPDGaffney Posted November 3, 2017 Share Posted November 3, 2017 I caught another error I made but it doesn't fix the script. It's in the latest edit none the less. I've tried loading it with JIP and that still doesn't fix it. I've tried with other operands and that doesn't fix it. I've tried with the underscore before GameMode and that didn't work. I've tried Ladez's original script and that doesn't work. I have a feeling that the script isn't the problem but that something needs to be updated or something, because Ladez tends to know what he's doing and the person he was responding to said it worked for him. I'll keep looking into it but I'm pretty lost as to what it could be at the moment. Link to comment Share on other sites More sharing options...
SGTbayk47 Posted November 3, 2017 Share Posted November 3, 2017 The script you're using will work fine, you just also have to declare 'rActor' as a ref in the script as well. Link to comment Share on other sites More sharing options...
EPDGaffney Posted November 4, 2017 Share Posted November 4, 2017 Wow...I wasn't absolutely certain that was true but I'd suspected it and I really thought that when I was testing I had put that in there. Thanks for your help. That makes a lot of sense. Link to comment Share on other sites More sharing options...
Recommended Posts