INIT
DB_JailDistance(1,5);
KB Section
IF
CharacterSawCharacter(Guard, Player)
AND
CharacterGetDistanceToItem(Character_Player1, ITEM:Brazier, _CharDist)
AND
DB_JailDistance(1, _CheckDistINT)
AND
Real(_CheckDistINT, _CheckDistREAL)
AND
RealMax(_CharDist, _CheckDistREAL, _MaxDist)
AND
Integer(_MaxDist, _MaxDistInt)
AND
NOT DB_JailDistance(1, _MaxDistInt)
THEN
Stuff
A few more lines to swap variable types around

Btw, the ITEM:Brazier will be whatever item you're comparing against. I just used a Brazier for example's sake.
I really appreciate you taking time to help me!
That being said. It doesnt work
Just for clarification ill post back my edited version for my story editor.
IF
CharacterSawCharacter(CHARACTER_LUCS_NPC_M_N_ImmaculatePrisonPatrolGuardBase_000, CHARACTER_Player2)
AND
CharacterGetDistanceToItem(CHARACTER_Player2, ITEM_FUR_Pris_TortureChair_A_000, _CharDist)
AND
DB_JailDistance(1, _CheckDistINT)
AND
Real(_CheckDistINT, _CheckDistREAL)
AND
RealMax(_CharDist, _CheckDistREAL, _MaxDist)
AND
Integer(_MaxDist, _MaxDistInt)
AND
NOT DB_JailDistance(1, _MaxDistInt)
THEN
CharacterAddAbilityPoint(CHARACTER_Player2, 20);
Noaloha's idea might be the best one i've heard actually.. You might call it "ghetto" scripting noal but its simple and i cant think of a reason it wouldnt work.