Dimitrisgb Posted July 5, 2023 Author Share Posted July 5, 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.It doesn't work. The ghost never appear and the lights are always enabled. Link to comment Share on other sites More sharing options...
RomanR Posted July 6, 2023 Share Posted July 6, 2023 (edited) @Dimitrisgb:"It doesn't work. The ghost never appear and the lights are always enabled." I tested my approach with Seed-Neeus and found it working. According to my script she dissappeared at day and appeared only between 23:00 and 5:59, exactly as your ghosts should. Test quest script was: scn RomRDisableQuestScript float fQuestDelayTime begin GameMode set fQuestDelayTime to 1.0 ;let her appear between 23:00 and 5:59 hour only in her shop if GameHour >= 23 || GameHour < 6 if SeedNeeusRef.GetDisabled != 0 SeedNeeusRef.Enable endif else if SeedNeeusRef.GetDisabled == 0 SeedNeeusRef.Disable endif endif end In a worst case simply remove all GetDisabled functions as using them in a way you do doesn't have much sense. If your script still won't work, maybe you're using wrong references or having some script clash. Edited July 6, 2023 by RomanR Link to comment Share on other sites More sharing options...
Dimitrisgb Posted July 8, 2023 Author Share Posted July 8, 2023 How can I know if I have a script clash? Link to comment Share on other sites More sharing options...
RomanR Posted July 9, 2023 Share Posted July 9, 2023 If you have more than one script which could control your ghosts, disable them for testing purposes and leave active only one you want to test. By disabling I mean to temporaly remove the other scripts from their objects/quests/spells. If the one you're testing behaves normaly, then an error is in other ones. If not, that means you must fix a testing script first and continue only after that one is debugged. So for now I would debug the ghost script first as it's shorter. So ghots script after removing all GetDisabled functions will look like this: scn GHOUndeadTownEnemies begin GameMode if GameHour >= 23 || GameHour < 6 ;midnight to morning TownGhost1.Enable TownGhost2.Enable TownGhost3.Enable TownGhost4.Enable else TownGhost1.Disable TownGhost2.Disable TownGhost3.Disable TownGhost4.Disable endif end Now it shouldn't be hard to check it how it's core works. Link to comment Share on other sites More sharing options...
glowplug Posted July 10, 2023 Share Posted July 10, 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.How about an inversion of logic such that 1 function can handle object enabling while getting rid of the main 'else'. Of course, you've provided a correct answer but how about that, how about the thinking? EDIT: Okay, I've suggested the opposite of what I would do here. The time period in terms of enable is boolean and should be evaluated as such; when enable period is met it should be done once and flagged as done; when disable period is met it should be done once and flagged as done. Using OBSE this would be 2 functions where it would be cleaner to nest the time conditional function as a parameter. Link to comment Share on other sites More sharing options...
RomanR Posted July 10, 2023 Share Posted July 10, 2023 (edited) @glowplug: Yes, experienced scripter/coder will surely make more clean and optimized solutions. But as Dimitrisgb is at novice level and seems showing problems with abstract thinking in general (previous thread regarding changing texture paths was successfully solved only by seemingly unlimited patience of Striker879), I'm sticking to fix scripts he made only and only enhancing his approach to problems by things which in my opinion will bring more safety, stability or speed. Besides his one or two sentence answers aren't bring much insight too. And he is showing typical beginner mistake - working on too much things at once, creating too much errors at too much places, which he can't debug, because he can't find the source of them due to their count. Edited July 10, 2023 by RomanR Link to comment Share on other sites More sharing options...
glowplug Posted July 10, 2023 Share Posted July 10, 2023 Very wise RomanR, over a quarter of a century ago I told myself to never forget the learning curve - I'll remember this next time I post support code and so on. Link to comment Share on other sites More sharing options...
CHASE6 Posted July 11, 2023 Share Posted July 11, 2023 Very wise RomanR, over a quarter of a century ago I told myself to never forget the learning curve - I'll remember this next time I post support code and so on.I definitely see striker giving a lot of help to a lot of people, as alluded to by Roman. Theres a very nice community here of people who know a lot and help the rest of us; both of you guys included with striker, too, so thanks. Link to comment Share on other sites More sharing options...
Striker879 Posted July 11, 2023 Share Posted July 11, 2023 Don't forget to include yourselves in that line of thinking. I do my best to limit my responses to the things I have some experience with, but I also aspire to expand my abilities so I follow the questions and answers on this forum closely. Link to comment Share on other sites More sharing options...
RomanR Posted July 12, 2023 Share Posted July 12, 2023 (edited) Thank you all, it means a lot to me. But now it's Dimitrisgb's turn I believe. Edited July 12, 2023 by RomanR Link to comment Share on other sites More sharing options...
Recommended Posts