Hero Save/ Load System
NOTE: This Project has not been updated for patch 1.2. Bank security is not implemented at the present time.
Hero Saving and Loading System
What is it and what does it do?
This is a dialog based system which manages the saving and loading of heroes with a bank file over multiple sessions. This system was primarily developed for use with an RPG type of map.
Features
Supports up to 14 players
3 Slots for the Saved Heroes (which can be easily increased)
Simplified Interface
Easy to Implement
How do I use it?
This system should be really easy to implement. I am confident that it will work as soon as you implement it, however you will likely want to change some things first.
All you have to do to install it is modify the bank name used for the map and the spawn point variable location to set up the core functionality for the map.
To add to the hero selection, there will be a bit of extra effort required, however it should still be relatively straight forward.
Installation
1. If you have created a new map, remove some of the Melee Initialization triggers (especially the victory/ defeat one, it's annoying).
2. Open the trigger editor and make sure libraries are visible.
3. From the menu go to Data -> Library -> Import Library. Select this library from the file chooser.
4. Modify the variable SpawnPoint to whatever point in your map you want the hero to appear at after the selection process.
5. Replace BankName in various actions in Initialization with whatever you want to name your bank.
6. Installation is finished. You will now have to customize it to suit your needs.
IMPORTANT: For each player you are going to allow in the game, you MUST preload and synchronize the bank for them. Unfortunately this will require a manual process, which is why I did it only 4 times.
Customize
To add more heroes to the hero selection, you will have to:
• Increase the size of the variable SelectHeroDialogItems. Ensure that the minimum size of this array is 1 (i.e. 0 for cancel and 1 for random).
• In the trigger Initialization create a dialog button for each hero you want to select.
• In the trigger Dialog Actions adding a new case to the switch with the appropriate action for selecting a hero.
• In the function Randomize Hero add a new case to the switch for each hero you want randomized and increase the range of integers of which the random hero is determined from (in the if statement).
To increase the amount of slots you must add additional dialog buttons for the save and load dialogs and add more cases to the switch statement in Dialog Actions. When you call the functions Save Hero and Load Hero, the second parameter decides the save slot. All you have to do is put in which ever slot you want and it should work.
Known Issues and Bugs
Due to the way Blizzard saves the items in a unit's inventory into a bank, if you use charges and then save and reload the hero it is refreshed to maximum.
If you experience any issues when using this system, please let me know! I have not tested it with more than 3 players and the recent tweaks and modifications have only been tested by me in single player mode.
License
This library is free to use by anyone and is also free to modify as well. Credit is not required if/ when you use this in your map.
Do not attempt to charge anyone for the download or use of this library. Do not redistribute it under your name unless modified extensively. If you modify it and re-release it, give credit to myself for the initial system.
The system works perfectly! Thanks a lot. I added another dialog titled, "This will overwrite your saved hero", with buttons "Confirm" and "Cancel". That way players won't accidentally overwrite a save slot in 1 click. I also stored the hero levels and names in the bank as text. Then I can make my load buttons show as "Lvl.1 Paladin" instead of just "Slot 1".
I have been able to get the hero selection working, but I am having difficulties with the save function itself. I made my own custom heroes. I can't find a place where I have to insert them in order for them to be accepted for the save option. If you could give me a hand with this it would be greatly appreciated :)