Even before you have any data you want to store, you need to have
AreasPassedTracking = 0 <Integer>
AreasPassedTrackingBank = No Bank <Bank>
-
Areas Passed Tracking
-
Events
-
Game - Map initialization
-
Local Variables
-
Conditions
-
Actions
-
Bank - Preload and synchronize bank "AreasPassedTracking" for player 1
-
Bank - Open bank "AreasPassedTracking" for player 1
-
Variable - Set AreasPassedTrackingBank = (Last opened bank)
-
Variable - Set AreasPassedTracking = (Load "MyKey" of section "MySection" from bank AreasPassedTrackingBank as integer value)
That is Preload and Open bank for the player or players should be always on some Map Init event. This tells it to load the data that the Bank contains for the player, so that the map can use it. Also, the variable I will further modify always loads the Data of the Bank where I saved such value.
You can pick all players and open bank for (Picked player) but doing so for Preload
won't work. Always Preload with a separate action,
Bank - Preload and synchronize bank "AreasPassedTracking" for player 1
Bank - Preload and synchronize bank "AreasPassedTracking" for player 2 etc.
The first time you run the trigger, the Variable will be 0 as there is no bank to take the data from. The next time, it will load the value from the file that saved in your Banks\ folder.
You save information (integers, reals, strings) in specific Sections under specific Keys. Key is just the name of the value (integer, real etc) that you will store, Section is the location or the line within the Bank where the Key will be stored.
These Keys and Sections are created when you decide to save the bank, like I decide to track how many times I restarted the map, so when the map ends - which happens when I enter a region, I give the triggers to save the bank:
-
Next Area
-
Events
-
Unit - Any Unit Enters Next Area
-
Local Variables
-
Conditions
-
Actions
-
Variable - Modify AreasPassedTracking: + 1
-
Bank - Store integer AreasPassedTracking as "MyKey" of section "MySection" in bank AreasPassedTrackingBank
-
Bank - Save bank AreasPassedTrackingBank
-
Game - End game in Victory for player 1 (Hide dialogs, Hide score screen)
I increase the variable (which is loaded from the bank or zero if for the first time) every time the map ends, then when the map starts, I have already given it to load the info from the Bank and when it ends again it modifies this value further.
This is what a Bank looks like edited as TXT
PHP:
<?xml version="1.0" encoding="utf-8"?>
<Bank version="1">
<Section name="MySection">
<Key name="MyKey">
<Value int="16"/>
</Key>
</Section>
</Bank>
I set all under a single Section, with a Key name the same as the Section. If you got more than 1 Section, that is you set different Keys in different sections or the same Key name in different sections you would get, (e.g save Key: Life in Section HeroStats, save Energy in Section HeroStats in TheSameBank)
PHP:
<Section name="Name1">
<Key name="KeyName1">
<Value int="16"/>
<Section name="HeroStats">
<Key name="Life">
<Value int="1500"/>
<Key name="Energy">
<Value int="500"/>
<Section name="Another Name">
<Key name="Another key name">
<Value int="100"/>
Avoid using spaces or numbers, non-letter characters when typing the bank name, while you can for Keys and Sections. A bank must be up to 10KB in size, you could make several banks but that would be inefficient for the same map.