"'I've made a script, it works but..." the sequel
A bunch of NPC from my Pegasus Estate mod will also be having a schedule to make them move around the house.
To make matter smore complicated, the npcs are first disabled and only appear after a quest has been complete. Some of them also go on missions, so they get diabled again.
I've first looked at MWscheduler (findind this tool make me decided I'd use schedules in the first place) but had the same difficulties as Illy.
After much frustration, I looked at Princess Stomper's Leyawiin scripts (as she suggested in another thread) and found what I needed.
In the end, the scripts work as intended but...
Here are samples of the scripts
On npcs
Begin aa_alchemist_script Short doonce If ( aaHiredAlch == 0 ) If ( doonce == 0 ) Disable Set doonce To 1 EndIf Else If ( doonce == 1 ) Enable Set doonce To 0 EndIf EndIf...
On a hidden activator
Begin aa_PE_Schedule_main; Thanks to Galsiah, Yacoby, bjam and OldeCow69 for the tips. Concepts nicked from Helios, Wrye and COM. If ( MenuMode == 1 ) Return Else If ( GameHour > 23 ) If ( aaScheduleDay != 4 ) Set aaScheduleDay To 4 StartScript "aa_PE_schedule1" StartScript "aa_PE_schedule2" StartScript "aa_PE_schedule3" EndIf ElseIf ( GameHour < 5 ) If ( aaScheduleDay != 4 ) Set aaScheduleDay To 4 StartScript "aa_PE_schedule1" StartScript "aa_PE_schedule2" StartScript "aa_PE_schedule3" EndIf ...etc... EndIf End
The global script
Begin aa_PE_schedule3 ; thanks to Galsiah, Yacoby, bjam and OldeCow69 for advice Short state If ( aaScheduleDay == 1 ) ; morning If ( state == 0 ) ; break up script "aa_maid"->PositionCell 3994 5568 15943 225 " Vestibule" "aa_merchant"->PositionCell 152083 -4132 97 315 " Pegasus Grounds" "aa_miner"->PositionCell 4014 6330 877 280 " Mine" "aa_necro"->PositionCell 4479 3745 16000 182 " Crypt, Arkana room" "aa_sailor"->PositionCell 151143 -7242 84 45 " Pegasus Grounds" Set state To 1 Return ElseIf ( state == 1 ) "aa_seamstress"->PositionCell 3694 3957 12138 251 " Gold Kanet quarters" "aa_servicemage"->PositionCell 4053 3731 15000 110 " Syrabane Room" "aa_smith"->PositionCell 152536 -4918 103 16 " Pegasus Grounds" "aa_thief"->PositionCell 3732 3894 14907 135 " Great Hall" Set state To 2 Return EndIf EndIf If ( aaScheduleDay == 2 ) ; lunch break If ( state < 3 ) ...........etc............ StopScript "aa_PE_schedule3" Set state To 0 End
The glitch I get is this: when the time changes (from night to morning for e.g.) the diabled npcs of the cell (the one with the hidden activator) are kinda visible: at first just a black shape, then with colour. They have no collision but the names do appear. Obviously activating them makes the game crash. Leaving the cell and coming back fixed everything.
I am tempted to use a variable, say aaScheduleControl and add these lines to the main script:
If ( aaScheduleControl ) == 0 returnendif
and set the variable to one only after all the npcs have been enabled. It's a last resort thing that I haven't even tested yet.
Any way I can fix this, besides having the activator in a cell with no npc, which I don't have?
If you know of some way to streamline the scripts, this is forever and ever welcome too