Role.SetCapacity

From Intrigues Wiki
Revision as of 11:03, 5 January 2024 by Tayfunwiki (talk | contribs) (Created page with "=== Role Class - <code>SetCapacity</code> Method === ==== Overview ==== The <code>SetCapacity</code> method in the Role class allows setting the maximum number of individuals who can occupy a specific role simultaneously. ==== Syntax ==== <syntaxhighlight lang="c#"> public void SetCapacity(int capacity) </syntaxhighlight> ==== Description ==== This method is used to define or modify the capacity of a role, which is the maximum number of actors that can hold this role...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Role Class - SetCapacity Method

Overview

The SetCapacity method in the Role class allows setting the maximum number of individuals who can occupy a specific role simultaneously.

Syntax

public void SetCapacity(int capacity)

Description

This method is used to define or modify the capacity of a role, which is the maximum number of actors that can hold this role at any given time. The capacity parameter is an integer representing this limit.

Usage

The method is particularly useful in scenarios where certain roles need to be limited in number, such as exclusive positions or titles within a clan or organization.

Example of Usage

public class RoleManager : MonoBehaviour {
    void SetRoleCapacity() {
        // Retrieve a specific role, for instance, "Guard"
        var role = IM.GetRole("Guard");

        // Set a new capacity for the "Guard" role
        role.SetCapacity(10); // Max 10 guards allowed
    }
}

Remarks

  • Adjusting the capacity of a role can impact the game's dynamics, especially in scenarios involving hierarchy, power balance, or resource allocation.
  • It's important to carefully consider the implications of changing a role's capacity, as it can significantly affect gameplay and player strategy.