Bots shooting map objects: Difference between revisions

From MyGamingTalk
m (1 revision imported)
 
m (1 revision imported)
 
(No difference)

Latest revision as of 08:02, 13 February 2023

Omni-Bot_Map_Scripting Bots Shooting Map Objects


The Problem

In some maps the bots see MOVERS are targets to shoot & will spend the whole map shooting them. An example of this is in the breakout2 map where there are 4 birds that the bots see as a target.


The Target(s)

The 1st thing to do is to identify the actual targets name.

The best way to find this is to add a bot and use the "/bot debugbot fpinfo" command. Once the bot has joined the name and debugbot command is used you need to spec the bot.

You should now see something like this


As you can see from the picture the bot is targeting bird3. The goal name for this is MOVER_bird3.


The Script

There are 2 parts to this scripting 1st a MOVER table & 2nd a ignoretarget instruction.

Create the MOVER table in "global Map" like this:

 
global Map =
{
    Movers =
    {
	"MOVER_bird1",
	"MOVER_bird2",
	"MOVER_bird3",
	"MOVER_bird4",
    },
};

This should contain all the movers you want the bots to ignore, in this example from breakout2 there are 4 birds.

The next part of the script is to tell the bots to ignore the targets & is added into the "OnBotJoin" section of the script.

There are 2 ways to do this depending on whether the entire MOVER table needs ignoring or just some of the table.


Version 1:

 
global OnBotJoin = function( bot )
{
	bot.IgnoreTarget( GetGoal("MOVER_bird1").GetEntity(), 9999 );
	bot.IgnoreTarget( GetGoal("MOVER_bird2").GetEntity(), 9999 );
	bot.IgnoreTarget( GetGoal("MOVER_bird3").GetEntity(), 9999 );
	bot.IgnoreTarget( GetGoal("MOVER_bird4").GetEntity(), 9999 );
};

This again should contain all the movers you want the bots to ignore.


Version 2:

 
global OnBotJoin = function( bot )
{
	Util.IgnoreTargetGoalTable(bot, Map.Movers);
};

This will include all the Goals in the MOVER Table.