GetScheme

From Intrigues Wiki
Revision as of 06:37, 24 December 2023 by Tayfunwiki (talk | contribs) (Created page with "== <code>GetScheme</code> Method in Actor Class == === Overview === The <code>GetScheme</code> method is designed to retrieve an active scheme targeting a specific actor, if such a scheme exists. This function is key in games where monitoring and responding to ongoing schemes is crucial to gameplay and character strategy. === Syntax === <syntaxhighlight lang="c#"> public Scheme GetScheme(string schemeNameOrId, Actor target) </syntaxhighlight> === Parameters === * sch...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GetScheme Method in Actor Class

Overview

The GetScheme method is designed to retrieve an active scheme targeting a specific actor, if such a scheme exists. This function is key in games where monitoring and responding to ongoing schemes is crucial to gameplay and character strategy.

Syntax

public Scheme GetScheme(string schemeNameOrId, Actor target)

Parameters

  • schemeNameOrId (string): The name or ID of the scheme to retrieve.
  • target (Actor): The actor who is the target of the scheme.

Description

This method searches for and retrieves a scheme that is currently active against a specified target actor. It returns the Scheme object if the scheme is found and active; otherwise, it returns null. This functionality allows characters or the game system to track and respond to specific schemes and maneuvers within the game.

Usage

Used to identify and interact with schemes that are currently active against particular targets, enabling strategic responses or adjustments in gameplay.

Example of Usage

public Actor playerCharacter; // An instance of an actor
public Actor rival; // The target actor of the scheme
string schemeId = "Sabotage";

Scheme activeScheme = playerCharacter.GetScheme(schemeId, rival);
if (activeScheme != null) {
    // Logic to respond to the active 'Sabotage' scheme against the rival
}

In this example, a player character retrieves an active 'Sabotage' scheme against a rival. If the scheme exists, the player can then take appropriate actions or make strategic decisions in response to this information.

Remarks

  • The GetScheme method is particularly important in strategy games or complex narratives where understanding and countering opponents' schemes is a part of gameplay.
  • This method enhances the depth of strategic gameplay by providing players with the ability to detect and react to schemes.
  • The method's ability to return null if no active scheme is found against the target helps in conditional logic and decision-making processes within the game.