MW2Mercs weapons editing scripts

General Mech2 related Developments go here. Discussions welcome!

Moderator: Skyfaller

Forum rules
If you are writing a guide please do not post it here! Post in the Dev FAQ section please.
Post Reply
Postdog
I.S. Baby
Posts: 1
Joined: Sat May 02, 2020 6:12 am

MW2Mercs weapons editing scripts

Post by Postdog »

Based on the work of Kris on the MeckWarrior Weapons Editor, I looked through Merc's binary (mw2.exe) and found similar organization of the weapons data. It is similar, but not exactly the same.

I wrote a few scripts, in Matlab, which import data from mw2.exe, display the data in a table, and write data to mw2.exe (patching the binary). You can edit the data in Matlab after importing and then export your changes to the game. I've done this and it seems to work.

So far I have only used this on the DOS version of 1.06 (I think). If it doesn't work, the import should give you garbage weapon names.

Below is a brief writeup of the binary format.

Cheers

-------
Starting from byte offset 913420 of mw2.exe,
there are 66 weapons in consecutive blocks.
Each block consists of (in order):
24 int32 (long integers)
one character array (char[8]) containing weapons' short name

The long integers are the weapons' values and flags, format is very similar to MW2 (Kris' work), except the addition at the beginning of a few integers.
Note that some integers have non-intuitive units. The heat values are all multiplied by 32768. The distance values are in cm (divide by 100 to get meters). Time values are in 100th of a second as far as I can tell, EXCEPT that there seems to be an extra 0.5x multiplier on reloading times.
To get the effective range of a weapon, multiply the shot's time to live by the speed. This is usually longer than the indicated range (which is when the crosshairs turn color).

The long integers are (in order):

1 unknown (values are 0 except for AMS)
2 unknown (same value except for AMS)
3 unknown (flamer, narc, AMS specific)
4 unknown (flamer specific)
5 shot type (see Kris' PatchWpn.cpp)
6 hit type (")
7 unknown (seems related to weapon category)
8 unknown (")
9 continuous fire (binary value)
10 enabled (binary)
11 homing (binary)
12 shots per attack
13 attacks per ton of ammo
14 sound resource id
15 affected by gravity (binary)
16 speed of projectile
17 damage per shot
18 heat generated per shot (units are 1/32768)
19 heat inflicted per shot that hits (units are 1/32768)
20 minimum lockon range (units are cm)
21 indicated range (crosshairs turn color) (units are cm)
22 reload time (units are 0.005s?)
23 delay to fire, delay between shots (units are 0.005s?)
24 life span of projectile (units are 0.01s), actual range = speed*lifespan
Attachments
readmercs.txt
Matlab function to read data from mw2.exe
(1.34 KiB) Downloaded 1137 times
patchmercs.txt
Matlab function to write data to mw2.exe
(873 Bytes) Downloaded 1152 times
checkdata.txt
Matlab function to show data in table
(2.16 KiB) Downloaded 1136 times
Post Reply