NPCGuildTemplate - jimdroberts/FishMMO GitHub Wiki

Description

ScriptableObject template for defining NPC guilds, their icon, description, archetypes, and requirements. Used to configure guilds that NPCs can belong to or interact with in FishMMO.


API Access

Fields

  • public Sprite Icon

    The icon representing the guild in UI.

  • public string Description

    Description of the guild and its purpose.

  • public List Archetypes

    List of archetypes associated with this guild.

  • public BaseCondition GuildRequirements

    Requirements that a player must meet to join or interact with this guild.

Properties

  • public string Name { get; }

    The name of the guild, derived from the asset name.

Methods

  • public bool MeetsRequirements(IPlayerCharacter playerCharacter)

    Checks if the given player character meets the guild's requirements. Returns true if requirements are met or if no requirements are set. Parameters:

    • playerCharacter (IPlayerCharacter): The player character to evaluate.* Returns: bool — True if requirements are met, false otherwise.

Basic Usage

Setup

  1. Create a new NPCGuildTemplate ScriptableObject in the Unity Editor.
  2. Assign an icon, description, and list of archetypes in the Inspector.
  3. Set up any GuildRequirements using a BaseCondition ScriptableObject.
  4. Reference the template in NPC or guild-related systems.

Example

// Example 1: Checking if a player meets guild requirements
NPCGuildTemplate guild = ...; // Reference to the ScriptableObject
iPlayerCharacter player = ...; // Reference to the player character
if (guild.MeetsRequirements(player))
{
    // Player can join or interact with the guild
}

Best Practices

  • Use descriptive names and icons for each guild to improve UI clarity.
  • Define clear and consistent requirements for joining or interacting with guilds.
  • Organize archetypes logically within each guild for better gameplay balance.
  • Use the MeetsRequirements method to centralize requirement checks in gameplay logic.
⚠️ **GitHub.com Fallback** ⚠️