Python plugin released to restore AI commander artillery/supplies/vehicle drop

Advanced AI commander plugin in action.

DICE updated Battlefield 2 with their 1.5 patch on September the 1st 2009. However one issue that has got missed to this day is the breaking (or deliberate removal for some reason?) of the ability of the AI commander to respond to artillery, supplies, vehicle drop and UAV requests. This all works if the commander happens to be human, but requests fail if the commander is AI (a bot). Over the years there has been much talk about how to fix this. Python was mentioned. Decompiling the Battlefield 2 executable was also a possibility as that is where the bug lies; replacing the 1.5 “AIDLL.dll” and “AIDLL_w32ded.dll” with the equivalent patch 1.41 versions does not work (in version 1.41 these features were still working).

Advanced AI commander plugin in action.

But in 2017 a solution to the problem suddenly appeared on GameFront titled “Auto Artillery(AI commander) plugin” at a version of 2.0.1. It was updated on Feb 1st, 2019 to a version 3.0.2 now titled “Advanced AI commander plugin”.

The author “worldlife123” has solved a major problem ! This is especially prevalent in solo and coop game play. Because there are not legions of human players around you to provide medical and vehicle repair assistance. relying on a supply drop becomes even more important … at least it did until the 1.5 patch broke it. That arguably made solo/coop less fun although the lack of artillery strikes mitigated the problem a bit as there was a bit less to damage to the player going on. But now these features, that were always part of standard Battlefield game play, are back !

Advanced AI commander plugin in action.

The ability for the commander to use artillery across the map is the most obvious feature, as well as your ability to request it. However there is also the supplies and vehicle drop. But worldlife123 has gone further by restoring the ability to disrupt the commanders ability to use “satellite scan” by allowing the player to destroy the enemy satellite dish. The artillery pieces themselves can also be destroyed.

Installation can be tricky and is not yet as simple for the average player as running an installer. Most players will probably get to the use the plugin as modding teams slowly take it into their mods.

Installation is simpler if you are installing into vanilla (default) Battlefield 2 or a mod that does not have modified python files (see the “readme.txt” in the download). I installed into the AIX2 Minimod

1. Backup your python folder ( Battlefield 2\mods\aix2ex_mm\python)

2. I edited “gpm_coop.py” as recommended in the custom install guide in the download, “Battlefield 2\mods\aix2ex_mm\python\game\gamemodes\gpm_coop.py” to give the following. Please note this is not the full file as I had to cut off the end as it was very long. However that part has no new edits. The added code is highlighted …

# co-op

TAKEOVERTYPE_CAPTURE = 1
TAKEOVERTYPE_NEUTRALIZE = 2

SCORE_CAPTURE = 2
SCORE_NEUTRALIZE = 2
SCORE_CAPTUREASSIST = 1
SCORE_NEUTRALIZEASSIST = 1
SCORE_DEFEND = 1

Top = 0
Middle = 1
Bottom = 2

import host
import bf2
import math

from game.scoringCommon import addScore, RPL
from bf2 import g_debug
import aiArty

g_controlPoints = [] # cache, as this map won't change



def init():
	aiArty.init()
	# events hook
	host.registerGameStatusHandler(onGameStatusChanged)
	if host.sgl_getIsAIGame() == 1:
		host.sh_setEnableCommander(1)
	else:
		host.sh_setEnableCommander(1)
		
	host.registerHandler('TimeLimitReached', onTimeLimitReached, 1)	
	host.registerHandler('RemoteCommand', remotecommand, 1)

	if g_debug: print "gpm_coop.py initialized"
		
		
		
def deinit():
	aiArty.deinit()
	bf2.triggerManager.destroyAllTriggers()
	global g_controlPoints
	g_controlPoints = []
	host.unregisterGameStatusHandler(onGameStatusChanged)
	if g_debug: print "gpm_coop.py uninitialized"

# Rest of Python file truncated for brevity

3. Run “mapinstall.bat” as described in the readme. This adds some files to each map which allows the plugin to operate properly.

4. Make sure the “scripts” folder and its contents is added to the top of the mod folder … “Battlefield 2\mods\aix2ex_mm\Scripts” as this is not made very clear in the installation guide.

Now you should have a fully working AI commander !

It might take a bit of getting used to. It’s not perfect. The commander will often refuse requests but then give them to you. Also the supplies and vehicle drops come down at your position not where you are pointing to. The plugin could also do with some tweaks such as the coloured smoke removing and the timeout increasing. I’m looking into that.

So that’s it for today. All these years later Battlefield 2 proves itself once again. Modders are still producing enhancements such as this and many other add-on’s and mods.

Stay tuned !

You can’t beat a classic !

Jason Statham: “You can’t beat a classic” in one of the Expendables films.
No faces were harmed of course.

Battlefield 2 is still an absolute classic game and will always be. The sequels were good. In fact I really enjoyed the campaign mode in 3 and 4 but after that the “war stories” started getting a bit lame. However the online multiplayer element of the Battlefield games is still very good.

But the problem for many was the removal of any offline play with the AI (bots) either alone or with other players (Coop). So this site will cover Battlefield 2 tutorials, fixes and news gathered from the “mod’iverse” out there, not necessarily exclusively for SP/Coop. There are still people producing mods for the game (172 mods released according to Moddb.com) and its still possible to learn how to enable maps for the bots.

Incoming news items include a novel fix for the broken AI commander artillery/supplies/vehicle drop, as well as a long sought out fix for problems with level audio and EAX.

Stay tuned.