Back to wiki
This post is unpublished.
Double check all the info, and if it's ready, click the "publish" button in the post summary.

How to find the currently played map



4 months ago

17 revisions

Last updated:
3 months ago

This tutorial will teach you how to support multiple maps for your workshop creations. This will come handy if you need a variable to change (ex: an effect's position) depending on the map that has been selected for the match. You can find two projects of mine using this tutorial here and here.

You can import a template with the map detector ready here.

1. Setup your map detector

If you are playing on PC, you need to copy the following rule in your clipboard and paste it in your project using the orange paste button in the workshop. You can then skip to step 2.

rule("Map detector setup (Global variable Z)")
        Ongoing - Global;

        Set Global Variable(Z, Add(Multiply(Compare(Objective Position(0), !=, Null), Add(300, Round To Integer(X Component Of(
            Objective Position(0)), Up))), Round To Integer(X Component Of(Nearest Walkable Position(Vector(100, 100, 100))), Up)));

If you are on console, you can copy the rule from the map detector template here and skip to step 2.

If you want to set it up yourself instead, create or open a project in the workshop. Open the workshop menu and add a new rule. Keep the event to Ongoing - Global. This rule will initialize our map detector, so you can call this rule "Init map detector". Make sure to not add any conditions to this rule so that it will be executed first when the map is loaded.

It's time to create the only action needed for this rule. This action will store the number that will help us determine the map currently being played. Click the ADD button on the right side of your rule to add an action. You can then follow this image to create the rule.

Your new global variable "Z" is now your map detector and can finally be used to execute actions depending on the map.

2. Find the associated number on the map sheet

You can find the list of numbers associated for each map in the game by clicking here. You can also use the following image instead.

These numbers will be used to create your conditions.

3. Create your map conditions

Now that you have the numbers you need, you can create new rules that will execute depending on the map! Let's make a rule to initialize the match using our new map detector.

Add a new rule with the event set to Ongoing - Global. Click ADD on the left side of your rule to add a new condition. To compare the number generated by your map detector, set the first value to GLOBAL VARIABLE and choose the number associated to your map detector ("Z" for this example). The comparator needs to be ==. The second value needs to be a NUMBER. You can then input the number from the sheet associated with your map.

You can now add whatever actions to be done to initialize your mode on the specific map you chose! Create as many rules as you like to cover each maps supported by your project.