TriggerHappy's Codeless Save and Load tutorial

Level 18
Joined
Jun 26, 2020
Messages
1,448
This is a tutorial of how to use the Codeless Save and Load (Multiplayer) - v3.0.1
Before starting, there are multiple tools to integrated in the system that you can use
This add functions to make easier use the system in code, because it's make it for GUI
You can configure it to your taste, but by default this is what do:
vJASS:
// Is the max length the saved code can have (GUI equivalent: SaveLoadMaxLength)
static method MaxCodeSyncLength takes nothing returns integer

// Returns the hero of a player using its index (GUI equivalent: SavePlayerHero[])
static method GetUserHero takes User user returns unit

// Removes the hero of the player
static method RemoveUserHero takes User user returns nothing

// Asigns a hero to a player using its index (GUI equivalent: SavePlayerHero[])
static method SetUserHero takes User user, unit u returns nothing

// Returns if the player is loading its data (GUI equivalent: SavePlayerLoading[])
static method IsUserLoading takes User user returns boolean

// Sets if the player is loading its data (GUI equivalent: SavePlayerLoading[])
static method SetUserLoading takes User user returns boolean

// Sets the data slot of the player that will be used (GUI equivalent: SaveCurrentSlot[])
static method SetSaveSlot takes User user, integer slot returns nothing

// Returns the data slot of the player that will be used (GUI equivalent: SaveCurrentSlot[])
static method GetSaveSlot takes User user returns integer

// Returns a string that says: <name of the unit-type of the unit>: (<proper name of the unit>)
static method GetUnitTitle takes unit u returns string

// Returns the stored map name (GUI equivalent: MapName)
static method GetMapName takes nothing returns string

// Returns the max ability level a hero can have
static method MaxAbilityLevel takes nothing returns integer

// Returns how many abilities a hero can have (GUI equivalent: SaveAbilityTypeMax)
static method MaxAbilities takes nothing returns integer

// Returns how many items a hero can have (GUI equivalent: SaveItemTypeMax)
static method MaxItems takes nothing returns integer

// Returns how many units a hero can have (GUI equivalent: SaveUnitTypeMax)
static method MaxUnits takes nothing returns integer

// Returns how many names a hero can have (GUI equivalent: SaveNameMax)
static method MaxNames takes nothing returns integer

// Returns how many strength, agility or intelligence a hero can have (GUI equivalent: SaveUnitMaxStat)
static method MaxHeroStat takes nothing returns integer

// Returns the stored ability-type (GUI equivalent: SaveAbilityType[])
static method GetAbility takes integer index returns integer

// Returns the stored item-type (GUI equivalent: SaveItemType[])
static method GetItem takes integer index returns integer

// Returns the stored unit-type (GUI equivalent: SaveUnitType[])
static method GetUnit takes integer index returns integer

// Returns the stored name (GUI equivalent: SaveNameList[])
static method GetHeroNameFromID takes integer id returns string

// Returns the index where is stored the item-type
static method ConvertItemId takes integer itemId returns integer

// Returns the index where is stored the unit-type
static method ConvertUnitId takes integer unitId returns integer

// Returns the index where is stored the name
static method GetHeroNameID takes string name returns integer

// Loads the next saved value and stores in the GUI variable SaveValue[SaveCount] (only if the GUI variable SaveTempInt was initialized)
static method GUILoadNext takes nothing returns nothing

// Returns the XP a hero should have to get the specified level
static method GetLevelXP takes integer level returns real

// Starts the SaveHelper library, you should call it after you set the values that will be stored
static method Init takes nothing returns nothing
Outside the SaveHelper struct are other utility functions:
vJASS:
// Saves the hero (Runs the SaveGUI trigger) and returns the generated code (only if the GUI variable SaveUseGUI is true)
function GetHeroSaveCode takes unit u returns string

// Saves the player data for the owner of the unit in the specified slot
function SaveCharToSlot takes unit u, integer slot, string s returns nothing

// Clears the player data in the specified slot
function DeleteCharSlot takes player p, integer slot returns nothing

// Loads the player code in the specified slot and only if is valid syncs it with the rest of the players
// If the process is a success it will run the "SaveLoadEvent_Code Becomes Equal to 1.00" event
// The getters of that event are the GUI variables SaveLoadEvent_Code and SaveLoadEvent_Player
function LoadSaveSlot takes player p, integer slot returns nothing
Makes easier synchronize local data between players:
vJASS:
// Sends data to the server, you should use it in a:
// if GetLocalPlayer == p then
//     SyncString(s)
// endif
function SyncString takes string s returns boolean

// Adds a listener every time you syncs data
function OnSyncString takes code func returns triggeraction

// Removes an added listener
function RemoveSyncString takes triggeraction t returns nothing
Makes easier save data to the disk
vJASS:
// Returns the name of the folder where you will save the data (GUI equivalent: MapName)
static method operator Folder takes nothing returns string

// Returns the path where is saved the data in the specified slot
static method getPath takes integer slot returns string

// Creates an instance (this instances are the slots, so to use it use the typecast SaveFile(slot))
static method create takes player p, string title, integer slot, string data returns thistype

// Clears the player data in the specified slot
static method clear takes player p, integer slot returns thistype

// Returns if is saved data in the specified slot (not synchronized)
static method exists takes integer slot returns boolean

// Returns the text in the specified line and maybe in the previous (not synchronized)
method getLines takes integer line, boolean includePrevious returns string

// Returns the text only in the specified (not synchronized)
method getLine takes integer line returns string

// Returns the text in the first line (not synchronized)
method getTitle takes nothing returns string

// Returns the text in the second line, the saved code (not synchronized)
method getData takes nothing returns string
I will not delve into the other libraries, because the PlayerUtils has its own API and the others are more internal, and is better don't touch them unless you know what you are doing.
ADVICE: If you are importing the system instead of using the original map, you should set the number of levels the ability Magic Leash (Raw code: Amls) to 2 and set the level 2 tooltip normal the value "!".

First
In the Save Init trigger you should set the values:
  • -------- This is the max number of things that you can save. --------
  • Set VariableSet SaveLoadMaxLength = 64
  • -------- Set if you will use GUI or Jass/Lua. --------
  • Set VariableSet SaveUseGUI = True
  • -------- This willl be the directory the save codes will be saved to. --------
  • Set VariableSet MapName = CodelessDemo
  • -------- This message will display to players who don't have local files enabled, to know if its true use the value (in custom script): File.ReadEnabled --------
  • Set VariableSet LocalFiles_WarningMessage = |cffe53b3bYou need to enable local files to load your character from disk on patches prior to 1.30!
  • -------- Show the save code --------
  • Set VariableSet SaveShowCode = True
  • -------- Set these to the values they are in the Advanced -> Gameplay constants --------
  • -------- Allows us to calculate how much XP a hero has --------
  • -------- Note: You can also save EXP the easy way but it will generate a longer code. --------
  • Set VariableSet HeroXPConstant = 0
  • Set VariableSet HeroXPLevelFactor = 100
  • Set VariableSet HeroXPPrevLevelFactor = 1
  • Set VariableSet HeroXPRequired = 200
Also you have to see the main values of the system (Always starting from 1):
  • -------- Store unit types that can be saved here --------
  • Set VariableSet SaveUnitType[1] = <Unit-type 1>
  • Set VariableSet SaveUnitType[2] = <Unit-type 2>
  • Set VariableSet SaveUnitType[3] = <Unit-type 3>
  • etc
  • -------- Store item types that can be saved here --------
  • Set VariableSet SaveItemType[1] = <Item-type 1>
  • Set VariableSet SaveItemType[2] = <Item-type 2>
  • Set VariableSet SaveItemType[3] = <Item-type 3>
  • etc
  • -------- Store ability types that can be saved here --------
  • Set VariableSet SaveAbilityType[1] = <Ability 1>
  • Set VariableSet SaveAbilityType[2] = <Ability 2>
  • Set VariableSet SaveAbilityType[3] = <Ability 3>
You can also set your own values, the system only stores integers so you have to asign an integer to them also a max value like this:
  • Set VariableSet MyValue[1] = <Value 1>
  • Set VariableSet MyValue[2] = <Value 2>
  • Set VariableSet MyValue[3] = <Value 3>
  • Set VariableSet MyValueMax = 3
Second
To save the values in a trigger with any event you have to store the values (by default this is in the trigger Save GUI) like this:
  • Set VariableSet SaveCount = -1
  • Set VariableSet SaveTempUnit = <Your hero>
  • -------- Save level of ability --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveValue[SaveCount] = (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit)
  • Set VariableSet SaveMaxValue[SaveCount] = 10
  • -------- Save Items --------
  • For each (Integer SaveTempInt) from 0 to 5, do (Actions)
    • Loop - Actions
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertItemId(GetItemTypeId(UnitItemInSlot(udg_SaveTempUnit, udg_SaveTempInt)))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
  • -------- Save Unit Type --------
  • -------- The SaveHelper has a way to get the position of the unit-type --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertUnitId(GetUnitTypeId(udg_SaveTempUnit))
  • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
To save your own values, for example the value 2 with a max value of 3 just do:
  • -------- Save my value --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveValue[SaveCount] = 2
  • Set VariableSet SaveMaxValue[SaveCount] = 3
After that you need the next lines:
  • -------- ------------------- --------
  • -------- Save to disk --------
  • -------- ------------------- --------
  • Custom script: set udg_SaveTempInt = Savecode.create()
  • For each (Integer A) from 0 to SaveCount, do (Actions)
    • Loop - Actions
      • Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
  • Set VariableSet SaveTempString = <Empty String>
  • Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(GetTriggerPlayer(), 1)
  • Custom script: call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, udg_SaveTempString)
This creates the file where the data is stored.
The part of:
vJASS:
call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), <slot>, udg_SaveTempString)
The slot field determines in what slot will be saved for the player

Third
To load the values you must call the function LoadSaveSlot(player, slot) and if there weren't a problem this will run the event "SaveLoadEvent becomes Equal to 1.00" with the getters SaveLoadEvent_Player and SaveLoadEvent_Code, to decode the code do:
vJASS:
set udg_SaveTempInt = Savecode.create()
call Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)
The called function returns a boolean that is true if the code was correctly decoded, and false if not.
WARNING: Don't use the SaveTempInt or other Temp variables, the system uses them and doing that will affect the system.

Fourth
Once the code was decoded to load first you have to load the values in the reverse order you saved them, following the previous example:
  • Set VariableSet SaveCount = -1
  • -------- Load my value --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveMaxValue[SaveCount] = 3
  • Custom script: call SaveHelper.GUILoadNext()
  • The loaded integer is stored in the variable SaveValue[SaveCount], do whatever you want with it
  • -------- Load Unit Type --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
  • Custom script: call SaveHelper.GUILoadNext()
  • The loaded integer is stored in the variable SaveValue[SaveCount], do whatever you want with it by using the variable SaveUnitType[SaveValue[SaveCount]]
  • -------- Load Items --------
  • For each (Integer A) from 0 to 5, do (Actions)
    • Loop - Actions
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
      • Custom script: call SaveHelper.GUILoadNext()
      • The loaded integer is stored in the variable SaveValue[SaveCount], do whatever you want with it by using the variable SaveItemType[SaveValue[SaveCount]]
  • -------- ------------------- --------
  • -------- Load level of ability --------
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveMaxValue[SaveCount] = 10
  • Custom script: call SaveHelper.GUILoadNext()
  • The loaded integer is stored in the variable SaveValue[SaveCount], do whatever you want with it by using the variable SaveAbilityType[SaveValue[SaveCount]]
Once doing that you should de-instance the Savecode instance:
vJASS:
call Savecode(udg_SaveTempInt).destroy()

Example:

Initialize values:
  • Save Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet SaveLoadMaxLength = 64
      • Set VariableSet SaveUseGUI = True
      • -------- ------------------- --------
      • Set VariableSet MapName = CodelessDemo
      • -------- ------------------- --------
      • Set VariableSet LocalFiles_WarningMessage = |cffe53b3bYou need to enable local files to load your character from disk on patches prior to 1.30!
      • Custom script: set udg_LocalFiles_WarningMessage = udg_LocalFiles_WarningMessage + "\n\n"
      • -------- ------------------- --------
      • Set VariableSet SaveShowCode = True
      • -------- ------------------- --------
      • Set VariableSet SaveHeroName = True
      • Set VariableSet SaveNameMax = 999
      • -------- ------------------- --------
      • Set VariableSet HeroXPConstant = 0
      • Set VariableSet HeroXPLevelFactor = 100
      • Set VariableSet HeroXPPrevLevelFactor = 1
      • Set VariableSet HeroXPRequired = 200
      • -------- Max STR/AGI/INT --------
      • Set VariableSet SaveUnitMaxStat = 999
      • -------- Store unit types that can be saved here --------
      • Set VariableSet SaveUnitType[1] = Jefe tauren
      • Set VariableSet SaveUnitType[2] = Exánime
      • Set VariableSet SaveUnitType[3] = Cazador de Demonios
      • Set VariableSet SaveUnitType[4] = Bruja de Mar
      • Set VariableSet SaveUnitTypeMax = 99
      • -------- Store item types that can be saved here --------
      • Set VariableSet SaveItemType[1] = Corona de los reyes +5
      • Set VariableSet SaveItemType[2] = Daga de escape de Kelen
      • Set VariableSet SaveItemType[3] = Máscara de muerte
      • Set VariableSet SaveItemType[4] = Orbe de hielo
      • Set VariableSet SaveItemType[5] = Anillo de protección +5
      • Set VariableSet SaveItemTypeMax = 999
      • -------- Store ability types that can be saved here --------
      • Set VariableSet SaveAbilityType[1] = Aura de resistencia
      • Set VariableSet SaveAbilityType[2] = Reencarnación
      • Set VariableSet SaveAbilityType[3] = Pisotón de guerra
      • Set VariableSet SaveAbilityType[4] = Nova de hielo
      • Set VariableSet SaveAbilityType[5] = Armadura de hielo (Lanzamiento automático)
      • Set VariableSet SaveAbilityTypeMax = 199
      • -------- ------------------- --------
      • Custom script: call SaveHelper.Init()
Save values:
  • Save GUI
    • Events
      • Whatever you want
    • Conditions
      • SaveUseGUI Equal to True
    • Actions
      • Set VariableSet TempPlayer = <Your player>
      • -------- You must have stored your hero. --------
      • Set VariableSet SaveTempUnit = SavePlayerHero[((Player number of TempPlayer) - 1)]
      • Set VariableSet SaveCount = -1
      • -------- Save Abilities --------
      • For each (Integer SaveTempInt) from 0 to SaveAbilityTypeMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit) Greater than 0
            • Then - Actions
              • -------- Save level of ability --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit)
              • Set VariableSet SaveMaxValue[SaveCount] = 10
              • -------- Save the array index --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = SaveTempInt
              • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
            • Else - Actions
      • -------- Save the number of abilities the unit has --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (SaveCount / 2)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • -------- Save Skill Points --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Unspent skill points of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- Save Items --------
      • For each (Integer SaveTempInt) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertItemId(GetItemTypeId(UnitItemInSlot(udg_SaveTempUnit, udg_SaveTempInt)))
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
      • -------- Save Attributes --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Strength of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Agility of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Intelligence of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- Save Experience (%) and Level --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = R2I( (GetHeroXP(udg_SaveTempUnit)) / SaveHelper.GetLevelXP(GetHeroLevel(udg_SaveTempUnit)) * 100) // percentage
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Hero level of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • -------- Save Unit Type --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertUnitId(GetUnitTypeId(udg_SaveTempUnit))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • -------- Save to disk --------
      • Custom script: set udg_SaveTempInt = Savecode.create()
      • For each (Integer A) from 0 to SaveCount, do (Actions)
        • Loop - Actions
          • Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
      • Set VariableSet SaveTempString = <Empty String>
      • Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(udg_TempPlayer, 1)
      • Custom script: call SaveFile.create(udg_TempPlayer, SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, udg_SaveTempString)
Load values:
  • Load GUI Manual
    • Events
      • Whatever you want
    • Conditions
      • SaveUseGUI Equal to True
    • Actions
      • Set VariableSet TempPlayer = <Your player>
      • Custom script: call LoadSaveSlot(udg_TempPlayer, udg_SaveTempInt)
  • Load GUI
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
      • SaveUseGUI Equal to True
    • Actions
      • -------- Validate --------
      • Custom script: set udg_SaveTempInt = integer(Savecode.create())
      • Custom script: if not (Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)) then
      • Game - Display to (Player group(SaveLoadEvent_Player)) the text: Invalid load code (...
      • Skip remaining actions
      • Custom script: endif
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Loaded " + User[udg_SaveLoadEvent_Player].nameColored + "'s character!")
      • Set VariableSet SaveCount = -1
      • -------- Load Hero --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • Custom script: call SaveHelper.GUILoadNext()
      • Unit - Create 1 SaveUnitType[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of (Playable map area)) facing Default building facing degrees
      • Set VariableSet SaveTempUnit = (Last created unit)
      • Set VariableSet SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] = SaveTempUnit
      • Selection - Select SaveTempUnit for SaveLoadEvent_Player
      • -------- Load Experience and Level --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempReal = SaveHelper.GetLevelXP(udg_SaveValue[udg_SaveCount-1])
      • Hero - Set SaveTempUnit experience to (Integer((((Real(SaveValue[SaveCount])) / 100.00) x SaveTempReal))), Hide level-up graphics
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of SaveTempUnit) Not equal to SaveValue[(SaveCount - 1)]
        • Then - Actions
          • Hero - Set SaveTempUnit Hero-level to SaveValue[(SaveCount - 1)], Hide level-up graphics
        • Else - Actions
      • -------- Load Attributes --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Intelligence of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Agility of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Strength of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- Load Items --------
      • For each (Integer A) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
          • Custom script: call SaveHelper.GUILoadNext()
          • Hero - Create SaveItemType[SaveValue[SaveCount]] and give it to SaveTempUnit
      • -------- Load Skill Points --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify unspent skill points of SaveTempUnit: Set to 0 points
      • Hero - Modify unspent skill points of SaveTempUnit: Set to (SaveValue[SaveCount] - (Unspent skill points of SaveTempUnit)) points
      • -------- Load Abilities --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet SaveTempReal = (Real(SaveValue[SaveCount]))
      • For each (Integer A) from 0 to (Integer(SaveTempReal)), do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
          • Custom script: call SaveHelper.GUILoadNext()
          • Unit - Add SaveAbilityType[SaveValue[SaveCount]] to SaveTempUnit
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = 10
          • Custom script: call SaveHelper.GUILoadNext()
          • Unit - Set level of SaveAbilityType[SaveValue[(SaveCount - 1)]] for SaveTempUnit to SaveValue[SaveCount]
      • Custom script: call Savecode(udg_SaveTempInt).destroy()
If you have doubts, contact to me.
Last edited:
Top