Files

84 lines
3.9 KiB
Markdown

# ArmADump
Arma 3 config export and rebalance tool. Exports ammo/armor/weapons/magazines to CSV, then generates a CfgPatches mod to normalize non-RHS values to RHS baseline.
## What this repo is
### Extraction scripts (run in Arma 3)
- **`ammo.sqf`** — CfgAmmo export with vanilla + ACE3 ballistics properties. Uses BFS with `sleep 0` batching.
- **`armor.sqf`** — Vest + HeadGear export with per-body-part armor/passthrough values.
- **`weapons.sqf`** — Weapon export with ACE barrel properties (`ACE_barrelLength`, `ACE_barrelTwist`).
- **`magazines.sqf`** — Magazine export linking to ammo classes with `initSpeed`.
### Processing pipeline (Python)
- **`scripts/extract_csvs.py`** — Parses Arma `.rpt` log, extracts CSVs between `--- START/END ---` markers.
- **`scripts/split_by_mod.py`** — Splits raw CSVs into per-mod folders under `data/`.
- **`scripts/generate_patches.py`** — Compares all mods to RHS baseline, generates per-mod `output/<mod>/config.cpp` + `debug/<mod>/` before/after CSVs.
- **`scripts/package_mod.py`** — Packages output into `@mod` folder with PBOs via armake2. Reads settings from `package_mod.ini`.
### Reference
- **`REFERENCE.md`** — Quick reference for all config values (vanilla + ACE3).
## Pipeline (exact commands)
### Step 1: Run extraction scripts in Arma 3
Run each script in debug console (or `execVM`). Each outputs CSV via `diag_log` to `.rpt`:
```
execVM "ammo.sqf"
execVM "armor.sqf"
execVM "weapons.sqf"
execVM "magazines.sqf"
```
### Step 2: Extract CSVs from .rpt
```bash
python scripts/extract_csvs.py "path/to/arma3.rpt"
```
Produces `ammo_raw.csv`, `armor_raw.csv`, `weapons_raw.csv`, `magazines_raw.csv` in repo root.
### Step 3: Split by mod
```bash
python scripts/split_by_mod.py
```
Creates `data/[mod_name]/` folders with per-mod CSVs. Baseline folders are prefixed `_` (`_rhs`, `_vanilla`, `_ace`).
### Step 4: Generate rebalance mod
```bash
python scripts/generate_patches.py
```
Produces:
- `output/<mod>/config.cpp` — Per-mod CfgPatches config with overrides
- `output/unmatched.csv` — Items with no RHS equivalent
- `debug/<mod>/ammo.csv` — Before/after debug tables for ammo overrides
- `debug/<mod>/armor.csv` — Before/after debug tables for armor overrides
### Step 5: Package and install mod
```bash
python scripts/package_mod.py
```
Reads `package_mod.ini` for mod name, author, version, output path. Produces `@<mod_name>/addons/<mod>_<folder>.pbo` in your Arma mods directory.
## Key gotchas
- **SQF scripts output to `.rpt` log**, not directly to a file. Must extract from log.
- **CSV delimiter is `;`** (semicolon), no quoting.
- **`ammo.sqf` uses `sleep`** — requires scheduled environment (`execVM` or `spawn`).
- **CfgAmmo BFS depth limit** of 8 levels prevents exponential blowup.
- **`configSourceAddonList` returns CfgPatches class names** (e.g. `rhs_c_troops`), not display names. These are used as folder names in `data/`.
- **`caliber` is a penetration coefficient**, not actual bullet caliber. Classification uses class name patterns, not caliber value ranges.
- **RHS baseline**: folders prefixed `_` are baseline. Matching uses `(caliber_tier, subtype)` for ammo, `(item_type, tier)` for armor.
- **Arma config uses `{}` for arrays**, not `[]`. The generator handles this conversion.
- **`requiredAddons[]` must use original CfgPatches class names**, not sanitized folder names. `unknown` source_mod entries are skipped.
- **PBO names use mod name from `package_mod.ini`** (e.g. `a3rebalancer_jca.pbo`).
- **Debug CSVs go to `debug/`**, not `output/` — they must not be packed into PBOs.
- **armake2 must be installed** (`cargo install armake2`) and available in PATH or `tools/`.
- **Arma locks PBO files** when running. Close Arma before repacking.
## Conventions
- SQF files use 8-space indentation (tabs).
- CSVs use `;` delimiter.
- Python scripts use UTF-8 encoding.
- Per-mod folders use the CfgPatches class name as folder name.
- `continue` keyword avoided in SQF for pre-2.14 Arma compatibility.