For town reputation
Its been check in procedure critter_p_proc, see for example Acwarior (warrior from Arroyo)
if (REP_ENEMY_ARROYO) then begin
attack(dude_obj);
Enemy_Arroyo is name for global variable (see files in headers folder) Its ben increased when you do some wrong actions for example attack someone from village:
procedure damage_p_proc begin
set_global_var(GVAR_ENEMY_ARROYO,1);
Mostly see Reppoint.h (file in headers folder) where is storaged info about raputation for example:
#define town_rep_is_idolized (global_var(TOWN_REP_VAR) >= 30)
#define town_rep_is_liked global_var(TOWN_REP_VAR) >= 15)
#define town_rep_is_accepted (global_var(TOWN_REP_VAR) >= 1)
Every actions could increase or decrease points of some global variable and NPC test this amount, gived different reactions for bad and good.
But i never used this system in mod so i can give you only these few clues.