Post tutorial Report RSS Server Side Modding Tutorial

Howdy guys, this is a tutorial that I wrote a few months back on how to create this mod and other mods that you can think of, all completely server side. So sit back, have patience, and check out what this tutorial has to offer!

Posted by on - Basic Server Side Coding

Here is a 10 step process that will get you going on creating your own
server side mod. To make a server side mod, you must first do the
following:

1) Download (if you haven't already) the 1.4 or 1.5 Battlefield 2142 Server from Largedownloads.ea.com.

2) Install the server files onto your system.

3) Once installed, make a shortcut onto your desktop to the directory of
your Battlefield 2142 server. To do this, follow the steps below:

a) Right click anywhere on the desktop and click on New -> Shortcut
b) A wizard will pop up asking you to type the location of the item. Click browse.
c) Navigate your way to C:\program files\Electronic Arts\ and click once on Battlefield 2142 server and click ok.
d) Click next and in the next box, type "Battlefield 2142 server directory" and click finish.

e) A new shortcut has popped up and double click the shortcut to ensure
it takes you to the correct spot. You should be at "C:\Program
Files\Electronic Arts\Battlefield 2142 Server".

4) Next, go to mods/bf2142 folder. ((C:\Program Files\Electronic Arts\Battlefield 2142 Server\mods\bf2142))

5) Remove all md5 files from the directories. For example,
std_archive.md5, levels.md5. Each level will have its own md5 file.
Remove them. By removing these files, you allow the server to have
server side modifications.

6) Make backup copies of all your
files (This is a MUST because you WILL encounter bugs that will make
you want to pull your hair out and fresh copies of your directories are
very important). If at any time you forget to backup your files and
your file becomes corrupt and you need to start again, you can always
grab new copies from your playing directory, which is located here:

F:\DICE\Projects\Electronic Arts\Battlefield 2142 Deluxe Edition\mods\bf2142\Objects

or for those of you who don't have the deluxe edition, then it's:

F:\DICE\Projects\Electronic Arts\Battlefield 2142\mods\bf2142\Objects

Make copies of all the _server.zip files in this directory and just copy them over to a new directory:

C:\Program Files\Battlefield 2142 Server\mods\bf2142\objects\Fresh

^^ This being the server folder you are going to modify for the mod.

7) Download Winzip (Best One) or WinRaR and install either one. These
programs makes modifying the files so much faster than the standard
zipping from windows.

8) Prep the following files by making sure
they are not "Read only" attributes. These will be the files you will
be modifying. It's best to take each zip file and extract the contents
into a new folder that you created on your desktop. Once all the files
are extracted, select them all by pressing CTRL + A and right clicking
on one of the selected folders/files and clicking properties. Then
DESELECT the read only attributes and click apply before clicking OK.
Once this is completed, re-zip the files back and ensure the correct
filename and such is used from before. Do this for each of the
following ZIP files:

Mods/bf2142

GameLogicInit.con <-This is not a zip file but make sure it's not a read only file.
Common_server.zip

Mods/bf2142/objects

StaticObjects_Server.zip
Vehicles_Server.zip
Weapons_Server.zip
Soldiers_server.zip

>>>If you have northern strike, then you will have the following files<<<

Soldiers_bp1_server.zip
StaticObjects_bp1_server.zip
Weapons_bp1_server.zip
Vehicles_bp1_server.zip

>>>Some other files you might get lucky and be able to modify<<<

Kits_server.zip
Kits_bp1_server.zip
Common_server.zip
Common_bp1_server.zip

mods/bf2142/levels

/Map Name/server.zip

(((Be sure to remove all md5 files in each of the maps)))

9)
After you have finished this horribly long process and have just about
died of boredom, you're ready to move onto the fun stuff. The next few
steps will guide you through how to make a simple mod by just modifying
a few files. Enjoy and pay attention!

a) Locate the Weapons_server.zip located in the mods/bf2142/objects directory and open it with Winzip or WinRAR.
b) Once inside the zip file, you will see the following:
Armament
Common
Handheld
Stationary
c) Double click handheld.
d) Locate and double click EU_AV.
e) You should see the following:
AI
ANIMATIONS
MESHES
AnimationSystem1p.inc
AnimationSystem3p.inc
eu_av.con
eu_av.ske
Weapon.desc
eu_av.tweak

f) You will always want to modify the .tweak files. Never try to modify
any other files other than .tweak files and SOME .con files as they
will crash the client upon trying to connect. Double click the
eu_av.tweak file.
g) If this is your first time opening a .tweak
file, a window will pop up asking how you want to handle this file.
Select a program from a list and locate NotePad.exe and check the box
that says use this program from now on and click OK.
h) Upon
opening the file you will see a whole bunch of ObjectTemplate lines of
code. Do not worry about these words as they mean nothing.
i) Locate the Single Fire Composition, which will have:

rem ---BeginComp:SingleFireComp ---
ObjectTemplate.createComponent SingleFireComp
ObjectTemplate.fire.addFireRate 0
ObjectTemplate.fire.projectileStartPosition 0.15/0/
ObjectTemplate.fire.batchSize 4
ObjectTemplate.fire.maxProjectilesInWorld 4
ObjectTemplate.fire.busyUntilButtonRelease 1
rem ---EndComp ---

j) Change the batchsize from 4 to 16 and increase the maximum number of
projectiles in the world from 4, to also 16. So when you're done, it
should look like this:

rem ---BeginComp:SingleFireComp ---
ObjectTemplate.createComponent SingleFireComp
ObjectTemplate.fire.addFireRate 0
ObjectTemplate.fire.projectileStartPosition 0.15/0/
ObjectTemplate.fire.batchSize 16
ObjectTemplate.fire.maxProjectilesInWorld 16
ObjectTemplate.fire.busyUntilButtonRelease 1
rem ---EndComp ---

k) A general rule of thumb to follow: Not all changes in these files
will work. A good portion of code changes will crash the client. So
some things to look for and NOT to change are any lines of code that
have .ammo. These will crash the clients.
l) Locate the Soldier Deviation Composition, which will look SIMILAR but not exactly like this:

rem ---BeginComp:SoldierDeviationComp ---
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.setFireDev 4 1 0.1
ObjectTemplate.deviation.subProjectileDev 8
ObjectTemplate.deviation.setTurnDev 0.5 0.1 0.1 0.1
ObjectTemplate.deviation.setSpeedDev 2 0.2 0.08 0.1
ObjectTemplate.deviation.setMiscDev 9 9 0.25
ObjectTemplate.deviation.devModStand 1.3
ObjectTemplate.deviation.devModCrouch 1.2
rem ---EndComp ---

m) Change your deviation composition to match what you see above.

n) Don't ever try to change client side restricted items, such as
.zoom. or any kind of Sound code. They generally don't work and cause
problems for clients.
o) Locate the following line:

ObjectTemplate.projectileTemplate eu_av_missile

Write
this down as it is VERY important and we'll come back to this line of
code. This allows us to know what kind of a projectile this weapon uses
when fired.

p) Increase the velocity in which this weapon ejects the mentioned projectile listed above to 50 (if it's not already).

q) Save the eu_av.tweak file and close out of it. If you get an error
message stating it can't find the file to save, then instead save the
file to your desktop then close out of the file. Then click and drag
eu_av.tweak from your desktop into the already opened
Weapons_server.zip file and drop it into the EU_AV folder.
r) With the Weapons_server.zip file still open, navigate your way back to the main directory, which shows:

Armament
Common
Handheld
Stationary

s) Double click Armament and again on Missiles.
t) Remember that line that said ...?

ObjectTemplate.projectileTemplate eu_av_missile

Since
this weapon fires the projectile eu_av_missile, we'll locate the
eu_av_missile from the list. Do you see the eu_av_missile from the
list? Double click the folder named eu_av_missile. You should see the
following:

MESHES
eu_av_missile.con
eu_av_missile.tweak

Double click the eu_av_missile.tweak file.

u) Locate the Default Detonation Composition which will look like this:

rem ---BeginComp:DefaultDetonationComp ---
ObjectTemplate.createComponent DefaultDetonationComp
ObjectTemplate.detonation.explosionMaterial 70
ObjectTemplate.detonation.explosionRadius 1.5
ObjectTemplate.detonation.explosionForce 2
ObjectTemplate.detonation.explosionDamage 30
ObjectTemplate.detonation.endEffectTemplate e_exp_small
ObjectTemplate.detonation.useMMOnEndEffect 1
ObjectTemplate.detonation.detectionRadius 1.5
ObjectTemplate.detonation.maxDepthForExplosion 2
rem ---EndComp ---

Change so it matches the following. Be sure to add the trigger radius of 3 line:

rem ---BeginComp:DefaultDetonationComp ---
ObjectTemplate.createComponent DefaultDetonationComp
ObjectTemplate.detonation.explosionMaterial 70
ObjectTemplate.detonation.explosionRadius 10
ObjectTemplate.detonation.explosionForce 500
ObjectTemplate.detonation.explosionDamage 0

ObjectTemplate.detonation.triggerRadius 3

ObjectTemplate.detonation.endEffectTemplate e_exp_small
ObjectTemplate.detonation.useMMOnEndEffect 1
ObjectTemplate.detonation.detectionRadius 1.5
ObjectTemplate.detonation.maxDepthForExplosion 2
rem ---EndComp ---

v) Change the Seek closest Target Composition and the Default Follow Composition to match the following:

rem ---BeginComp:SeekClosestTargetComp ---
ObjectTemplate.createComponent SeekClosestTargetComp
ObjectTemplate.seek.targetType TTHeat
ObjectTemplate.seek.trackingDelay 0.01
ObjectTemplate.seek.maxAngleLock 45
ObjectTemplate.seek.maxDistLock 300
ObjectTemplate.seek.distLoseLock 500
ObjectTemplate.seek.reLockTime 0.1
ObjectTemplate.seek.ignoreFriendly 0
rem ---EndComp ---
rem ---BeginComp:DefaultFollowComp ---
ObjectTemplate.createComponent DefaultFollowComp
ObjectTemplate.follow.maxYaw 10
ObjectTemplate.follow.maxPitch 10
ObjectTemplate.follow.changePitch 0.25
ObjectTemplate.follow.changeYaw 0.2
ObjectTemplate.follow.minDist 10
ObjectTemplate.follow.magneticBehaviour 1
ObjectTemplate.follow.predictionFactor 0.5
rem ---EndComp ---

w) The next section is probably one of the coolest parts of all
projectiles because anything and everything you modify here completely
changes the way the projectile behaves. While each of you can mess with
the variables, for example purposes, I want you to change the variables
so it matches the following:

ObjectTemplate.geometry eu_av_missile
ObjectTemplate.setCollisionMesh eu_av_missile
ObjectTemplate.mapMaterial 0 metal 20
ObjectTemplate.drag 10
ObjectTemplate.mass 15
ObjectTemplate.gravityModifier 0.5
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Point
ObjectTemplate.collisionGroups 8
ObjectTemplate.material 52
rem -------------------------------------
ObjectTemplate.addTemplate S_eu_av_missile_Looping
ObjectTemplate.addTemplate e_mechRockets_trail
rem -------------------------------------
ObjectTemplate.timeToLive CRD_NONE/10/0/0
ObjectTemplate.material 52
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.localPredictOnClient 1
ObjectTemplate.minDamage 1
ObjectTemplate.damage 40
ObjectTemplate.damageOwner 1
ObjectTemplate.acceleration 150
ObjectTemplate.maxSpeed 150
ObjectTemplate.startDelay 0.2
ObjectTemplate.activeDefenseEnabled 1

x) Save the file and close out of it.
y) Close out of the weapons_server.zip file.

z) You're done! Go to your main Battlefield 2142 Server Directory and
locate the BF2142ServerLauncher.exe file and start up the server!

10)
Once the BF2142_w32ded.exe Black box has finished loading, Start up
your Battlefield 2142 game and connect to your server. If you crash to
your desktop upon spawning, then you made a mistake and need to go back
to the .tweak files and check your spelling and/or numbers. If you get
kicked from your server for "Modified Content" then remove your md5
files.

Upon spawning select the EU team and spawn as an
engineer. When you fire your weapon, you should get the effect in the
provided screenshot.

Screenshot: I167.photobucket.com

The
following change log shows my attempts at changing the game, some work,
some do not. Use the change log as a guide or reference upon creating
your own mod.

God Bless and enjoy!

-AwesomeATrain-

Be sure to check out the finished result of the mod by connecting to the 2142 Server:

EMS Gamers
208.122.57.131 Port 16567

Post comment Comments
11termin8a11
11termin8a11 - - 1 comments

i looked at that large download website and i can't find the bf2142 1.5 server download, i need help, thanks

Reply Good karma Bad karma+1 vote
jhett12321
jhett12321 - - 25 comments

just search in google you should find it

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: