To be honest, I'm not even sure what I'm doing so should I delete that line?
No, just remove the - 1 arithmetic from it.
Understand that Player
1 (red) has the Player Number
1, Player
2 (blue) has the Player Number
2, and this pattern continues for each player. It's a pretty simple concept, their number is self evident.
You're using this Player Number in the [Index] of your Arrays in order to save data for specified players. This is one of the many ways of keeping track of things for each player and it works great.
However, subtracting 1 from the Player Number serves little to no purpose here. Why use SavePlayerHero[
0] (1 - 1 =
0) when you can just use SavePlayerHero[1]. Don't get me wrong, it's perfectly fine to use Index [0] but in this case it's just unnecessary. There's no reason to give yourself more work if you don't have to.
Also, I'd rename the variable to PlayerHero since you'll most likely want to be using this throughout all of your triggers. You should ask yourself, what does each Player have in common that I need to keep track of, and create Variable arrays for each of those things.
For example (X = Player Number):
PlayerHero[X] = This Unit array contains each player's hero
PlayerLives[X] = This Integer array keeps track of how many lives a player has
PlayerCanRepick[X] = This Boolean array determines whether a player can repick or not (true/false)
Obviously your map may not have a Lives system or a Repicking system but this is just an example. All of this information can be tracked using Arrays + Player Number. The goal is to have a design where if you have access to a Hero you can get all of that hero's Player related variables and if you have access to a Player you can get access to their Hero and all of their Unit related variables. Combine this with Unit Groups/Player Groups and you'll be able to easily manipulate your Players/Heroes at any given time in any given trigger.
With all of that in mind, I don't think you should bother tackling a save system until you've got the fundamentals down for tracking data in Variables and working with Arrays. Otherwise, you'll be skipping over an important step that is integral to understanding the save system and basically any advanced triggers.