GetMember

From Intrigues Wiki

GetMember Method in Clan Class

Overview

The GetMember method in the Clan class is designed to retrieve a specific member of the clan based on their role. This method is useful for identifying individual clan members who fulfill particular roles within the clan's structure.

Method Definition

public Actor GetMember(string roleFilter, bool inclusivePassive = false);

Description

  • Parameters:
    • roleFilter: A string representing the role to filter the member by (e.g., 'Engineer').
    • inclusivePassive: A boolean flag. If set to true, includes passive (e.g., deceased) members in the search. Defaults to false.
  • Returns: The first Actor found matching the specified role filter. Returns null if no match is found.

Functionality

  • The method searches through the clan's members for the first individual whose role matches the specified roleFilter.
  • If inclusivePassive is true, the method includes members who are not currently active (such as deceased members) in the search.
  • If multiple members have the specified role, only the first one encountered is returned.

Usage

This method is ideal for scenarios where a specific role needs to be identified quickly within a clan, such as finding a leader, a healer, or an engineer. It's particularly useful in gameplay mechanics or storylines where individual roles are critical.

Example of Usage

public class ClanRoleAssignment : MonoBehaviour {
    private Clan playerClan;

    void Start() {
        playerClan = IM.Player.Clan;
        if (playerClan != null) {
            Actor engineer = playerClan.GetMember("Engineer");
            if (engineer != null) {
                Debug.Log($"Engineer in the player's clan: {engineer.Name}");
            } else {
                Debug.Log("No Engineer found in the player's clan.");
            }
        }
    }
}

Description

  • This example demonstrates using the GetMember method to find the first member with the role of 'Engineer' in the player's clan.
  • It logs the name of the found engineer to the console, or a message indicating that no engineer is found.

Remarks

  • The GetMember method is particularly useful for quickly accessing specific roles within a clan, enhancing gameplay dynamics and narrative development.
  • It should be used with the understanding that it returns only the first match, which may not always represent all members with the specified role.