Banks are used to call data saved from a previous play. They are mostly used for Save/Load systems and Ranking systems. Banks are saved onto the person's computer as .Sc2Bank file. Banks have an XML type structure. A map can use a bank to record stats, progress, and other data. It is possible that two maps may use the same bank this may cause loss of data. Though through this players may actually use a map to 'hack' their bank.
Example: amount of time spent in a map
First of all, create those 2 variables:
Minutes spent in map (Bank) = No Bank <Bank> Minutes = 0 <Integer>
You can now proceed to steal this work without giving any credits:
Initialization Events Game - Map initialization Local Variables Conditions Actions Bank - Open bank "Minutes" for player 1 Bank - Preload and synchronize bank "Minutes" for player 1 Variable - Set Minutes spent in map (Bank) = (Last opened bank) Variable - Set Minutes = (Load "Minutes" of section "Time Event" from bank (Last opened bank) as integer value)
Update Events Timer - Elapsed time is 60.0 Real Time seconds Local Variables Conditions Actions Variable - Modify Minutes: + 1 Bank - Store integer Minutes as "Minutes" of section "Time Event" in bank Minutes spent in map (Bank) Bank - Save bank Minutes spent in map (Bank) UI - Display (Combine ("Minutes of your life wasted in this...", (Text(Minutes)))) for (All players) to Chat area
Note: The "Preload ans synchronize" action, while looking useless, is extremely important. I've also heard there was a maximum of values we could store in Banks, though I do not have any source to quote nor do I even have numbers to share.
- "Preload and Synchronize Bank" can be put anywhere in your triggers, because it's executed before everything else during the loading screen (it basically makes Banks available to the map). You can't use variables for the bank name or the player number because variables aren't even initialized when that code is called. (Whiskee)