objective_utils.lua

This script contains utility functions for typical tasks that need to be checked for objectives.

To make these function(s) available include this file at the beginning of a script via:

include "scripting/objective_utils.lua"
check_for_buildings(plr, which[, region])

Checks if the number of buildings defined in which are found for the given player. If region is given, buildings are only searched on the corresponding fields. If more buildings or equal the number of requested buildings are found, this function returns true.

Example usage:

check_for_buildings(wl.Game().players[1], {lumberjacks_hut=2, quarry=1})
Parameters
Returns

true if the requested buildings were found, false otherwise