SC2Mapster.com Wiki

SC2 API / Functions / PlayerGetPropertyInt

PlayerGetPropertyInt

int PlayerGetPropertyInt(int player, int property);

Property of the player such as resources and supplies.

Parameters

int player

Player to get the property from.

int property

Property you want to get. Can be one of

  • 0 (c_playerPropMinerals): Current mineral
  • 1 (c_playerPropVespene): Current vespene
  • 4 (c_playerPropSuppliesUsed): Current Supply
  • 5 (c_playerPropSuppliesMade): Current Max Supply
  • 6: Max Supply? (always 200)

Return value

int - Corresponding player property

Examples

Example #1: Usage
// Example at game startup: 
// You've got 50 mineral, 0 vespene and 7/10 population
int player = 1;

int mineral = // 50
    PlayerGetPropertyInt(player, c_playerPropMinerals);

int vespene = // 0
    PlayerGetPropertyInt(player, c_playerPropVespene);

int usedSupplies = // 7
    PlayerGetPropertyInt(player, c_playerPropSuppliesUsed);

int madeSupplies = // 10
    PlayerGetPropertyInt(player, c_playerPropSuppliesMade);

int maxSupplies = // 200
    PlayerGetPropertyInt(player, 6);
Example #2: Mineral Helper
int AIMineralsTotal (int player) {
    return PlayerGetPropertyInt(player, c_playerPropMinerals) 
      + AIGetMineralAmountLeft(player, c_townMax);
}

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Mar 11, 2010
Last updated
Mar 11, 2010

Author