Aller au contenu

Photo

HELP -- Need to Know If I Read This Function Right


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
I need to know if I'm reading this function right - its commented out in nw-o0_death, but I think its perfect for what I need with resetting custom factions to base reputation...

void ClearAllFactionMembers(object oMember, object oPlayer)
{    
    AdjustReputation(oPlayer, oMember, 100);
    
    object oClear = GetFirstFactionMember(oMember, FALSE);    
    while (GetIsObjectValid(oClear) == TRUE)
    {        
         ClearPersonalReputation(oPlayer, oClear);
         oClear = GetNextFactionMember(oMember, FALSE);
    }
}


If I read this correctly, it basically makes oMember "friendly" (100) to oPlayer then loops through oMember's factions and resets the faction's personal reputation in regards to oPlayer back to its baseline value.

For example, oMember's faction is "neutral"  (50) towards oPlayer. oPlayer accidently hits oMember with a fireball, making oMember's faction hostile towards oPlayer. However, this function is called from oMember's OnSpellCastAt Event - setting the personal reputation of oMember to 100 regarding oPlayer. Then it loops through oMember's faction, restoring oMember and all other faction members back to the original reputaion of 50 regarding oPlayer. So everything is all peaceful again???

Modifié par Pstemarie, 21 août 2012 - 08:43 .


#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
That function is explained about half way down in the Factions, Shouts and Attacking My Enemy tutorial.

Modifié par Lightfoot8, 21 août 2012 - 09:25 .


#3
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Thanks Lightfoot, that answered it - this function is exactly what I was looking for to reset my custom factions when needed.

My module has a variety of glowing orbs (modified will-o-wisps) that flit around for atmosphere. I've given them a custom faction that is "neutral" to all the other factions, but they sometimes get caught up in AOE spells and go hostile. I just needed a function for their event scripts that would reset the faction back to neutral.