Availability

There is more then 1 way to find out the MapGoal name, here are a few examples.

```
/bot sgn 200

```

This will list all mapgoals within 200 units of your position in console.

```
/bot show_goals

```

This will give you the full list of all the mapgoals.

```
/bot makemapgoallist

```

This save a list of all map goals into file mapname\_goals.gm. You can find this in your *~omni-bot\et\user* folder.

## Disabling Goals

When the map starts all mapgoals are active so the 1st thing to do is disable mapgoals that we don't want the bots to do at the start of the map. A good example is defending bots will go and build the command post, in some maps is fine to build the command post but on many maps it can be some distance away and you would not want the bots to go and build it.

### Way 1

The 1st way to do this is by setting the mapgoal to false.

In your script locate where you have just added the trigger text, under this section there will be 3 example lines that look like this:

```

 //~Util.DisableGoal( ".\*", true ); // all but routes
 //~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK\_.\*" );
 //~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK\_.\*" );

```

Ignore this 1st line for now that will be explained later & look at the 2nd/3rd line. The 1st 3 (//~) letters can also be ignored as well they just stop the lines from being read in the script.

Now you need to find out the actual name of the goal.

For this example we are going to use this mapgoal name *"BUILD\_Axis\_Command\_Post"*.

A good place to add this the line under the examples.

This is how you would disable axis from building the command post

```

 SetAvailableMapGoals( TEAM.AXIS, false, "BUILD\_Axis\_Command\_Post" );

```

### Way 2

There is a 2nd way to do this and that is to disable all the map goals (except routes) at the start. This can be the better option when you have added a few goals, then you only have to enable the goals you want active instead of having to deactivate all the goals you don't want.

In the OnLoadMap there is a line you ignored in the last example, this time were are going to use it. Simply remove the "//~"

```

 Util.DisableGoal( ".\*", true ); // all but routes

```

This will now disable all goals for both teams.

## Wildcards

The wildcard ".\*" is used to select all goals it can also be used to after a mapgoal type such as "PLANT" like this:

```
 SetAvailableMapGoals( TEAM.AXIS, false, "PLANT\_.\*" );

```

Note: Because there are 2 goals starting with "PLANT" (PLANT & PLANTMINE goal) the underscore should be used after the word PLANT so it only enables The Plant goals and not the Plantmine goal.

## Enabling Goals

Now we want to enable some mapgoals for this example we are going to activate the "PLANT\_Main\_Entrance" and for this you just need to use the "SetAvailableMapGoals" command but this time using true. If you have disabled the goals using using the 1st way you don't have to enable the goals as they will be still enabled.

```

global OnMapLoad = function()

{
 OnTrigger( "Allies have destroyed the main entrance", Map.Main\_Entrance\_Destroyed );

 Util.DisableGoal( ".\*", true ); // all but routes
 SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT\_Main\_Entrance" );
};

```

## Trigger Functions

Once you have enabled/disabled the goals you want active at the start of the map you need to look at the mapgoals you want enabled/disabled when events happen in the map.

You now need to look at the trigger functions in "Global Map"

For this the allies have destroyed the main entrance so this if you added the correct trigger text the script will to go to the "Main\_Entrance\_Destroyed" trigger function in the Global Map.

We want to now disable the "PLANT\_Main\_Entrance" goal & enable a new goal "PLANT\_Big\_Gun" for allies & enable a mounted mg emplacement for axis "MOUNTMG42\_North". As with the "Global OnLoadMap" section you just have to use the "SetAvailableMapGoals" command.

```

global Map =
{
 Main\_Entrance\_Destroyed = function( trigger )
 {
 SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT\_Main\_Entrance" );
 SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT\_Big\_Gun" );
 SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42\_North" );

 Util.MapDebugPrint( "Main\_Entrance\_Destroyed" );
 },
};

global OnMapLoad = function()
{
 OnTrigger( "Allies have destroyed the main entrance", Map.Main\_Entrance\_Destroyed );

 Util.DisableGoal( ".\*", true ); // all but routes
 SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT\_Main\_Entrance" );
};

```