Skip to content

A Valheim mod for tracking farm population

License

Notifications You must be signed in to change notification settings

joeyparrish/valheim-farmcounter

Repository files navigation

FarmCounter - A Valheim Mod by Joey Parrish

Source: https://github.com/joeyparrish/valheim-farmcounter

FarmCounter Preview Video
FarmCounter Preview Video

About

FarmCounter lets you add special tags to a sign that will be replaced with counts of nearby creatures.

For example, $tame_boar would be replaced with a count of "nearby" tamed boars, while $wild_deer would be replaced with a count of "nearby" wild deer.

See the definition of "nearby" below.

Installation

FarmCounter is published on both ThunderStore and Nexus Mods. Install using your favorite mod manager.

Tags for vanilla tameable creatures

Creature Tag
Tame Boar $tame_boar
Tame Piggy $tame_boarpiggy
Tame Wolf $tame_wolf
Tame Wolf Cub $tame_wolfcub
Tame Lox $tame_lox
Tame Lox Calf $tame_loxcalf

Tag construction

A tag has a prefix and a suffix.

The prefix is either $tame_ to count tame creatures, $wild_ to count wild creatures, or $all_ to count both.

The suffix is the untranslated name of a creature. A full list can be found in Jotunn's docs on translation data. If the name is $enemy_boar, the suffix is simply boar.

So, for example, $all_goblin would count all nearby Fulings. If you're using a mod like AllTameable or Pokéheim, then any creature could be considered tame.

Extended tag syntax for modded creatures

Modded creatures that don't follow the normal $enemy_ pattern in m_name can still be counted. There is an extended syntax that you can use for names that contain spaces or don't follow normal patterns.

Extended tags take the form of ${tame_...}, ${wild_...}, or ${all_...}, where the ... part is the exact m_name for the modded creature. It can contain any character but }.

For example, when using the OdinHorse mod, there is a creature with m_name set to $horse_odin. To count tame horses, use the tag ${tame_$horse_odin}. Foals can be counted with ${all_$horse_offspring}.

For another example, AllTameable creates baby deer with m_name set to Mini $enemy_deer. To count tame baby deer, use the tag ${tame_Mini $enemy_deer}.

Defining "nearby"

Valheim defines your "base" as anything in range of your workbenches, so this mod uses a similar definition.

A creature is in range of your sign if it is range of any workbench in range of your sign.

In vanilla Valheim, workbenches have a 20 meter range. If you're using a mod such as Valheim Plus, FarmCounter will detect the overridden distance from the other mod and use that instead.

To determine the number of nearby workbenches, you can use the special debugging tag $all_workbench.

Dependencies

Just BepInEx.

Incompatibilities

None that we know of!

Multiplayer

If someone is not using the mod, they will simply see the raw tag on the sign.

Links

Credits

FarmCounter was created by Joey Parrish.