I used the following code to do this in my own module, and it worked fine (bit of my own database code, but you get the picture):
int prr_GetIsReputationInitialized(object oTarget, object oSourceFactionMember)
{
if (GetFactionEqual(oTarget, oSourceFactionMember))
return TRUE;
string sFaction = prr_GetFaction(oSourceFactionMember);
string sFaction2 = prr_GetFaction(oTarget);
if (ss_GetDatabaseInt(PRR_REPUTATION_INIT_PREFIX + sFaction + "_" + sFaction2))
return TRUE;
else
return ss_GetDatabaseInt(PRR_REPUTATION_INIT_PREFIX + sFaction2 + "_" + sFaction);
}
void prr_InitializeReputation(object oTarget, object oSourceFactionMember)
{
if (GetFactionEqual(oTarget, oSourceFactionMember))
return;
int nAmount = GetReputation(oSourceFactionMember, oTarget);
string sFaction = prr_GetFaction(oSourceFactionMember);
string sFaction2 = prr_GetFaction(oTarget);
prr_SetExternalReputation(oSourceFactionMember, oTarget, nAmount, sFaction, sFaction2);
ss_SetDatabaseInt(PRR_REPUTATION_INIT_PREFIX + sFaction + "_" + sFaction2, 1);
ss_SetDatabaseInt(PRR_REPUTATION_INIT_PREFIX + sFaction2 + "_" + sFaction, 1);
}
void prr_LoadFactionReputations()
{
object oTargetFocus = GetObjectByTag(PRR_FACTION_FOCUS);
object oSourceFocus;
string sTargetFaction;
string sSourceFaction;
int nCurrentRep;
int nStoredRep;
int nChange;
int nIndex;
int nIndex2;
while(GetIsObjectValid(oTargetFocus))
{
nIndex2 = 0;
sTargetFaction = prr_GetFaction(oTargetFocus);
oSourceFocus = GetObjectByTag(PRR_FACTION_FOCUS);
while(GetIsObjectValid(oSourceFocus))
{
if(!GetFactionEqual(oTargetFocus, oSourceFocus))
{
if(prr_GetIsReputationInitialized(oTargetFocus, oSourceFocus))
{
sSourceFaction = prr_GetFaction(oSourceFocus);
nCurrentRep = GetReputation(oSourceFocus, oTargetFocus);
nStoredRep = prr_GetExternalReputation(oSourceFocus, oTargetFocus, sSourceFaction, sTargetFaction);
nChange = nStoredRep - nCurrentRep;
AdjustReputation(oTargetFocus, oSourceFocus, nChange);
}
else
prr_InitializeReputation(oTargetFocus, oSourceFocus);
}
nIndex2++;
oSourceFocus = GetObjectByTag(PRR_FACTION_FOCUS, nIndex2);
}
nIndex++;
oTargetFocus = GetObjectByTag(PRR_FACTION_FOCUS, nIndex);
}
}
I did have an issue like what you described, but at a different place. It turned out that the AdjustFactionReputation() function in nw_i0_plot was bugged. Doesn't look to be what's going on here, but thought I'd throw that out there.
Modifié par Squatting Monk, 22 janvier 2012 - 01:04 .