glowplug Posted June 26, 2023 Share Posted June 26, 2023 scn EnableStuffOncePerGameHours int iEnabled Begin GameMode if 6 < GameHour && GameHour <= 18 && iEnabled == 0 let iEnabled := 1 ;enable stuff once in this time elseif (6 >= GameHour || GameHour > 18) && iEnabled == 1 let iEnabled := 0 ;disable stuff once in this time endif End Link to comment Share on other sites More sharing options...
glowplug Posted June 26, 2023 Share Posted June 26, 2023 The time period is either inclusive or exclusive - boolean.The requirement, per time period, is either achieved or not - boolean. Have I missed something here? Link to comment Share on other sites More sharing options...
glowplug Posted June 26, 2023 Share Posted June 26, 2023 The heading states "NPC's" which qualifies 1 NPC - the code would be on it. The grammar on the heading suggests a request for action on multiple NPCs - that code would have a somewhat different structure to the singularity. I provided object enabling code but various NPCs would have other requirements. Link to comment Share on other sites More sharing options...
RomanR Posted June 26, 2023 Share Posted June 26, 2023 Hey there. I am trying to do something similar with lights amd leveled creatures. But it doesn't work. This time, both of them are enabled in the time during which I don't want them. Propably something wrong with condition or variable setting in a script which control them, but without seeing the actual script I can only guess. Link to comment Share on other sites More sharing options...
glowplug Posted June 28, 2023 Share Posted June 28, 2023 @OblivionAddicted: I would add some checking to not execute Disable or Enable commands at all times. ScriptName DrimitriSGBActivateNightlyNPCScript begin GameMode if GameHour >= 18 || GameHour < 6 if ELSHunbalSpirit.GetDisabled != 0 ELSHunbalSpirit.Enable endif else if ELSHunbalSpirit.GetDisabled == 0 ELSHunbalSpirit.Disable endif endif end He is using ELSHunbalSpirit reference name from ELSHunbal base NPC, if you're wondering why I didn't add Ref suffix to reference ID.Sorry to confuse things RomanR, having bicycled around 80km on the day of my previous post, I was a bit manic. I completely missed the GetDisabled, let alone overlooking it as the solution. Link to comment Share on other sites More sharing options...
RomanR Posted June 30, 2023 Share Posted June 30, 2023 @glowplug: There wasn't need to apologize to me, I didn't feel to be offended in any way. But it seems you're reffering to tha part of this thread which seems already solved? Again, as it's propably some new issue, Dimitrisgb should present actual script to be examined for (assuming logical) errors. Link to comment Share on other sites More sharing options...
Dimitrisgb Posted July 2, 2023 Author Share Posted July 2, 2023 Hi there. Thanx for the responses. This is the script for the creatures (ghosts):scn GHOUndeadTownEnemies begin GameMode if GameHour >= 23 || GameHour < 6 TownGhost1.GetDisabled != 0 TownGhost1.Enable TownGhost2.GetDisabled != 0 TownGhost2.Enable TownGhost3.GetDisabled != 0 TownGhost3.Enable TownGhost4.GetDisabled != 0 TownGhost4.Enable else TownGhost1.GetDisabled != 0 TownGhost1.Disable TownGhost2.GetDisabled != 0 TownGhost2.Disable TownGhost3.GetDisabled != 0 TownGhost3.Disable TownGhost4.GetDisabled != 0 TownGhost4.Disable endif end Link to comment Share on other sites More sharing options...
Dimitrisgb Posted July 2, 2023 Author Share Posted July 2, 2023 And this is for the lights:scn ELSRhondalCityLights begin GameMode if GameHour >= 20 || GameHour < 6 RenasHouseLight.GetDisabled != 0 RenasHouseLight.Enable PlayersHouseLight1.GetDisabled != 0PlayersHouseLight1.EnablePlayersHouseLight2.GetDisabled != 0PlayersHouseLight2.EnableMageMinaretLight.GetDisabled != 0MageMinaretLight.EnableTempleExtLight1.GetDisabled != 0TempleExtLight1.EnableTempleExtLight2.GetDisabled != 0TempleExtLight2.EnableMinaretExtLight.GetDisabled != 0MinaretExtLight.Enable MelinaShopLight.GetDisabled != 0MelinaShopLight.Enable else RenasHouseLight.GetDisabled != 0 RenasHouseLight.Disable PlayersHouseLight1.GetDisabled != 0PlayersHouseLight1.DisablePlayersHouseLight2.GetDisabled != 0PlayersHouseLight2.DisableMageMinaretLight.GetDisabled != 0MageMinaretLight.DisableTempleExtLight1.GetDisabled != 0TempleExtLight1.DisableTempleExtLight2.GetDisabled != 0TempleExtLight2.DisableMinaretExtLight.GetDisabled != 0MinaretExtLight.DisableMelinaShopLight.GetDisabled != 0MelinaShopLight.Disable endifend Link to comment Share on other sites More sharing options...
Oblivionaddicted Posted July 3, 2023 Share Posted July 3, 2023 The script looks well but your ref ID are too generic, you should include your nickname and the acronym of your mod to prevent conflicts. Link to comment Share on other sites More sharing options...
RomanR Posted July 3, 2023 Share Posted July 3, 2023 There are opposite checkings after else commands in both scripts you present - should be GetDisabled == 0 scn GHOUndeadTownEnemies begin GameMode if GameHour >= 23 || GameHour < 6 ;midnight to morning if TownGhost1.GetDisabled != 0 ;ghost IS disabled TownGhost1.Enable endif if TownGhost2.GetDisabled != 0 TownGhost2.Enable endif if TownGhost3.GetDisabled != 0 TownGhost3.Enable endif if TownGhost4.GetDisabled != 0 TownGhost4.Enable endif else if TownGhost1.GetDisabled == 0 ;ghost IS NOT disabled TownGhost1.Disable endif if TownGhost2.GetDisabled == 0 TownGhost2.Disable endif if TownGhost3.GetDisabled == 0 TownGhost3.Disable endif if TownGhost4.GetDisabled == 0 TownGhost4.Disable endif endif end Similar in second script. Link to comment Share on other sites More sharing options...
Recommended Posts