[HOWTO] How To: Get Faction Members That Dislike Player

Announcements, support questions, and discussion for Love/Hate.
Post Reply
User avatar
Tony Li
Posts: 22083
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Get Faction Members That Dislike Player

Post by Tony Li »

The code below gets a list of all FactionMembers whose affinity to the player is negative. It assumes the player's faction is named "Player".

Code: Select all

var enemies = new List<FactionMember>();
foreach (var kvp in FactionManager.instance.members)
{
    var faction = kvp.Key;
    var members = kvp.Value;
    if (FactionManager.instance.GetAffinity(faction.name, "Player") < 0)
    {
        enemies.AddRange(members);
    }
}
Post Reply