# pre_sleep_events menu_off = 1 !! Pre-sleep events trigger after deciding to go to sleep, but before dreaming and falling asleep (and thus before the auto-save). !! !! Moved here from pre_sleep !! When done: move to pre_sleep, pre_sleep2 !!=====================================!! !! !! !! Event handlers !! !! !! !!=====================================!! if $ARGS[0] = 'start' or $ARGS[0] = '': menu_off = 1 killvar '$sleep_events' killvar '$sleep_events_priority' if sleepVars['events_active'] = 1: sleepVars['events_done'] = 0 if succubusQW = 2: $sleep_events_priority[] = 'gs ''pre_sleep_events'', ''suc_event'' ' end if magf2bdo = 2: $sleep_events_priority[] = 'gs ''pre_sleep_events'', ''magb_event'' ' end if nichGalaOpponent = 30 and hour >= 19 and nichDebug = 1: !! Start abduction !! TODO $sleep_events_priority[] = 'gs ''pre_sleep_events'', ''nichServentSleepEvents_handler'', 2 ' elseif nichGalaContractTaras = 1 and daystart >= nichGalaContractTarasLast + rand(3, 10): !! Taras visits $sleep_events_priority[] = 'gs ''pre_sleep_events'', ''nichServentSleepEvents_handler'', 1 ' end if $loc = 'HotelRoom' and $loc_arg = 'therapist' and locat['A186'] = 2: $sleep_events_priority[] = 'gs ''therapist_home'', ''pre_sleep'' ' end if daystart > sleepVars['sleep_reflection_day']: gs 'sleep_reflections', 'event_check' xgt 'pre_sleep_events', 'mod_sleepevents' end xgt 'pre_sleep_events', 'continue' end if $ARGS[0] = 'mod_sleepevents': !! This location is here to allow mods to hook into the system. !! Check for: if $ARGS[0] = 'pre_sleep_events' and $ARGS[1] = 'mod_sleepevents' !! !! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' ' !! A random event will be chosen from amongst the added ones. !! If an event MUST trigger (due to quest timing), add it to $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' ' !! !! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'pre_sleep_events', 'event_end' !! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'pre_sleep_events', 'exit' !! Example: Act: 'Leave': gs 'pre_sleep_events', 'exit' & gt $new_loc, $new_log_arg !! !! This is to cleanup all necessary variables. !! !! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!! !! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED. gs 'LOCA', 'pre_sleep_events', 'mod_sleepevents' xgt 'pre_sleep_events', 'event_handler' end if $ARGS[0] = 'event_handler': if sleepVars['events_done'] < 1: if arrsize('$sleep_events_priority') > 0: gt 'pre_sleep_events', 'event_handler2', 'priority' elseif arrsize('$sleep_events') > 0: gt 'pre_sleep_events', 'event_handler2' end end xgt 'pre_sleep_events', 'continue' end if $ARGS[0] = 'event_handler2': sleepVars['events_done'] += 1 if $ARGS[1] = 'priority': temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1) $temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id] killvar '$sleep_events_priority', temp_slev_id else temp_slev_id = rand(0, arrsize('$sleep_events')-1) $temp_sleep_event_chosen = $sleep_events[temp_slev_id] killvar '$sleep_events', temp_slev_id end killvar 'temp_slev_id' dynamic $temp_sleep_event_chosen xgt 'pre_sleep_events', 'event_end' end if $ARGS[0] = 'event_end': killvar '$temp_sleep_event_chosen' !! if arrsize('$sleep_events_priority') > 0: !! gt 'bed_events', 'event_handler2', 'priority' !! end xgt 'pre_sleep_events', 'event_handler' end if $ARGS[0] = 'exit': sleepVars['events_done'] = 0 killvar '$sleep_events' killvar '$sleep_events_priority' killvar 'temp_slev_id' killvar '$temp_sleep_event_chosen' InSleep = 0 end if $ARGS[0] = 'continue': sleepVars['events_done'] = 0 killvar '$sleep_events' killvar '$sleep_events_priority' killvar 'temp_slev_id' killvar '$temp_sleep_event_chosen' xgt 'pre_sleep', 'pre_sleep2' end !!=====================================!! !! !! !! Events !! !! !! !!=====================================!! if $ARGS[0] = 'suc_event': gt 'pre_sleep_events', 'succhoice' end if $ARGS[0] = 'magb_event': gt 'pre_sleep_events', 'magbstchoice' end if $ARGS[0] = 'nichServentSleepEvents_handler': if ARGS[1] = 1: !! the 100 events return back to sleep! gt 'nichBedroomServant', 'sleepEvents', 100 elseif ARGS[1] = 2: gs 'pre_sleep_events', 'exit' gt 'nichBedroomServant', 'sleepEvents', 1000 end end if $ARGS[0] = 'succhoice': menu_off = 1 minut += 15 gs 'stat' cla if $clothingworntype ! 'nude': '