Popular Post BlackWolf Posted January 31, 2021 Popular Post Posted January 31, 2021 (edited) With Omni-Bot documentation all but disappearing, I found it tricky to find appropriate tutorials when learning to waypoint. It's been mostly trial and error, so I thought I'd put what I'd learned online so those who wish to have a go can do so. This post will focus on bot scripting basics, and how to enable / disable objectives depending on map progression. First, you should follow the waypointing basics tutorial here. Once you have completed the basic waypointing, bots will happily roam around the map completing the objectives. However, all bots will attempt to do all objective straight away. This isn't desirable, as you'll find the bots spread themselves over the entire map, when they should be focusing on specific areas at a time. Throughout this tutorial, I'll be using Oasis as an example as it's a map we should all know by now. Omni-Bot Installation 1) Open your Enemy Territory installation folder. 2) Delete any folders named 'omni-bot'or 'omnibot' 3) Download both the omni-bot file and waypoint mods and extract them into your ET installation. You'll now have two new folders named as above. Click here and here). 4) Launch ET, select 'mods', then 'omnibot', then 'load mod'. 5) Select 'host game', change gametype to 'single map objective', then choose the map you want to waypoint and select start server. You'll now be in game ready to go. At this point, follow the tutorial linked at the start of this article to create the waypoints that show the bots where to move. Instead of using the console commands, you can hit v to open the voice chat menu to explore the available commands. It's much quicker and easier this way Scripting Basics When you've completed your waypoints, you need to run a couple of commands in console in game. These are: /bot waypoint_save /bot goal_save You'll now have three files in /omni-bot/et/nav. They will be named mapname.gm, mapname.way, and mapname_goals.gm. The only file you should edit is mapname.gm. This is the script where we tell the bots what to focus on and when. Never attempt to edit mapname_goals.gm. The .way file is unreadable so don't touch this one either. Enabling Triggers The script can look confusing at first, but it's actually easy once you get going! Firstly, search for 'global OnMapLoad = function()', towards the end of the script file. You'll see a lot of text that looks like this: OnTrigger( "Allied Command Post constructed. MISSING_STRING", Map.Allied_Command_Post_Built ); At this point, you need to edit any lines that include 'MISSING_STRING' and replace this word with the text that is displayed in game when that objective is completed. In the above example, the Allied command post has been built. If we build it in game, we can see the message displayed in game is this: So, we simply edit the script line so it looks like this: OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built ); You need to go through each line to ensure they match exactly what's in game. Include any capital letters, punctuation and colour codes. You might find it easier to copy/paste from the mapscript itself. I won't cover that here, but feel free to ask if you want pointing in the right direction. For Oasis, the complete section will look like this: OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built ); OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built ); OnTrigger( "The Garrison MG Nest has been constructed!", Map.Garrison_MG_Nest_Built ); OnTrigger( "Allies have built the Oasis Water Pump!", Map.Oasis_Water_Pump_Built ); OnTrigger( "The Old City MG Nest has been constructed!", Map.Old_City_MG_Nest_Built ); OnTrigger( "Allies have built the Old City Water Pump!", Map.Old_City_Water_Pump_Built ); OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted ); OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed ); OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed ); OnTrigger( "The Garrison MG Nest has been damaged!", Map.Garrison_MG_Nest_Destroyed ); OnTrigger( "Allies have destroyed the North Anti-Tank Gun!", Map.North_Anti_Tank_Gun_Destroyed ); OnTrigger( "Planted at the Oasis Water Pump.", Map.Oasis_Water_Pump_Planted ); OnTrigger( "Axis have damaged the Oasis Water Pump!", Map.Oasis_Water_Pump_Destroyed ); OnTrigger( "The Old City MG Nest has been damaged!", Map.Old_City_MG_Nest_Destroyed ); OnTrigger( "Allies have breached the Old City wall", Map.Old_City_Wall_Destroyed ); OnTrigger( "Planted at the Old City Water Pump.", Map.Old_City_Water_Pump_Planted ); OnTrigger( "Axis have damaged the Old City Water Pump!", Map.Old_City_Water_Pump_Destroyed ); OnTrigger( "Allied team has destroyed the South Anti-Tank Gun!", Map.South_Anti_Tank_Gun_Destroyed ); OnTrigger( "Axis reclaim the Old City!", Map.oldcityflag_Axis_Captured ); OnTrigger( "Allies capture the Old City!", Map.oldcityflag_Allies_Captured ); OnTrigger( "Planted at the North Anti-Tank Gun.", Map.North_Plant ); OnTrigger( "Planted at the South Anti-Tank Gun.", Map.South_Plant ); OnTrigger( "Defused at the North Anti-Tank Gun.", Map.North_Defuse ); OnTrigger( "Defused at the South Anti-Tank Gun.", Map.South_Defuse ); OnTrigger( "Planted at the Old City Wall.", Map.Wall_Plant ); OnTrigger( "Defused at the Old City Wall.", Map.Wall_Defuse ); VERY IMPORTANT: A missing '.', space or even a non-capital letter will stop the script running correctly, so make sure you've triple checked what you've added here. Enabling / Disabling Goals (Objectives) Once you've done the above, we can move on to enabling / disabling objectives depending on map progression. This is easiest to explain with an example, so we'll work through one now. 1) Enable viewing of map goals. Hit 'v', choose the omnibot menu and select the option to display all map goals. 2) Walk to the objective you want to investigate. You'll see the name of the objectives in green. In this example, it's the Allied command post: There are two omni-bot goals here named 'PLANT_Allied_Command_Post' and 'BUILD_Allied_Command_Post'. We can see that the PLANT goal is assigned to Axis, so Axis bots will attempt to blow up the command post if it's built. the BUILD goal is assigned to Allies, to Allied bots will attempt to build the command post. In Oasis, we don't want to Axis bots attempting to blow up this command post once the old city wall is destroyed. The Axis bots will be spawning near the anti-tank guns, so sending a bot all the way back to the Allied CP is pointless. The bot will be unlikely to make it through and the bots should be focusing on defending the guns instead. So, we need to disable the PLANT goal when the old city wall is destroyed. Scroll through the script and you'll see sections looking like this: Old_City_Wall_Destroyed = function( trigger ) { Util.MapDebugPrint( "Old_City_Wall_Destroyed" ); }, Inside the { }, we can tell the bots what we want them to start, or stop, doing. To stop the Axis bots attempting to PLANT at the Allied command post, we put in the following line. You can adapt this line to any goal in the map: SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" ); This section of the script now looks like this: Old_City_Wall_Destroyed = function( trigger ) { SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" ); Util.MapDebugPrint( "Old_City_Wall_Destroyed" ); }, So, let's break down what we've got above so we can understand what's going on: Old_City_Wall_Destroyed = function( trigger ) <- This is the trigger. In this case, when the old city wall is destroyed, whatever we put in here will be actioned. TEAM.AXIS <- This is the team we're instructing. You can use TEAM.ALLIES to instruct the Allied bots. false <- We're telling the bots NOT to do the objective. If you want to enable an objective, set this to true. "PLANT_Allied_Command_Post" <- The objective we're talking about. You can use any objective in the map here, but you must type it EXACTLY as it appears in game. Util.MapDebugPrint( "Old_City_Wall_Destroyed" ); <- This is text that goes into a logfile if we enable debugging. Don't touch this. You can now go through the script and enable / disable goals wherever you want to. If you want to enable / disable goals at the start of the map, you can do this in the 'global OnMapLoad = function()' section. For example, at the start of the map, you might want to stop the Axis players attempting to build their command post. You don't really want to the Axis bots running to the end of the map to build their CP, when they should be focusing on defending the old city. Also, you don't want Allied bots attempting to blow up the Axis CP until they've destroyed the old city wall, so we can disable both goals at the start of the map. Here's the Axis CP: We can disable this at the start of the map in the 'global OnMapLoad = function()' section. The code itself is in the same format as before: SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_Command_Post" ); SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_Command_Post" ); In the above screenshot taken at the start of the map, you can see under 'Active' that it currently shows 'None'. This is because we've disabled the goals for both teams, so no bots will focus on this goal until we enable it later. We'd then re-enable this goal for both teams once the old city wall is destroyed. Viewing current bot tasks If you want to see what a bot is assigned to at any time during your testing, just run /bot botgoal. Every bot will then say what their current objective is. Conclusion The above is a very basic guide to the initial scripting process. You can get more complex and assign priorities to goals (for example, if dynamite is planted at an anti-tank gun, you don't want an Axis bot wasting time building their CP when they should be defusing the dynamite). Once you've done the above, bots will focus on the goals we tell them to, rather than running all over the map completing objectives that aren't relevant at that time. However, you'll find that bots that aren't doing a task at the time will just roam around wherever they feel like it. In the next tutorial, we'll cover how to add extra goals such as camping, planting mines, throwing airstrikes, using mortar, throwing grenades etc. We'll also cover how to keep bots in specific areas of the map so they can attack, defend, and support their team mates. Edited January 31, 2021 by BlackWolf 4 4 4 1 Quote
Snuffs99 Posted January 31, 2021 Posted January 31, 2021 Great post, well worth a tutorial badge IMHO 1 1 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.