An open API service indexing awesome lists of open source software.

https://github.com/phts/h3m-resize


https://github.com/phts/h3m-resize

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

          

# h3m-resize

Resize existing HoMM3 map keeping all the terrain, objects and configuration.

## Requirements

- Node.js v22 or higher
- `gzip` executable available in global `PATH`

## Limitations

- Only HotA maps are supported (tested on v1.8.0)

## Usage

This script does not have complete parsing of the .h3m structure.

To make it work you have to make the following customizations in your map
to be able to properly find the offset in the file structure with the first segment of the land (on coordinates `x=0;y=0`).

1. Place rectangle of Grass from the top left corner (coordinates `x=0;y=0`) to at least `x=5;y=2`
2. Place two segments of Snow at `x=0;y=0` and `x=1;y=0` (enough single click on `x=1;y=0`)
3. Place two segments of Lava at `x=2;y=0` and `x=3;y=0` (enough single click on `x=3;y=0`)
4. Place Lava river from `x=0;y=0` to `x=3;y=0`
5. Place Dirt road from `x=0;y=0` to `x=3;y=0`

It has to look like:

![](docs/example.png)

And then to execute the script:

```sh
npm start -- --src-file=/path/to/source.h3m --out-file=/path/to/out.h3m --new-size=[S|M|L|XL|H|XH|G]
```

After successful conversion open newly created map in the map editor and replace terrain in the left top corner back as it was in your original file.

:warning: When decreasing size from bigger to smaller all objects which were placed on the cropped segments will be still
presented in the map structure and may cause unpredictable behavior when later adding more objects.
In this case recommended before executing the script manually delete/move all objects out from the segments which are going to be cropped.

## References

- [.h3m structure description](https://github.com/potmdehex/homm3tools/blob/master/h3m/h3mlib/h3m_structures/h3m_description.english.txt)