I use the PRR system for custom factions and have about 40 total. However I have a bug that I cannot get rid of. It seems that my function is running adjust reputation twice on some of my custom faction creatures.
Here are my functions
This is in on module load:
DelayCommand(5.0, PRR_LoadModule());
This is PRR_LoadModule:
void PRR_LoadModule(){AWA_DEBUG( "Loading faction information..."); //debug
//AssignCommand(GetModule(), PRR_LoadFaction());//*AWA_LOAD_FACTORDelayCommand(1.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(1.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(2.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(2.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(3.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(3.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(4.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(4.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(5.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(5.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(6.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(6.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(7.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(7.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(8.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(8.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(9.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(9.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(10.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(10.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(11.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(11.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(12.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(12.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(13.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(13.5*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(14.0*AWA_LOAD_FACTOR, PRR_LoadFaction());DelayCommand(14.5*AWA_LOAD_FACTOR, PRR_LoadFaction());
This is PRR_LoadFaction
void PRR_LoadFaction()
{
int nNth = GetLocalInt(GetModule(), "FactionFocus_Source");
object oSourceFactionMember = GetObjectByTag("FACTION_FOCUS", nNth);//colunm //while(oSourceFactionMember != OBJECT_INVALID)
if(oSourceFactionMember != OBJECT_INVALID)
{
int i = 0;
object oTarget = GetObjectByTag("FACTION_FOCUS", i);//row
//float fDelay;
while(oTarget != OBJECT_INVALID)
{
string sSourceFactionMember = SQLEncodeSpecialChars(GetStringLowerCase(GetName(oSourceFactionMember)));
string sTarget = SQLEncodeSpecialChars(GetStringLowerCase(GetName(oTarget))); SQLExecDirect("SELECT " + sSourceFactionMember + " FROM tbl_factions WHERE tbl_player_player_character='" + sTarget + "'"); if (SQLFetch()) { int nAdjustment = StringToInt(SQLGetData(1)); //fDelay += 0.10;// optional delay //DelayCommand( fDelay *AWA_LOAD_FACTOR, AdjustReputation( oFactionFocus, oTargetFocus, nAdjustRep ));// AdjustReputation( oTarget, oSourceFactionMember, nAdjustment ); //AWA_DEBUG("PRR_LoadModule: target = "+GetName(oTarget)+" source = "+GetName(oSourceFactionMember)+" rep = "+IntToString(nAdjustment)); } else { AWA_DEBUG("PRR ERROR: could not SELECT "+GetName(oSourceFactionMember)+" FROM tbl_factions WHERE tbl_player_player_character= "+GetName(oTarget)); } i++; oTarget = GetObjectByTag("FACTION_FOCUS", i); } } //if (oSourceFactionMember == OBJECT_INVALID) //{ //AWA_DEBUG("PRR_LoadFaction: finished "+GetName(oSourceFactionMember)); //nNth++; SetLocalInt(GetModule(), "FactionFocus_Source", (GetLocalInt(GetModule(), "FactionFocus_Source") + 1) ); //}}
Thanks for any help
Modifié par DM_Vecna, 25 avril 2011 - 04:50 .