 One nice way to keep players engaged in the game is to have challenges as we reward them, and nothing better as a reward than an asset that you should use real money to push it otherwise. So in this video we are going to see how we can create in-game events and using Lootlocker's trigger API we are going to reward players with assets. Here on Moonshiza when we complete a thousand points we reward players with a new skin. New skin unlock it? Cancer sent. So let's get started. So here we are on the Lootlocker's dashboard and to find the trigger system we go to systems triggers and right at the center of the screen we can see that we have the new trigger button here so let's create a new one and let's give it a name new skin unlock it game name you can see that we have this option how many times this will trigger right so this can trigger an unlimited amount of time this is especially useful if you are giving experience rewards but since we are giving assets I think that is most reasonable to use the limited one and let's add some rewards for the player so on the rewards add new add reward button you can see that we have experience and assets so let's add a new asset to this reward and I will use this area sent I will add a new one add a new reward tarot add a new one gemini add a new one and cancer and now we have four rewards right so I think that is reasonable to use these four times because you can see that we have this grant all option if we left this unchecked Lootlocker's will internally try to randomize each one of these rewards and will try to exclude the ones that the players already have so it will try to give players always a new reward that they don't have yet this is very cool if we check this Lootlocker will give all the rewards that we set to the players so I think that is reasonable to limit this trigger to trigger only four times let's save that and now we have a new trigger available let's see how we can use this on the game because we are going to use the Triggers API the Lootlockers Triggers API for that let's go there so to emit a trigger from our game is quite simple we have to make a post request a post HTTP request to this URL with the the content of the request with the request body being a JSON dictionary with a name key with trigger name as a value and we are going to get as a response a dictionary a JSON file with some information with some useful data especially telling that the trigger was successfully triggered and the green tape assets this will be important for us because we are going to access the the green tape asset name and display this to players you can see that right below here we have a list a listing trigger trigger trigger events that we can access as well and this can be useful if you have an achievement system so let's say we we create some events in the game and each event will be a trigger and we want to list all the achievements that the player already achieved we can create an interface to display that so you can see that making this HTTP request will give us a JSON dictionary as a response with a trigger key that is an array with all the triggers that the player already achieved with all the triggers that the player already triggered so let's go to the game to see how we can actually emit this ingot engine how we can use this ingot engine so I have Mochizer opened here and the way that I implemented the triggers on my game is that I have a node called score achievement that has an HP request as a child node and let's open its script so this is what it uses to compare the scores I have a score singleton that I connect on the ready function and once it every time the player scores it emits a new signal I checked if the the current score is greater than the is greater or equal than the scores we showed this variable right here then I call the method trigger skin unlocked and this is the important part for us so I will fold this and fold that and I will open the trigger skin unlock method here the first thing that it does is that it goes to this achievement label if we saw the first video you will remember that I have a network state label right this is very similar to that one I will open that here so basically it has a label it is a canvas so it gets always on the front of everything else and it has a label a timer and achieve a animation node that makes it appear or disappear and it has a text that any node can can change back to our score achievement node it changes this text to new skin unlocked and show the achievement label then it disconnects the score singleton signal just to prevent it from happening many times in the the same play session and then we finally reach the important part for us so we have here the URL that we just saw in the API this is how we access the trigger system and the reader we have the content type application slash json and the x session token remember this is always important to to parse as the the reader and then we use the method post and the body we have a dictionary with a name key that has the new skin unlocked as its value and then we make the hp request using these variables and passing false for the SSL certification using method and we convert the request body to a json file then we use for the response and use the the fourth index of this signal the request completed signal as the value of this response variable then we parse it from a json file because this will be converted to a dictionary and to get access to the asset name that asset that the player just earned I created a new variable that goes to the response granted asset remember granted assets remember that on the API we get a dictionary that has some keys and one of these keys is the granted assets right and it is an array so we go to the first index of this array and we find the name of this asset so if we if we search on the API we have the structure of the assets object that this is retrieving for us there are many keys that we can access for instance there is a ID key that we can access as well but for the sake of this system here we just need to know the asset name then we change the as achievement label text to be a new skin unlock it and we use a placeholder and we replace this placeholder value to be the asset name that we just gather and we convert it to a lower case and then we yield for a timer that we create from using this method to timeout and we hide the achievement label afterwards so just for testing purposes I will go to this score if we test this we have an authenticated login let's test this this trigger yeah new skin unlock it tauro scent let's go back see the skins and there we have it I have the tauro scent skin unlock it for this player we just saw how we can use in-game events to bring players some assets right but this doesn't actually give us any money how we can make money without games so in the next video we are going to see how we can use a purchase and building api to get a token that loot the locker we'll use to unlock some assets on players inventory see you there thank you so much for watching keep developing and until next time