Scripting waypoints flags: Difference between revisions

From MyGamingTalk
m (1 revision imported)
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:


The following flags can be added/removed via script
The following flags can be added/removed via script


* axis
* axis
Line 18: Line 17:
* closed
* closed


There are a few other flags that can be added removed but these are the only ones that you are likely to need to change in the game
There are a few other flags that can be added removed but these are the only ones that you are likely to need to change in the game.




Line 31: Line 30:




This command initially must be added to the "''global OnMapLoad''" section so the status of the flag is known at the start of the map.  The flag must then be added to any "''function( trigger )'''s" that causes the need to add/remove the flag.
This command initially must be added to the "''global OnMapLoad''" section so the status of the flag is known at the start of the map.  The flag must then be added to any ''function triggers'' that causes the need to add/remove the flag.




Line 38: Line 37:
<syntaxhighlight lang="java">  
<syntaxhighlight lang="java">  
global Map =
global Map =
{
{
Main_Entrance_Destroyed = function( trigger )
Main_Entrance_Destroyed = function()
{
{
if ( TestMap )
{ return; }
Wp.SetWaypointFlag( "door1", "axis", false );
Wp.SetWaypointFlag( "door1", "axis", false );


Line 52: Line 47:


global OnMapLoad = function()
global OnMapLoad = function()
{
{
         OnTrigger( "Allies have destroyed the main entrance", Map.Main_Entrance_Destroyed );
         OnTrigger( "Allies have destroyed the main entrance", Map.Main_Entrance_Destroyed );


         Wp.SetWaypointFlag( "door1", "axis", true );
         Wp.SetWaypointFlag( "door1", "axis", true );
};
};
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 14:29, 16 May 2025

Omni-Bot_Map_Scripting Scripting Waypoints flags


During the process of running a map things can change such as doors no longer been axis only.


The following flags can be added/removed via script

  • axis
  • allies
  • closed

There are a few other flags that can be added removed but these are the only ones that you are likely to need to change in the game.


The waypoint must be named in the map "/bot waypoint_setname name" so the script knows which waypoint to add/remove the flag


The command to use in the script is "Wp.SetWaypointFlag".


        Wp.SetWaypointFlag( "waypoint_name", "flag", true/false );


This command initially must be added to the "global OnMapLoad" section so the status of the flag is known at the start of the map. The flag must then be added to any function triggers that causes the need to add/remove the flag.


Below is an example of the script to remove a axis only flag to allow both teams to use.

 
global Map =
{
	Main_Entrance_Destroyed = function()
	{
		Wp.SetWaypointFlag( "door1", "axis", false );

		Util.MapDebugPrint( "Main_Entrance_Destroyed" );
	},
};

global OnMapLoad = function()
{
        OnTrigger( "Allies have destroyed the main entrance", Map.Main_Entrance_Destroyed );

        Wp.SetWaypointFlag( "door1", "axis", true );
};


Note: Using this to remove a closed flag is not needed on blockable section of a map unless the blockwall flag does not work like in the Caen map.