IM.Trigger: Difference between revisions

From Intrigues Wiki
(Created page with "thumb|Wait Trigger == <code>Trigger</code> Method in IM Class == === Overview === The <code>Trigger</code> method in the IM (Intrigue Manager) class is designed to invoke the <code>onTrigger</code> event, enabling the handling of specific triggers within the game, particularly in relation to schemes. === Description === * Method Signature: <code>public static void Trigger(Scheme scheme, string triggerName, bool value)</code> * Parameters: **...")
 
No edit summary
 
Line 31: Line 31:
         if(currentScheme == null) return;
         if(currentScheme == null) return;


         IM.Trigger(currentScheme, "Disguised", true);
         IM.Trigger(currentScheme, "Kill Guardian", true);
     }
     }
}
}

Latest revision as of 15:58, 4 January 2024

Wait Trigger

Trigger Method in IM Class

Overview

The Trigger method in the IM (Intrigue Manager) class is designed to invoke the onTrigger event, enabling the handling of specific triggers within the game, particularly in relation to schemes.

Description

  • Method Signature: public static void Trigger(Scheme scheme, string triggerName, bool value)
  • Parameters:
    • scheme: The Scheme object related to the trigger.
    • triggerName: A string specifying the name of the trigger.
    • value: A boolean value that is passed along with the trigger, often representing the state or condition of the trigger.

Functionality

  • This method is responsible for invoking the onTrigger event, passing the relevant scheme, trigger name, and value.
  • The method facilitates the communication and response to various game events and conditions tied to specific triggers, especially within the context of a scheme.

Usage

The Trigger method is used to manually activate triggers within the game's logic, particularly for advancing or responding to specific events in a scheme. This can be crucial for gameplay mechanics that depend on event-driven actions and dynamic interactions.

Example of Usage

public class SchemeEventManager : MonoBehaviour {
    public Actor target;

    public void ActivateTrigger() {
        Scheme currentScheme = IM.Player.GetScheme("Assassination", target);
        if(currentScheme == null) return;

        IM.Trigger(currentScheme, "Kill Guardian", true);
    }
}

Description:

  • ActivateTrigger: This method demonstrates how to use the IM.Trigger method to activate a specific trigger in a scheme. It logs the activation for confirmation and traceability.

Remarks

  • The Trigger method is essential in games where triggers play a significant role in advancing schemes or gameplay scenarios.
  • Proper usage of this method allows for a more interactive and responsive gameplay experience, where player actions or game events can lead to specific outcomes or changes in the game state.
  • It is especially relevant in strategy games, narrative-driven games, or any genre that involves complex event systems and conditional gameplay mechanics.