SC2Mapster.com Wiki

SC2 API / Functions / AIGetUserInt

AIGetUserInt

int AIGetUserInt(int player, int index);

Retrieves user-defined integer data from a player-specific array.

Parameters

int player

The player this data will be associated with.

int index

The index of the array to retrieve the data from. Valid values are 1-256. Supposedly Blizzard is using indexes 1-10 already.

Return value

int - The integer value stored at the specified index for this player.

Examples

Example: Expansions
int numExpansions=AIGetUserInt(player, 109); //value previously stored

if ((AIGetTime()>720)&&(numExpansions<1)) {

           //Actual expansion code here.
           //.....
           //Increment number of expansions we have by 1
           AISetUserInt(player, 109, numExpansions+1);
}

Notes

  • Index 109 was arbitrarily chosen by the Starcrack development team as the index to store the number of expansions in for their particular AI. Any other index would work just as well.

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

Table of contents

  1. 1 Notes

Facts

Date created
Mar 25, 2010
Last updated
Mar 25, 2010

Author