Looks like you could change the GetDistanceBetween value so it only triggers when you are closer (currently appears to be 15m):
void main() {
int int1 = GetUserDefinedEventNumber();
if ((int1 == 1001)) {
if ((!sub1(OBJECT_SELF, intGLOB_118))) {
sub2(OBJECT_SELF, intGLOB_118, 1);
}
else {
if ((!sub1(OBJECT_SELF, intGLOB_119))) {
sub2(OBJECT_SELF, intGLOB_119, 1);
}
else {
sub2(OBJECT_SELF, intGLOB_118, 0);
sub2(OBJECT_SELF, intGLOB_119, 0);
if (((!GetIsConversationActive()) && (GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) < 15.0))) {
sub3("ONE LINER", 5, 5, 5.0);
SetGlobalBoolean("TAR_GORTONONELINER", 1);
ClearAllActions();
ActionStartConversation(OBJECT_SELF, "", 0, 0, 1, "", "", "", "", "", "");
sub4();
}
}
}
It could also be that sub3 is providing a delay timer, which would be 5 seconds if so.
void sub3(string stringParam1, int intParam2, int intParam3, float floatParam4);