The $faction variable does not give the quest NPC the actual faction points, it gives a number from 1-9, representing the faction message the user would get when conning the NPC.
However, for some reason, the current numbers are out of whack once you get below indifferent:
File: faction.h
Code:
enum FACTION_VALUE {
FACTION_ALLY = 1,
FACTION_WARMLY = 2,
FACTION_KINDLY = 3,
FACTION_AMIABLE = 4,
FACTION_INDIFFERENT = 5,
FACTION_APPREHENSIVE = 9,
FACTION_DUBIOUS = 8,
FACTION_THREATENLY = 7,
FACTION_SCOWLS = 6
};
File: faction.cpp
Code:
if(character_value >= 1101) return FACTION_ALLY;
if(character_value >= 701 && character_value <= 1100) return FACTION_WARMLY;
if(character_value >= 401 && character_value <= 700) return FACTION_KINDLY;
if(character_value >= 101 && character_value <= 400) return FACTION_AMIABLE;
if(character_value >= 0 && character_value <= 100) return FACTION_INDIFFERENT;
if(character_value >= -100 && character_value <= -1) return FACTION_APPREHENSIVE;
if(character_value >= -700 && character_value <= -101) return FACTION_DUBIOUS;
if(character_value >= -999 && character_value <= -701) return FACTION_THREATENLY;
if(character_value <= -1000) return FACTION_SCOWLS;
return FACTION_INDIFFERENT;
I'm not aware of a way for a quest script to check faction against a different NPC.