GetMaterialCount

Category: Landscape / Material
Since engine version: 1.0 OC

Description

Returns the amount of the specified material found in the landscape.

Syntax

int GetMaterialCount(int material_index);

Parameter

material_index:
Material index

Remark

A returns value of -1 indicates that no valid result could yet be determined. Valid results are not available during the first 500 frames of the round or if NoScan is enabled in the scenario core. Results are updated only roughly every 500 frames - inbetween updates values will remain unchanged.

Example

/* Is the game goal fulfilled? */
public func IsFulfilled()
{
  // Gold hasn't been counted yet
  if ((var gold_count=GetMaterialCount(Material("Gold"))) == -1) return false;
  // still too much?
  if (gold_count >= 150) return false;
  // or still gold chunks to mine?
  if(ObjectCount(Find_ID(Gold))) return false;
	return true;
}
				
A script for a goldmine goame goal.
See also: Material
wipfmetz, 2002-08