My attack delay mod works the same way, but the conditions are much more flexible:
1) If you start doing the main quest and get far enough that spies might become aware of you and your background (completing the Informant quest, the one with the puzzle box)
2) If you start the backdoor quest
3) If you beat the final boss, even if the backdoor and main quest aren't started
4) If you become level 5 or higher (so that the attacks start if you run around looting red mountain or something else that would trigger suspicion in a real world but isn't accounted for by the above three conditions)
The DB will only attack if at least one of these four conditions is true.
I didn't actually test conditions 1/2/3, but I'm pretty sure they're right.
Relevant code:
Code: Select all
short goodtogo
set goodtogo to 0
; Index 5 of this quest is the earliest point in the main
; quest that the protagonist is expected to talk to anyone
; about the Nerevarine prophecies.
; However, if a newbie gets assaulted by assassins on the
; way to the dungeon, and they never got assaulted by
; assassins before, it be SUPER janky, so I'll use the
; "gave the puzzle box to Antabolis" index instead.
if ( GetJournalIndex A1_2_AntabolisInformant >= 10 )
set goodtogo to 1
endif
; We can also do it if they're doing the backdoor.
if ( GetJournalIndex CX_BackPath > 0 )
set goodtogo to 1
endif
; If they somehow completed the main quest without
; doing any of the above (which is entirely possible)
; we should account for that, too.
if ( GetJournalIndex C3_DestroyDagoth == 50 )
set goodtogo to 1
endif
; Alternatively, we can assume the protagonist is "good to go"
; if they're high enough level.
if ( player->GetLevel >= 5 )
set goodtogo to 1
endif
if ( goodtogo == 0 )
return
endif