Part 3: Buildings and resources

GetResource(int inResourceID, out uint outAmount)
Returns the amount of the specified resource currently stored in warehouses or the buildings that produce it. The resource ID is determined from IDMaker. This can be useful as a trigger, for example to unlock a building. Example:

  int mDataIDOlives = IDMaker.FromString("c4cr Olives");
  game.GetResource(mDataIDOlives, out nOlives);

This tells you how many olives are stored in the city. Note that the input to IDMaker.FromString is generally of the form "c4cr <XXXX>" where <XXXX> is the name of the resource.

GetActiveBuildings(int inBuildingID, out uint outAmount)
This returns the number of active (i.e. not mothballed) buildings of the specified type, as indicated by the ID returned from IDMaker. Example use - this counts the number of (non-mothballed) medium domi:

  uint nMedDomi = 0;
  int mIDDomus2 = IDMaker.FromString("C4b Equites Housing 02");
  game.GetActiveBuildings(mIDDomus, out nMedDomi);

See Part 10 for a complete (I believe) list of building IDs.

GetInactiveBuildings(int inBuildingID, out uint outAmount)
This returns the number of inactive (i.e. mothballed) buildings of the specified type, as indicated by the ID returned from IDMaker. Usage is otherwise as for GetActiveBuildings described above.

GetTotalBuildings(int inBuildingID, out uint outAmount)
Returns the total number of buildings of the specified type, whether active or inactive. Usage is otherwise as for GetActiveBuildings described above.

GetBuildingsCollapsing(out bool outCollapsing)
Not tested but presumably returns the flag as true if there are any buildings that are about to collapse.

GetBuildingsOnFire(out bool outOnFire)
Not tested, but presumably the returned flag indicates if there are currently any buildings on fire.

GetBuildingsPlagued(out bool outPlagued)
Not tested, but presumably the returned flag indicates if plague is currently affecting any buildings.

GetFigures(out bool outOnMap)
Returns the outOnMap flag as TRUE if there are any people on the map - whether traders, or people immigrating, emigrating, wandering around or staying at home doing nothing.

< Previous: City ratings and other stats | Editor Guide | Next: UI Controls >