GetMaterialCount
Landscape
Material
5.1 OC
int
int
material_index
Material index
Returns the amount of the specified material found in the landscape.
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.
/* 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.
Material
wipfmetz2002-08