To be honest, I didn't fully understand your problem. I think you are overcomplicating things and/or haven't understood the structure of the banks (which are xml files) completely.
The bank should be named like your map + sth wierd so it is unique. Every player playing your map will have a bank file named after this. Sections are 'chapters' within this bank file and are for sorting/categorizing purposes. If you store only things like single numbers (high score?!) for every player, put everything in the same section. Sections are only useful if you have multiple units (heroes?) with same named stats (like every hero has a level).
However, the big missunderstanding here is, that every player's bank file IS a single personal copy of the values you write in it, since only his/her stuff is saved locally.
To illustrate I copy/paste you some code which is actually working 100% from a map of mine. There is little/no comments, but I think this should be self explainatory.
LOADING
(Note: i is a local integer, -XP is aglobal integer array of length 4, PlayerBanks is global Bank array of length 4)
Bank-Preloadandsynchronizebank"icecrushertd2"forplayer1Bank-Preloadandsynchronizebank"icecrushertd2"forplayer2Bank-Preloadandsynchronizebank"icecrushertd2"forplayer3Bank-Preloadandsynchronizebank"icecrushertd2"forplayer4----- preload&synchronize does NOT allow for variables!General-Foreachintegerifrom1to4withincrement1,do(Actions)ActionsBank-Openbank"icecrushertd2"forplayeriVariable-SetPlayerBanks[i]=(Lastopenedbank)General-If(Conditions)thendo(Actions)elsedo(Actions)If(BankPlayerBanks[i]has"xp"insection"global")==TrueThenVariable-Set-XP[i]=(Load"xp"ofsection"global"frombankPlayerBanks[i]asintegervalue)ElseVariable-Set-XP[i]=0
Doesn't it return 0 by default if no integer was stored?
Haven't tried it yet. There was a time (according to some tutorial I read), where this was needed in order to not have errors popping up. The else-branch could be avoided through setting default values.
For my Win Loss System map that was supposedly ready I realized that since I do the triggers like that: Store Real In Section 1 for Player 1, store Real in Section 2 for Player 2, Store.. Section 3 for Player 3.. etc the problem occurs:
Let's say I play the map and im player 1, another time i play the map and im player 4. Since Player 4 should get Section 4 loaded but the Bank contains Section 1 because I previously played as Player 1, it won't load anything since my Bank contains Section1. I thought this would be solved if I named the same Section for all players -.- what happens is all players load my bank which is so wrong..
So can you pls tell me how to fix this on that map?
Is the win/lose stat dependent on which palyer slot you were? If that's the case then just add variables for each slot and put them all in the same section. I think you have missunderstood something completely about how banks work. There is NOT "one" bank in which everybody stores his/her stuff from your map. A bankfile is a local (on your computer) file. It exists individually for every combination of MAP, ACCOUNT, and COMPUTER. Other player's can't even access your bankfile if there is not some sort of transfer/comparison coded into your map's triggers.
Why don't you save the w/l ratio (or whatever) in key "wlr" in section "whatever". Why has this value to be slot dependent? When you load up the data again make an array of type real named winloseratio[n] (where n is the number of players) and you load from Player 1's bank the key wlr from section whatever and save it in winloseratio[1] and so forth.
......
To be honest, I didn't fully understand your problem. I think you are overcomplicating things and/or haven't understood the structure of the banks (which are xml files) completely. The bank should be named like your map + sth wierd so it is unique. Every player playing your map will have a bank file named after this. Sections are 'chapters' within this bank file and are for sorting/categorizing purposes. If you store only things like single numbers (high score?!) for every player, put everything in the same section. Sections are only useful if you have multiple units (heroes?) with same named stats (like every hero has a level).
However, the big missunderstanding here is, that every player's bank file IS a single personal copy of the values you write in it, since only his/her stuff is saved locally. To illustrate I copy/paste you some code which is actually working 100% from a map of mine. There is little/no comments, but I think this should be self explainatory.
LOADING (Note: i is a local integer, -XP is aglobal integer array of length 4, PlayerBanks is global Bank array of length 4)
STORING
THE BANK FILE (which may be found in your documents folder)
And for you little hackers out there: the bank files for Icecrusher TD 2 are encrypted hardcore so don't even try :)
Doesn't it return 0 by default if no integer was stored?
Haven't tried it yet. There was a time (according to some tutorial I read), where this was needed in order to not have errors popping up. The else-branch could be avoided through setting default values.
......
Is the win/lose stat dependent on which palyer slot you were? If that's the case then just add variables for each slot and put them all in the same section. I think you have missunderstood something completely about how banks work. There is NOT "one" bank in which everybody stores his/her stuff from your map. A bankfile is a local (on your computer) file. It exists individually for every combination of MAP, ACCOUNT, and COMPUTER. Other player's can't even access your bankfile if there is not some sort of transfer/comparison coded into your map's triggers.
Why don't you save the w/l ratio (or whatever) in key "wlr" in section "whatever". Why has this value to be slot dependent? When you load up the data again make an array of type real named winloseratio[n] (where n is the number of players) and you load from Player 1's bank the key wlr from section whatever and save it in winloseratio[1] and so forth.
Players can't really influence their player number, so I wouldn't make the map dependent on that.
In theory, you should be able to ignore the player number and only use it to reference the bank in the bank array.
Like BlacKcuD said, banks are separated from each other.
Best usage is, preload the banks, then open all of them and store them into an array with the player number as the key for the array.
Then you read the values out of the bank array "Banks[player]" with a section "stats" and the keys "WinAmount" and "LossAmount".
If you save a bank, the game already knows on which player's hard disk the bank has to be saved.
As BlacKcuD said, it's impossible to store other players' banks on your computer without writing code that copies all entries into another bank.
......