About

Infobox

Lawnmower Groundcover Tutorial

Caption

Tutorial Info

TypeName
Requirements- The LawnMower
- Tes3conv
- Python 3.5+
- Tes3cmd (optional)
- TESTool (optional)
Tutorial FilesAny groundcover plugin you like that has not already had Lawnmower ran on it (the mod description will likely state whether this is the case)

Infobox

Groundcover

Caption

center
Vurt’s Groundcover, the most downloaded and endorsed Morrowind groundcover mod on Nexus Mods.
image source

This article is part of a series on Groundcover

Link to original

This tutorial covers how to use The LawnMower tool to clean groundcover mods of excess grass - specifically, grass which clips through or is hidden under other objects.

NOTE

The LawnMower actually comprises four separate tools:

Link to original

However, for the purposes of this tutorial we will only be focusing on the titular Lawnmower.

Goals

By the end of this tutorial, you should be able to:

  1. Run ‘lawnmower.py’ Python script on a groundcover plugin
  2. Compare a groundcover plugin against multiple mods (‘chaining’)
  3. Understand how to use the ‘autoclean’ plugins to increase the accuracy of The LawnMower
  4. Clean the patched groundcover plugin

Prerequisites

In addition to downloading The LawnMower (tools only), the tool also requires that you have Tes3conv and Python installed.

Copy ‘tes3conv.exe’ to your Morrowind ‘Data Files’ folder, or install it using a mod manager.

Likewise, copy ‘lawnmower.py’ from The LawnMower to ‘Data Files’ or install it with a mod manager.

Installing Python

Whilst it may seem daunting, installation is unremarkable on most platforms.1

See Python BeginnersGuide / Download for help.


Running the Script

flowchart LR

	A("python") --> B("lawnmower.py") --> C("Morrowind.esm") --> D("Rem_AC.esp") --> E("Rem_AC_out.esp")
	A ~~~ |"Python"| A
	B ~~~ |"the Python script to execute"| B
	C ~~~ |"Input"| C
	D ~~~ |"Groundcover"| D
	E ~~~ |"Output"| E
	

‘lawnmower.py’ is a Python script. To run it, open a command-line terminal (e.g., Windows Powershell) and enter python lawnmower.py, followed by three plugin names:

  1. Input: The plugin to compare the groundcover against (e.g., ‘Morrowind.esm’).
  2. Groundcover mod: The groundcover plugin Lawnmower will trim (e.g., ‘Rem_AC.esp’).
  3. Output: The name you give to the trimmed groundcover mod (e.g., ‘Rem_AC_out.esp’).
    • Output can be named anything you like, as long as it ends with the extension ‘.esp’ or ‘.esm’ (e.g., ‘trimmed_mod.esm’).

This would be entered as:

python lawnmower.py Morrowind.esm Rem_AC.esp Rem_AC_out.esp

Press Enter to execute the script, and Lawnmower will create the freshly trimmed groundcover plugin ”Rem_AC_out.esp”.

Caption


Running ‘lawnmower.py’ in Windows Command Prompt.
(video source: user upload)

Column

Caption


‘Rem_AC.esp’ before LawnMower,
Outside Vas (image source: user upload).

Caption


‘Rem_AC.esp’ after LawnMower,
Outside Vas (image source: user upload).


Running Lawnmower Against Mutiple Plugins

Using Lawnmower with your Entire Mod-List

Some tools for merging plugins, such as Habasi, can generate a single merged plugin of your entire mod list. This merged plugin can be used as the ‘input’ plugin for Lawnmower, saving you the trouble of running the script on individual mods.

To generate a merged plugin with Habasi, run the command habasi -O in a terminal.

Also known as ‘Chaining’ - The steps taken above in ‘Running the Script’ can be repeated by substituting different input plugins.

For example, if you add a city overhaul mod which adds numerous buildings to cities (e.g., ‘cool cities.esp’), and you wish for your previous ‘Rem_AC_out.esp’ to be trimmed of grass clipping through the new buildings, the command can be formatted like so:

python lawnmower.py "cool cities.esp" Rem_AC_out.esp "Rem_AC_out 2.esp"
flowchart LR

	A("python") --> B("lawnmower.py") --> C("cool cities.esp") --> D("Rem_AC_out.esp") --> E("Rem_AC_out 2.esp")
	A ~~~ |"Python"| A
	B ~~~ |"the Python script to execute"| B
	C ~~~ |"Input"| C
	D ~~~ |"Groundcover"| D
	E ~~~ |"Output"| E
	

This can be repeated for any plugins you wish to compare the groundcover against, and even turned into a BAT file to be reused.


Utilizing Autoclean Plugins

Autoclean plugins can be used to increase the accuracy of Lawnmower in detecting clipping groundcover.

Lawnmower comes packaged with two autoclean plugins:

  • ‘autoclean_cities_vanilla.esp’:   For Vvardenfell cities
  • ‘autoclean_cities_TR.ESP’:   For Tamriel Rebuilt cities

These plugins utilize the invisible marker meshes from Grassblocker, which ‘lawnmower.py’ treats as objects when detecting whether grass is clipping. The plugins place these meshes in common areas where unwanted grass is often generated by Mesh Generator, but which otherwise won’t be detected by ‘lawnmower.py’ unless an object covers the area - i.e., a Grassblocker mesh. Mod makers can also create Lawnmower autoclean patches for their own mods using Grassblocker.

The syntax for cleaning a groundcover plugin with an autoclean plugin is the same as any other:

python lawnmower.py autoclean_cities_vanilla.esp "my grassmod.esp" "my grassmod_out.esp"

Advanced - Cleaning the Plugin

The caveat to The LawnMower is that it does not truly delete the grass references it detects.

Instead, it moves their coordinates to X: 0, Y: 0, Z: -20,000, far below the surface of the game world. As groundcover plugins contain tens of thousands of references, these moved references are still taking up file space, even if they are never encountered in-game. Deleting these will not improve performance markedly, but it can make analyzing the output plugin easier.

With a couple of extra steps, the reference count of the output plugin can be greatly reduced.

Note on Performance Impact

Deleting the references likely will not offer any noticeable performance gain, beyond marginally improving plugin load speed upon launching the game.

However, it does make it easier to analyze the output plugin later by removing redundant data, for example:

  • Viewing modified cells in CSSE or low-level editors: Cells containing only grass moved by Lawnmower will no longer appear as modified.
  • Viewing a text representation of the plugin created by Tes3cmd dump, Tes3conv JSON or DeltaPlugin YAML: Cleaning the plugin ‘declutters’ it so redundant data does not clutter the results.

Cleaning the output plugin of redundant CELL references involves two steps:

  1. Delete the moved grass with Tes3cmd.
  2. Clean the plugin of any empty cells with TESTool.

The second step is useful for instances where Lawnmower has removed all grass from a cell, leaving an empty CELL record.

Step 1 - Tes3cmd

Thankfully, the moved references have one unique thing in common: their coordinates have all been moved to Z: -20,000.

The following Tes3cmd delete command will delete all the moved references:

tes3cmd delete --instance-match "Z\:-20000" <path-to-plugin>

Replace <path-to-plugin> with your plugin name.

Step 2 - TESTool

Caption


TESTool ‘Clean ESP/ESM files’ can clean empty cells from plugins.

TESTool can clean empty cells which are otherwise not considered by Tes3cmd as ‘junk cells’.

Simply run TESTool ‘Clean ESP/ESM files’ on the output plugin.

Further Reading

Footnotes

  1. “Python for Beginners: Installing”, Python.org, accessed August 24, 2024