Tutorial 17: Success and failure conditions


Let’s learn how to create success and failure conditions for our map. Start by creating two triggers, a skeleton and a dwarf as shown in the image. Success and Failure triggers can be placed anywhere in the map. You would only need to care about their position if they were triggered by the player’s position, but in this tutorial this won’t be the case. The goal of the map will be to kill the skeleton, and the quest will be failed if the dwarf gets killed. Let’s do that!

 

Left click on one trigger and set its configuration as shown in the image. Don’t forget to press Apply to apply the changes. This will be a Success trigger, that will be activated when the player and his allies kill one enemy npc. You could set the variable count to 10, and then the player would need to kill 10 enemies to win the map.

 

Left click on the other trigger and set its configuration as shown in the image. Don’t forget to press Apply to apply the changes. This will be a Failure trigger. The user will lost the game if the dwarf gets killed.

 

We need to link the trigger to the npc that will activate it. To do that, left click on the trigger, release the mouse button, press and hold B and left click on the dwarf. That’s it! Use the delay field to specify the number of seconds that the trigger must wait to be activated after its condition has occured. For example, set delay to 1 to wait 1 second until running the success trigger after the skeleton has been killed by the player. If you don’t set this field, then the trigger will be activated immediately.

 

Note that we could have created the Success trigger this way, linking it to the skeleton (because there is only one skeleton). But if we need to set the goal to more than just one enemy death, then we have to use the EnemyDeaths condition. Save the changes and click Play to test the map. Check if both triggers are working as expected! 😉