GetMaterialCount
Category: Landscape
/ Material
Since engine version: 4.6.5.0 CP
Description
Returns the amount of the specified material found in the landscape.
Syntax
int GetMaterialCount
(int iMaterial, bool fReal);
Parameters
- iMaterial:
Material index
- fReal:
If true, MinHeightCount in the .c4m file of iMaterial is ignored.
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
/* Spielziel erfüllt? */
public func IsFulfilled()
{
// Gold noch nicht gezählt?
if ((var iGold=GetMaterialCount(Material("Gold")))==-1) return();
// noch zu viel?
if (iGold >= 150) return();
// noch Goldstücke abzubauen?
return(!ObjectCount(GOLD));
}
Script taken from goldmine game goal (GLDM).
wipfmetz, August 2002