Quick Tips

From BF2 Technical Information Wiki
Jump to navigation Jump to search

Prevent Commander and Squad Leaders from being autobalanced

In the file admin/standard_admin/autobalance.py find line 34:

 # dont use autobalance when its suicide/changes team 

and before it, add:

if p.isCommander(): return None
if p.isSquadLeader(): return None

(from metac0m at pixel-war dot de)

For a way to do this without changing any of the original BF2 files, see Dynamically Changing an Event Handler.

Remove 12-minute time limit from demo server

Find the line

 host.registerHandler('TimeLimitReached', onTimeLimitReached, 1) 

in /mods/bf2/python/game\/gamemodes/gpm_cq.py and comment it out (add a "#" in front of it). The game will still display a running timer, but once time runs out the timer will disappear and gameplay will continue until all tickets are gone for one side.

WARNING: EA has said that they consider this modification to be "hacking", and will delist any server that uses it from GameSpy.

Unlock all weapons on server

In python\bf2\stats\unlocks.py, change the line

 defaultUnlocks = [0, 0, 0, 0, 0, 0, 0] 

to

 defaultUnlocks = [1, 1, 1, 1, 1, 1, 1] 

WARNING: EA has said that they consider this modification to be "hacking", and will delist any server that uses it from GameSpy.

NOTE - This method only works on the demo and version 1.0. In later patches EA has hardcoded the weapon unlocks into the game engine to stop this modification from working.

Here are another way to do it in 1.02: http://forums.totalbf2.com/showthread.php?t=17633&page=1

Skipping / Disabling the intro movies

In the file mods/bf2/Init.con at the end of the file is a list of each of the intro movies:

bf2Engine.playMovie Movies\EA.bik 1
bf2Engine.playMovie Movies\dice.bik 1
bf2Engine.playMovie Movies\legal.bik 1
bf2Engine.playMovie Movies\intro.bik 0
bf2Engine.playMovie Movies\welcome.bik 0

If you change the 1s at the end of each line to a 0, then you'll be able to skip the movie by pressing escape. Alternatively, you can add the text rem to the begining of each line to disable the movie completely.

WARNING: This modification appears to cause problems with the punkbuster sanity check on the game, which makes it impossible to connect to a punkbuster enabled server. So it's only really useful if you're playing single player. In that case, you'll want to rename the movies folder instead. Find this in mods/bf2

*ADDITION* Rather than edit the script, which PunkBuster won't like, just rename the following movies.

...path.to.game..\mods\bf2\Movies\EA.bik > ...path.to.game..\mods\bf2\Movies\noEA.bik
...path.to.game..\mods\bf2\Movies\dice.bik > ...path.to.game..\mods\bf2\Movies\nodice.bik
...path.to.game..\mods\bf2\Movies\legal.bik > ...path.to.game..\mods\bf2\Movies\nolegal.bik
...path.to.game..\mods\bf2\Movies\intro.bik > ...path.to.game..\mods\bf2\Movies\nointro.bik


Put Line breaks in MOTD

The pipe character | acts as a line break in sv.welcomeMessage

Another way to do the same function is to use the line break command /n The command is generally in most programming languages.

Up to eight lines are allowed.


Use stock Python modules not included in BF2 pylib

Some stock Python modules (such as binascii) aren't included in the embedded interpreter with BF2. PyPy is a useful project that is implementing a Python interpreter in Python itself, so the code from there is useful: