MafiaII Console utility

2k Czech Mafia II game modding.

Moderator: Oleg

User avatar
Oleg
Site Admin
Posts: 11215
Joined: Fri Feb 06, 2004 3:54 am
Contact:

MafiaII Console utility

Post by Oleg »

MafiaIIConsole.exe

This small utility was made to inject new materials and update existing materials changes in a single materials database of the game. The game uses a single file for all materials of all models it has: MafiaII\pc\edit\materials\default.mtl
This .mtl file should contain materials for your modded content and, if you change original materials, it should have associated updates made there. The game is very sensitive to materials, as it has some materials-role assignment build in deep of code. For example, each vehicle has its own "paint/exterior" material that the game will accept for color-painting. If you create a different material, or rename this material, the vehicle will not get painted anymore in game. You are allowed to update existing material (by setting your own textures onto it), so an original material will get updated and the game will respect it when painting your vehicle. Another example, is a global "lights and stuff" material, named GPLC (Global Plate + Light + Colors) - this is the only material that the game will trigger condition-lighting on. It is used for headlights/taillights/reverselights/turn signals and for license plate numbers. You can't use your own textures on this material, as all other vehicles in game use the same material on them. Quite a big constrain I must say.

The merging utility should be placed in MafiaII\pc\edit\materials folder and will put contents of all *.mtl files in current folder into a file named default.mtl (updating content in it when matching materials are found).

Each material is identified by 64-bit hash value that the materials editor in ZModeler will keep on user-defined option named "Hash". These values should be unique (you can't have several materials using the same hash value). Original hash value upon loading a model is stored on material, you can change material if needed, and an exporter will prepare an updated material associated with the given hash value on export. Materials merger tool will update original material with the matching (by hash) on an exported model. An exporter will create a mini-base of model materials (a *.mtl file) that you put into MafiaII\pc\edit\materials folder and merge with MafiaIIMaterialsMerger utility. You can release your mods with mini-base *.mtl file, so end user can merge materials during mod installation.

City areas management (cityareas.bin)
This utility also merges (updates/removes) areas inside a "cityareas.bin" file located in the same folder as utility. It will read all *.area files you have in the same folder (e.g. mymap.area, island2.area) and perform addition/update or removal of associated AREA entries inside a global cityareas.bin file.

Content of the .area file is as follows:
Any line starting with ; or # is a comment. It can toggle off lines temporary in your .area file.
Line like this:

Code: Select all

AREA001        test      italy     *
[/b]
means "AREA001" joints file test.sds and italy.sds
An asterisk (or any other symbol in the end of line) toggles some option I have no purpose for (some original rows have this option, some are missing it). Most of area-joints have this option toggled.

Line like this:

Code: Select all

AREA002    test
[/b]
means "AREA002" is located in a file "test.sds"

Line like this:

Code: Select all

AREA003
[/b]
will remove "AREA003" data from "cityareas.bin"
Attachments
MafiaIIConsole.zip
(14.62 KiB) Downloaded 170 times