Guide:Basic Map Scripting
- This guide appeared as a developer blog post which introduced Wargroove's scripting system.
Today we're going to showcase how you can make interesting and dynamic scenarios in Wargroove using “triggers”. Some of the things you can make with this are:
- Custom story-driven missions, with sub-quests, plot twists, ambushes, and hidden secrets
- Unique game modes, with their own mechanics and win/lose conditions
- Change some of the rules of the game without needing to resort to modding
- Have players make decisions that affect the outcome of this AND of future missions (if you’re making a campaign)
- …and many other things! Remember that this is the tool that we ourselves are using to make the campaigns of Wargroove, so expect to be able to do anything you’d expect to see in the campaign of a game of this genre!
In this guide, we’re going to look at what scripting a map in Wargroove looks like!
It might be enlightening to consider an example, so let’s come up with something. We want to make a scenario where Mercia has to travel across a road and reach the end of the map. However, along the path lies an ambush. How can we achieve this?
First, we make our test map.
Now we can use the location tool to draw a few relevant areas: the destination, the area where Mercia triggers the ambush, and the locations where the enemies spawn during the ambush.
Next, we’re going to set up a win condition, and the ambush event. Both of those things are done by using “triggers”. Triggers are, fundamentally, a series of scriptable actions that execute on the map when certain conditions are fulfilled. Our objective here is to give users as much power as possible, but not at the cost of being easy to understand, learn, and use.
Our first trigger will be the winning condition. We want Player 1 to win if Mercia reaches the end location. So we create a trigger, give it to Player 1 only, and add a condition to it… looking through the list, “Unit Presence” seems to do what we want, and we configure it as such: “Does the Current Player have at least 1 of Commander at Destination?”. Next, we need an action to happen when this trigger happens. In this case, “Victory” will do, with “Give victory to Current Player”. All done for that!
Next, we want to set up the ambush. On this event, we want to give the player a way to avoid triggering it – maybe by capturing a village in another area of the map, or by donating some money to some locals who will advice you on it? For the purposes of setting up this trigger, what we need is a “Flag”, that determines whether the ambush is still active. Flags can be in one of two states, either true or false. We’ll create the flag on the “true” state (so the ambush can happen), and maybe later a different trigger can set it to “false” (spoiling the ambush).
Now we can set up the trigger itself. Again, we want it limited to Player 1. The conditions are straightforward: “Does Player 1 have at least 1 of Commander at AmbushTrigger?”. We also want to check if the “AmbushActive” flag is still active. If all is well, then we’ll want to spawn an enemy soldier, an enemy dog, and play a cutscene, so that’s three actions: “Spawn Soldier at AmbushSpawn for Player2”, “Spawn Dog at AmbushSpawn for Player2” and “Play cutscene AmbushCutscene”.
Let’s have a quick look at what it’s like in the game:
By adding more triggers, or modifying the existing ones, you can make the map more sophisticated. For example, you could set up something that will set that flag to false, like our aforementioned example of capturing a village. You can set up the map so people on the map give you mini quests, you can introduce new rules and victory conditions to the game, and you can carry over results from one map to another in the campaign with flags that span across the campaign.
As you’ve gathered from the gifs above, there are many other conditions and actions that I haven’t even described today. Together, they’ll enable you to make really interesting and complex maps, without needing to resort to mods or programming skills! We’re very excited to see what the community can come up using this tool!
The Wargroove map editor is available on all platforms, including full support for all the features outlined in this article. The gifs here are using a mouse, but the UI has been carefully designed to work equally well on a gamepad. Lastly, it’s worth remembering that you’ll be able to go online and share the content created with this map editor with friends and other players!
- Credit goes to the game's lead programmer, Rodrigo Monteiro.