Script Firing Issues....

Post » Sat Oct 31, 2015 2:09 pm

As far as I understand you should be able to use the same script multiple times, adjusting it by changing the properties. Using ONE script over and over.

In my town mod I have the lights in every NPC house turn off at different times at night, as though the NPCs are turning off their house lights when they go to bed. I also have some events such as skeletons/ghosts appearing on the same script at different times.

I set these all up by attaching the script 'AutomaticLightSwitchScript' to a marker activator and parenting the light bulbs to it so that they 'enable' when the marker is enabled by the script. I used the same script for each NPC house and just changed the properties, which in that script are the time.

BUT the scripts are misfiring all over the place, lights are turning on during the day, ghosts appearing when they shouldn't etc. If you save game at any point, when you reload the scripts have misfired and lights etc that should not be on are on. I have to get this issue resolved for the updated release of the mod. The only thing that solves it is if I make a new script for every instance I use the script. For instance for every NPC house the same script under a new name is required.

I had this same issue when setting up my manual light switches. I could not use the same script on different activators or it seemed to affect every other activator with that same script on it. So I would flip the lever of one manual light and it would affect other separate lights that have the same script. I had to have three separate scripts (the same script under a different name) for my three manual light switches.

Hopefully I am explaining this correctly, I have a https://www.dropbox.com/s/g01w4qqd7ejvved/ShezriesOldHroldan1pt5.7z?dl=0 to the mod if anyone can help and needs to look at how I have it set up.

So I have 26 buildings in my mod. In order to have the Lighting Script work I would need to make 26 instances of the same script with a different name for each script. I cannot use the same script 26 times over as it misfires.

Would it just be easier to attach the scripts to the lightbulbs themselves and place those? That would place three or four scripted objects in each cell.

User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Sat Oct 31, 2015 3:53 pm

I can't really help, but for AGES I have wanted a mod that turns off internal lights and damps down fires when NPCs have gone to bed as it make playing a Burglar much more immersive. There are a lot of mods that alter lighting conditions and add lights, lanterns and street lamps etc, but I have never found one that does what I want, so I'll start tracking this.

I don't suppose something to synchronise the timescale to the in-game internal clock would help? I hear that using set timescale to in the console can break things, but I have never seen it happen in 42 months.

I do know that if you make any changes at all to your mod, especially scripts, you have to use a save that has never been touched by your mod to test the changes, but I am sure you know that already.

But what is the problem with having 26 scripts with 26 different names? Could you not just name them AutomaticLightSwitchScript001, AutomaticLightSwitchScript002 ....AutomaticLightSwitchScript026?

Also, do you think if you could fix this problem it would be possible to create a mod that does this for all NPC houses and shops across all of Skyrim, except for Taverns, Inns and Palaces, where people seem to be up all night anyway?

Cheers!

User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Sat Oct 31, 2015 5:30 pm

That's sort of what I was thinking, but not setting the timescale... using it in an event in a script. I searched for some sort of "OnGameHourOfDay = this" event but had no such luck. And unfortunately "OnSleepStart" only applies to the player, it seems. If you could have just one script running from a quest with all the light objects tied to it as properties, you could have it turn them on or off (I think? Not sure what the function is for that) every time the event you're watching for occurrs. Unfortunately, I can't find a good event that would work. Other than just "OnUpdate... is it night yet?"

But maybe I'm on the wrong track and the only way to turn lights on or off anyway is from scripts tied to them directly.

User avatar
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm

Post » Sat Oct 31, 2015 7:41 pm

Isn't OnUpdate very dangerous to use, from the point of view of save bloating?

User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am


Return to V - Skyrim