LootLocker
The BasicsGame SystemsContent ManagementPlayer Management
LootLocker
  • 📌The Basics
    • Getting Started
    • What is LootLocker?
    • Core Concepts
      • Players
      • Assets
      • Character Classes
      • API Types
      • Web Console
      • Stage & Live Environments
      • Glossary
    • Unity Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • Unreal Quick Start
      • Install & Configure the SDK
        • Older versions
      • Authenticate Your First Player
    • Godot Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • SDKs
    • Samples
      • Authentication Samples
      • Leaderboard Samples
      • Progression Samples
      • Player Samples
    • Launching Your Game
    • Support
      • Error Codes
      • Unreal Marketplace Plugin Support
  • 🎭Players
    • Overview
    • Authentication
      • How To
        • Guest Login
        • Steam
        • Apple
        • Apple Game Center
        • Google
        • Epic Games
        • PlayStation
        • Meta / Oculus
        • Xbox
        • Nintendo Switch
    • Files
      • How To
        • Manage Files in Web Console
        • Work with Files In-Game
    • Inventory
      • How To
        • Work with Player Inventory
    • Messages
      • How To
        • Configure Messages in Web Console
    • Names
      • How To
        • Work with Player Names
    • Player Manager
      • How To
        • Manage Players through Web Console
        • Manage Players In-Game
        • Use Player Operations
    • Unified Player Accounts
      • How To
        • Configure UPA in Web Console
        • Use Remote Login In-Game
        • Connect Identiy Provider to Player
        • External Provider Linking
        • Transition from Guest Login to Other Provider
        • Disconnect Identity Provider from Player
    • White Label Login
      • How To
        • Configure White Label Login
        • Create a New White Label User
        • Request User Verification
        • Handle Returning Users
        • Start a White Label Session
  • 🪙Commerce
    • Overview
    • Catalogs
      • How To
        • Configure Catalogs in LootLocker Console
        • List all Catalogs
        • Use Catalogs In-Game
        • Setup In-Game Store
    • Currencies
      • How To
        • Configure a Currency in Web Console
        • Use Currencies In-Game
    • DLC Management
      • How To
        • Configure DLC in Web Console
        • Use DLC In-Game
    • Entitlements
      • How To
        • Work with Entitlements In-Game
    • Real Money Purchases
      • How To
        • Configure In-App Purchase in Web Console
        • Make Purchases through Google Play Store
        • Make Purchases through Apple Store
        • Make Purchases through Steam Store
    • Virtual Purchases
    • Wallets
      • How To
        • Manage a Wallet in Web Console
        • Use Wallets In-Game
  • ⚔️Content
    • Overview
    • Assets
      • How To
        • Create & Configure an Asset
        • Organize & Search for Assets
        • Retrieve Assets In-Game
        • Set up Asset Storage Template
        • Check Grant Notifications
        • Set up a Game Config Asset
        • Create a Loot Box
        • Work with Loot Boxes In-Game
        • Create a Drop Table
        • Work with Drop Tables In-Game
        • Create a Rental Asset
        • Work with Rental Assets In-Game
    • User Generated Content (UGC)
      • How To
        • Create UGC In-Game
    • Twitch Drops
  • 🕹️Game Systems
    • Overview
    • Classes & Heroes
      • How To
        • Base Classes
        • Hero Classes
        • Implement Classes In-Game
        • Implement Heroes In-Game
    • Leaderboards
      • How To
        • Configure Leaderboard in Web Console
        • Use Player Leaderboards
        • Use Generic Leaderboards
        • Use Metadata to Store Additional Information
        • Use Scheduled Reset with Rewards
        • Use Leaderboards for Time Based Rankings
      • Leaderboard FAQ
      • GameMaker References
    • Feedback
      • How To
        • Manage Feedback Categories
        • Create Player Feedback
        • Create UGC Feedback
        • Create Game Feedback
        • View and Manage Feedback
    • Progressions
      • How To
        • Create a Progression
        • Game Progressions
        • Player Progressions
        • Class Progressions
        • Asset Instance Progressions
    • Triggers
      • How To
        • Setup a trigger in the Web Console
        • Invoke trigger from game
  • ⛓️Shared Systems
    • Overview
    • Metadata
      • How To
        • Add Metadata in Console
        • Fetch a Single Metadata In-Game
        • Fetch Metadata In-Game by Tags
        • Fetch Metadata In-Game from Multiple Sources
    • Notifications
      • How To
        • List Notifications and Mark as Read In-Game
  • 🗝️Admin
    • Settings
    • User Settings
    • Organization Settings
    • CORS Allowlist
  • ⭕️ Legacy
    • Deprecations
      • Unity SDK Deprecation Log
        • Version 2.1.5 - Migration to Open UPM
        • Version 2.0.0
      • Unreal SDK Deprecation Log
        • Version 4.0.0
        • Version 3.0.0
    • Legacy Storage
    • Legacy Triggers
      • Activate a trigger
      • Create a trigger
    • Legacy Progressions
      • Create a Progression System
      • Use a Progression System In-Game
Powered by GitBook
On this page
  • Prerequisites
  • Conclusion
  1. Game Systems
  2. Triggers
  3. How To

Invoke trigger from game

PreviousSetup a trigger in the Web ConsoleNextOverview

Last updated 5 months ago

In this How-to, we’ll go through the process of invoking a created trigger from the game client.

Prerequisites

  • A LootLocker account and a created game

  • One or multiple triggers

When invoking triggers, you can specify to either invoke one or multiple triggers in the function.

// If you want to check and notify the player of what they received, save the keys of the successfully invoked triggers
List<string> successfulKeys = new List<string>();
LootLockerSDKManager.InvokeTriggersByKey(new string[] { "key_one", "key_two" }, (response) =>
{
    if (response.success)
    {
        // Even if keys fails, the call is successful, so you need to check which triggers were successful and which ones failed
        foreach (var item in response.Successful_keys)
        {
            Debug.Log("Key " + item.Key + " was successfully invoked.");
            // Save this key if you want the check what the player got
            successfulKeys.Add(item.Key);
            // Add your own code here to handle successful keys
        }
        foreach (var item in response.Failed_keys)
        {
            Debug.LogWarning("Key " + item.Key + " failed with reason:"+item.reason);
            // Add your own code here to handle the error
        }
        
        // Here you would put code to check notifications for what the player received.
    }
    else
    {
        Debug.Log(response.errorData.message);
        // Add your own code here to handle the error
    }
});

There are a few things to note from this example.

  • Firstly, even if the request succeeds there may be triggers that failed invocation. Because of this, you should always check the Failed_keys list from the response.

curl --location --request POST 'https://api.lootlocker.io/game/triggers/cozy-crusader/v1' \
--header 'x-session-token: 3266edd928f5769545425469ac417fee456d8367' \
--header 'Content-Type: application/json' \
--data-raw '{
    "keys": [
        "key1",
        "key2",
        "key3"
    ]
}'

When sending the same trigger multiple times in the same request, it will only invoke once. To invoke the same trigger multiple times, it needs to be invoked in multiple functions.

Conclusion

Above is an example of how to invoke triggers using blueprints in Unreal Engine. For an example you can copy and paste into your editor, .

And secondly, the returned information does not tell you what has been rewarded to the player. For that you will want to check the player's . If you want to do this, then you will want to store the keys of the sucessfully invoked triggers to identify which notifications correspond to which trigger.

In this How-to, we’ve invoked a trigger to reward the player. After you’ve gotten successful key responses, .

🕹️
setup in the web console
An active Game Session
look here
notifications
you may check to see the specific rewards given to the player
Blueprint example of how to invoke triggers from your game. To copy the example, see .
https://blueprintue.com/blueprint/4b53am-0/