SetConspirator: Difference between revisions
Tayfunwiki (talk | contribs) (Created page with "== <code>SetConspirator</code> Method in Scheme Class == === Overview === The <code>SetConspirator</code> method in the Scheme class is used to assign a new conspirator to a scheme. This method allows for dynamic changes in the actor responsible for initiating or driving the scheme. === Syntax === <syntaxhighlight lang="c#"> public void SetConspirator(Actor actor) </syntaxhighlight> === Parameters === * <code>actor</code>: An <code>Actor</code> object representing th...") |
Tayfunwiki (talk | contribs) No edit summary |
||
Line 27: | Line 27: | ||
Scheme schemeToUpdate = IM.Player.GetScheme(schemeName); | Scheme schemeToUpdate = IM.Player.GetScheme(schemeName); | ||
if (schemeToUpdate != null) { | if (schemeToUpdate != null) { | ||
schemeToUpdate.SetConspirator(newConspirator); | schemeToUpdate.Schemer.SetConspirator(newConspirator); | ||
Debug.Log($"Updated conspirator of scheme '{schemeName}' to: {newConspirator.Name}"); | Debug.Log($"Updated conspirator of scheme '{schemeName}' to: {newConspirator.Name}"); | ||
} else { | } else { |
Latest revision as of 18:00, 9 February 2024
SetConspirator
Method in Scheme Class
Overview
The SetConspirator
method in the Scheme class is used to assign a new conspirator to a scheme. This method allows for dynamic changes in the actor responsible for initiating or driving the scheme.
Syntax
public void SetConspirator(Actor actor)
Parameters
actor
: AnActor
object representing the new conspirator of the scheme.
Description
- This method updates the conspirator of a scheme, changing the primary actor responsible for its initiation and execution.
- It's essential for game scenarios where the original conspirator changes due to gameplay events, narrative developments, or player actions.
Usage
The SetConspirator
method is typically used in game logic where there is a need to transfer the responsibility of a scheme from one actor to another. This can be due to various reasons, such as the original conspirator being incapacitated or a shift in the storyline.
Example of Usage
public class SchemeConspiratorUpdater : MonoBehaviour {
void UpdateSchemeConspirator(string schemeName, Actor newConspirator) {
Scheme schemeToUpdate = IM.Player.GetScheme(schemeName);
if (schemeToUpdate != null) {
schemeToUpdate.Schemer.SetConspirator(newConspirator);
Debug.Log($"Updated conspirator of scheme '{schemeName}' to: {newConspirator.Name}");
} else {
Debug.Log($"Scheme not found: {schemeName}");
}
}
}
Description
- In this example, the
UpdateSchemeConspirator
method is used to set a new conspirator for a specified scheme. It finds the scheme usingIM.Player.GetScheme
and updates its conspirator. - The method logs a message indicating whether the conspirator was successfully updated or if the scheme was not found.
Remarks
- Changing the conspirator of a scheme can significantly impact the game's narrative and player strategy, making this method a powerful tool in dynamic storytelling and gameplay.
- Proper handling of conspirator changes is crucial to maintaining narrative continuity and logical consistency within the game.