irswat Posted March 11, 2014 Share Posted March 11, 2014 (edited) Why won't this script in the GameMode block of my mod refresh? It's like it takes the information from the first time it runs for each instance of the NPC (rSniper), and while it cycles as can be seen by the debug messages going through the various instances of rSniper, the actual data for each sniper never updates after the first time. The data that isn't updating is GetDistance, IsDead (DSniperAF), and GetDetected. I've included the code and a copy of the esm if you can help me.Also if you can help me figure out why the snipers won't detect the player (even standing next to them sometimes) I would be thankful and would give you credit when the mod is done. I'm trying to get these snipers to react to the player from 8000-11000 units away but I'm lucky if they react at 4000 units away at present. scn SniperModScript float hfPlayer int AlertFlag int rDSniperAF ref rSniper begin GameMode set AlertFlag to 0 set rDSniperAF to 0 set rSniper to 00000000 set hfPlayer to 0 MessageEx "Sniper Mod Debug Game Mode" set rSniper to GetSelf set hfPlayer to GetDistance player if GetDead == 1 MessageEx "Sniper %i is dead" rSniper set AlertFlag to 0 set rDSniperAF to 1 endif if hfPlayer <= 11000 if rDSniperAF != 1 MessageEx "Sniper %i is %g units away" rSniper hfPlayer set AlertFlag to 1 endif endif if hfPlayer > 11000 set AlertFlag to 0 MessageEx "Player out of range by %g units." (hfPlayer-11000) endif if AlertFlag == 1 Look rSniper rSniper.Look player MessageEx "Player within range." if rSniper.GetDetected player == 1 MessageEx "Player detected. Firing!" rSniper.UseWeapon WeapNVGhillieSniperRifle rSniper player 6 0 0 0 0 if player.GetDead == 1 set AlertFlag to 0 endif elseif rSniper.GetDetected player == 0 MessageEx "%i unable to detect player. Unable to fire" rSniper endif endif end Edited March 12, 2014 by irswat Link to comment Share on other sites More sharing options...
irswat Posted March 12, 2014 Author Share Posted March 12, 2014 I tried making this a quest script, and setting its interval to .5 (2x a second) to no avail. The debug messages still wont update. I assume it's because the variables aren't updating. Link to comment Share on other sites More sharing options...
alienzerox Posted March 12, 2014 Share Posted March 12, 2014 hey I've been sorta following this progress of yours (oh that didn't sound at all creepy) but I would like to see this mod made, period. that being said maybe you need to step back just a little to reflect on the problem at hand ... first is the esp you created loaded near the bottom of the LO ... bc you know the rule that last to load wins? could it be that your script actually does work but isn't firing bc it is being over written by something else in your LO below it Link to comment Share on other sites More sharing options...
irswat Posted March 12, 2014 Author Share Posted March 12, 2014 (edited) hmm. Will try. Thanks for the encouraging word. I was actually loading this pretty high up in my load order. I have about 300 active mods. Most are in merged esps. Edited March 12, 2014 by irswat Link to comment Share on other sites More sharing options...
alienzerox Posted March 12, 2014 Share Posted March 12, 2014 yeup np let us know if it worked itself out ... bc I realiy need a challenge being lvl 50 with signature armor & weapon ... I can pretty much one hit head shot any npc beyond range with my custom scope & rifle Link to comment Share on other sites More sharing options...
irswat Posted March 13, 2014 Author Share Posted March 13, 2014 (edited) do you do any modding? the snipers are already very challenging when I place them on rocks and in various nooks and crevices. They catch you by surprise and if you arent careful they will kill you before you can even react to them. When I place them on the sniper towers they hardly react at all. I think it's because there is no LOS, and LOS is calculated FROM THE FEET! Who's idea was that?!Pretty high up there on the list of the worst ideas ever. I would like to see them start shooting at the player from the same distance the player can see them through a sniper scope. I have come close but still haven't achieved it.still can't get this stupid script to update its values. Edited March 13, 2014 by irswat Link to comment Share on other sites More sharing options...
MarchUntoTorment Posted March 13, 2014 Share Posted March 13, 2014 If I might advise, irswat - Also going to need to consider draw distances. NV's draw distances are actually really short - I remember that after I first started playing on minimum settings, I'd be getting shot by NPCs who I couldn't see, my distances were set so low. Link to comment Share on other sites More sharing options...
irswat Posted March 13, 2014 Author Share Posted March 13, 2014 (edited) Yea, that isnt the issue I'm having. Right now I can't get the script to refresh. It's the same thing over and over and over. Here is the script and download again if you want to play with it. There are snipers all the way from goodspring to primm. only 1 is not in a sniper tower and it is the only one behavaing remotely similar to the way I would like them all to. Anyone who can help me get these snipers to react from far away, and/or get this script to update in real time as it should gets a cookie and a shout out when the mod gets released.I've spent about 100 hours on this stupid little script already and I'm just getting very frustrated with trying different things with no luck at all. There is an old script in here called OldSniperScriptUnoptimized. It is ugly, incomplete, and unoptimized; it was the first script I wrote for this mod and it actually worked the best of all the scripts put together so far for this mod. The mod I am currently using is called SniperModScript. There is also a version in there called JIPSSnazzySniperScript that I didn't have any luck with either.https://www.dropbox.com/s/w08sxdbyytfr7qu/SniperModWIP.espthe script in its current form (the snipers in the sniper towers dont work AT ALL. If you change the script to JIPs' version or the old unoptimized version they do): scn SniperModScript float hfPlayer int AlertFlag int rDSniperAF ref rSniper begin GameMode set AlertFlag to 0 set rDSniperAF to 0 set rSniper to 00000000 set hfPlayer to 0 if player.IsInInterior == 1 MessageEx "Debug Disabled [inside]." elseif player.IsInInterior == 0 MessageEx "Sniper Mod Debug Game Mode" set rSniper to GetSelf set hfPlayer to GetDistance player if GetDead == 1 MessageEx "Sniper %i is dead" rSniper set AlertFlag to 0 set rDSniperAF to 1 endif if hfPlayer <= 11000 if rDSniperAF == 0 MessageEx "Sniper is %g units away" hfPlayer set AlertFlag to 1 endif elseif hfPlayer > 11000 set AlertFlag to 0 MessageEx "Player out of range by %g units." (hfPlayer-11000) endif if AlertFlag == 1 Look player MessageEx "Player within range. Firing!" UseWeapon WeapNVGhillieSniperRifle rSniper player 6 0 0 1 0 if player.GetDead == 1 set AlertFlag to 0 endif endif endif end The script is attached to the NPC. This script should run many times per second for each instance of the NPC SMSniper01. If there are 4 instances of SMSniper01 loaded it should cycle through each instance and conditionally report the status of each. It does this as it should. The problem is that it never updates. It keeps repeating the state of each sniper as it was the first time even if the sniper has died, respawned, and the distance reported for each sniper isn't updating either.When I went inside after like 1 minute I got the message "Debug Mode Disabled [inside]" it should have happened immediately, and kept repeating until I went outside. It only flashed once. I went outside and the (unrefreshed) debug mode messages correctly started displaying, so I went back inside and the debug messages continued even after waiting 3 days inside. Why do the variables for this script refuse to update?! It is an object script running in GameMode and I am baffled! Eventually I'd love to steal an idea from JIP and make certain factors effect the likelihood of being detected (e.g. sneak skill level, stealth, day/night, etc). First I have to get the sniper reacting to the player 100% of the time before I can play with algorithims simulating the snipers detecting the player. Eventually I'm going to make them compatible with the radar mods so they don't show up on radar so easy. Then I would like to try to create prone versions of the snipers. Lastly I want to create an entire new world space that links the 109 sniper towers underground (from the sniper tower mod, I can't take credit but I do have permission to use his work. His name is VonWolsung, his mod is here), and some quests that add some background story. I have some neat ideas but I need to get the snipers working first!p.s. if anyone can instruct me how to get this script to run only 1 time per second (per NPC) without having to make this a quest script I would appreciate it.p.p.s. going to try to use StartCombat instead of useweapon Edited March 13, 2014 by irswat Link to comment Share on other sites More sharing options...
alienzerox Posted March 13, 2014 Share Posted March 13, 2014 (edited) yeah I actually do make the occasional mod... I just DLed ur WIP.esp >>> why do you have so many dependencies? it looks like one of my merge patches and I have a feeling I know why they are not reacting when they are up in the tower ... how are the towers built are they enclosed up on top ... or are they part of the exterior cell? I got that from you saying that the only sniper that behaves like you want it to is "not in a tower" Edited March 13, 2014 by alienzerox Link to comment Share on other sites More sharing options...
irswat Posted March 13, 2014 Author Share Posted March 13, 2014 (edited) I have uploaded the correct version of the mod Alien. The only snipers can be found on a test sniper tower outside of goodspring. https://www.dropbox.com/s/w08sxdbyytfr7qu/SniperModWIP.esp Edited March 13, 2014 by irswat Link to comment Share on other sites More sharing options...
Recommended Posts