Save\load help..

X

xzavius

Guest
Saiza said:
There is a fine Save / Load system on www.wc3sear.ch/index.php

When you search on spells. Kind of lond back in the list tho, 60 or something I think, Or was it 40? Ahh, nvm, if you really want it, you will use time to search for it ^^


wow it is on page 45, saved you guys
 

Chocobo

White-Flower
Reaction score
409
Mini-Tutorial for Save Load Code 0.18f/0.19a and 0.19h

I make a Mini-Tutorial for Save Load Code 0.18f/0.19a and 0.19h due to the lot of "I don't know what to do", or "What must I modify", or "How it works?".
If you want a Save Load code that saves Gold and Wood, I recommand you to read the Tutorial and to use Effane's Triggers located here :
http://www.thehelper.net/forums/showthread.php?t=37153&page=1
http://www.thehelper.net/forums/attachment.php?attachmentid=5830


1. High Protection Code (0.18f/0.19a)
1.1 Source Code
1.2 How Save works?
1.3 How Load works?
1.4 What to modify?
1.5 How works Base10 to Base32 and what is it?
1.6 Dummy Functions inside the map. How it works? (LATER)
2. Unprotected Code (0.19h) (LATER)
2.1 Source Code (LATER)

1. High Protection Code (0.18f/0.19a)

Save Load Codes 0.18f/0.19a uses a heavy name protection inside the code, randomizing one digit or more for the code.

Saves :
Level (Max of 999)
6 Items Carried
1 Hero Type
Player Name Protection

1.1 Source Code

Code:
Detect Hero
    Events
        Unit - Summoner 0001 <gen> Finishes training a unit
    Conditions
        ((Trained unit) is A Hero) Equal to True
    Actions
        Set Hero[(Player number of (Owner of (Trained unit)))] = (Trained unit)

This detect when a Hero is trained by the unit "Summoner 0001 <gen>". It sets the Hero to the Variable Hero[Player number of owner of the hero].


Code:
Randomize
    Events
    Conditions
    Actions
        Set Playername = (Substring(Playername, 1, 1))
        Set RandomizeCode = 17
        If (Playername Equal to a) then do (Set RandomizeCode = 17) else do (Do nothing)
        If (Playername Equal to b) then do (Set RandomizeCode = 5) else do (Do nothing)
        If (Playername Equal to c) then do (Set RandomizeCode = 16) else do (Do nothing)
        If (Playername Equal to d) then do (Set RandomizeCode = 8) else do (Do nothing)
        If (Playername Equal to e) then do (Set RandomizeCode = 4) else do (Do nothing)
        If (Playername Equal to f) then do (Set RandomizeCode = 7) else do (Do nothing)
        If (Playername Equal to g) then do (Set RandomizeCode = 1) else do (Do nothing)
        If (Playername Equal to h) then do (Set RandomizeCode = 15) else do (Do nothing)
        If (Playername Equal to i) then do (Set RandomizeCode = 10) else do (Do nothing)
        If (Playername Equal to j) then do (Set RandomizeCode = 12) else do (Do nothing)
        If (Playername Equal to k) then do (Set RandomizeCode = 9) else do (Do nothing)
        If (Playername Equal to l) then do (Set RandomizeCode = 3) else do (Do nothing)
        If (Playername Equal to m) then do (Set RandomizeCode = 6) else do (Do nothing)
        If (Playername Equal to n) then do (Set RandomizeCode = 11) else do (Do nothing)
        If (Playername Equal to o) then do (Set RandomizeCode = 2) else do (Do nothing)
        If (Playername Equal to p) then do (Set RandomizeCode = 14) else do (Do nothing)
        If (Playername Equal to q) then do (Set RandomizeCode = 13) else do (Do nothing)
        If (Playername Equal to r) then do (Set RandomizeCode = 11) else do (Do nothing)
        If (Playername Equal to s) then do (Set RandomizeCode = 6) else do (Do nothing)
        If (Playername Equal to t) then do (Set RandomizeCode = 5) else do (Do nothing)
        If (Playername Equal to u) then do (Set RandomizeCode = 1) else do (Do nothing)
        If (Playername Equal to v) then do (Set RandomizeCode = 8) else do (Do nothing)
        If (Playername Equal to w) then do (Set RandomizeCode = 17) else do (Do nothing)
        If (Playername Equal to x) then do (Set RandomizeCode = 15) else do (Do nothing)
        If (Playername Equal to y) then do (Set RandomizeCode = 9) else do (Do nothing)
        If (Playername Equal to z) then do (Set RandomizeCode = 16) else do (Do nothing)
        If (Playername Equal to A) then do (Set RandomizeCode = 14) else do (Do nothing)
        If (Playername Equal to B) then do (Set RandomizeCode = 13) else do (Do nothing)
        If (Playername Equal to C) then do (Set RandomizeCode = 10) else do (Do nothing)
        If (Playername Equal to D) then do (Set RandomizeCode = 4) else do (Do nothing)
        If (Playername Equal to E) then do (Set RandomizeCode = 12) else do (Do nothing)
        If (Playername Equal to F) then do (Set RandomizeCode = 2) else do (Do nothing)
        If (Playername Equal to G) then do (Set RandomizeCode = 3) else do (Do nothing)
        If (Playername Equal to H) then do (Set RandomizeCode = 7) else do (Do nothing)
        If (Playername Equal to I) then do (Set RandomizeCode = 8) else do (Do nothing)
        If (Playername Equal to J) then do (Set RandomizeCode = 7) else do (Do nothing)
        If (Playername Equal to K) then do (Set RandomizeCode = 13) else do (Do nothing)
        If (Playername Equal to L) then do (Set RandomizeCode = 12) else do (Do nothing)
        If (Playername Equal to M) then do (Set RandomizeCode = 10) else do (Do nothing)
        If (Playername Equal to N) then do (Set RandomizeCode = 16) else do (Do nothing)
        If (Playername Equal to O) then do (Set RandomizeCode = 17) else do (Do nothing)
        If (Playername Equal to P) then do (Set RandomizeCode = 11) else do (Do nothing)
        If (Playername Equal to Q) then do (Set RandomizeCode = 14) else do (Do nothing)
        If (Playername Equal to R) then do (Set RandomizeCode = 1) else do (Do nothing)
        If (Playername Equal to S) then do (Set RandomizeCode = 4) else do (Do nothing)
        If (Playername Equal to T) then do (Set RandomizeCode = 5) else do (Do nothing)
        If (Playername Equal to U) then do (Set RandomizeCode = 6) else do (Do nothing)
        If (Playername Equal to V) then do (Set RandomizeCode = 15) else do (Do nothing)
        If (Playername Equal to W) then do (Set RandomizeCode = 9) else do (Do nothing)
        If (Playername Equal to X) then do (Set RandomizeCode = 2) else do (Do nothing)
        If (Playername Equal to Y) then do (Set RandomizeCode = 3) else do (Do nothing)
        If (Playername Equal to Z) then do (Set RandomizeCode = 4) else do (Do nothing)

Information
Takes string Playername
Returns int RandomizeCode


All is in the Information : It takes the variable string Playername, and returns an integer variable RandomizeCode.


Code:
Base10 to Base32
    Events
    Conditions
    Actions
        For each (Integer A) from 0 to 2, do (Set Base32Int[(Integer A)] = 0)
        Set Base10Convert = Base10Input
        For each (Integer WhileLoop) from 1 to 31, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Base10Convert Greater than or equal to 1024
                    Then - Actions
                        Set Base10Convert = (Base10Convert - 1024)
                        Set Base32Int[2] = (Base32Int[2] + 1)
                    Else - Actions
                        For each (Integer WhileLoop) from 1 to 31, do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Base10Convert Greater than or equal to 32
                                    Then - Actions
                                        Set Base10Convert = (Base10Convert - 32)
                                        Set Base32Int[1] = (Base32Int[1] + 1)
                                    Else - Actions
                                        Set Base32Int[0] = Base10Convert
                                        Set WhileLoop = 31
                        Set WhileLoop = 31
        For each (Integer A) from 0 to 2, do (Actions)
            Loop - Actions
                If (Base32Int[(Integer A)] Equal to 23) then do (Set Base32String[(Integer A)] = 0) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 26) then do (Set Base32String[(Integer A)] = 1) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 17) then do (Set Base32String[(Integer A)] = 2) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 24) then do (Set Base32String[(Integer A)] = 3) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 6) then do (Set Base32String[(Integer A)] = 4) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 5) then do (Set Base32String[(Integer A)] = 5) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 11) then do (Set Base32String[(Integer A)] = 6) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 4) then do (Set Base32String[(Integer A)] = 7) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 10) then do (Set Base32String[(Integer A)] = 8) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 13) then do (Set Base32String[(Integer A)] = 9) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 0) then do (Set Base32String[(Integer A)] = a) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 9) then do (Set Base32String[(Integer A)] = b) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 18) then do (Set Base32String[(Integer A)] = c) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 31) then do (Set Base32String[(Integer A)] = d) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 1) then do (Set Base32String[(Integer A)] = e) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 21) then do (Set Base32String[(Integer A)] = f) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 30) then do (Set Base32String[(Integer A)] = g) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 27) then do (Set Base32String[(Integer A)] = h) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 25) then do (Set Base32String[(Integer A)] = i) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 3) then do (Set Base32String[(Integer A)] = k) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 8) then do (Set Base32String[(Integer A)] = m) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 2) then do (Set Base32String[(Integer A)] = n) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 14) then do (Set Base32String[(Integer A)] = p) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 22) then do (Set Base32String[(Integer A)] = r) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 16) then do (Set Base32String[(Integer A)] = s) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 7) then do (Set Base32String[(Integer A)] = t) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 12) then do (Set Base32String[(Integer A)] = u) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 15) then do (Set Base32String[(Integer A)] = v) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 28) then do (Set Base32String[(Integer A)] = w) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 20) then do (Set Base32String[(Integer A)] = x) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 29) then do (Set Base32String[(Integer A)] = y) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 19) then do (Set Base32String[(Integer A)] = z) else do (Do nothing)

Information
Pre:Base10Input contains value to be convert, value is in range 0 - 1048575
Post:Base32String[] contains converted value, with digit 1=[2], 2=[1], 3=[0]


All is again on the Information. Base10Input has values to convert in a range of 0-1048575, the Trigger convert it to Base32String[..] with converted values, with only 3 values : 1=2, 2=1, 3=0, in a range from 000-zzz


Code:
Base32 to Base10
    Events
    Conditions
    Actions
        Set Base32String[2] = (Substring(Base32Input, 1, 1))
        Set Base32String[1] = (Substring(Base32Input, 2, 2))
        Set Base32String[0] = (Substring(Base32Input, 3, 3))
        For each (Integer A) from 0 to 2, do (Actions)
            Loop - Actions
                If (Base32String[(Integer A)] Equal to 0) then do (Set Base32Int[(Integer A)] = 23) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 1) then do (Set Base32Int[(Integer A)] = 26) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 2) then do (Set Base32Int[(Integer A)] = 17) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 3) then do (Set Base32Int[(Integer A)] = 24) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 4) then do (Set Base32Int[(Integer A)] = 6) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 5) then do (Set Base32Int[(Integer A)] = 5) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 6) then do (Set Base32Int[(Integer A)] = 11) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 7) then do (Set Base32Int[(Integer A)] = 4) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 8) then do (Set Base32Int[(Integer A)] = 10) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 9) then do (Set Base32Int[(Integer A)] = 13) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to a) then do (Set Base32Int[(Integer A)] = 0) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to b) then do (Set Base32Int[(Integer A)] = 9) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to c) then do (Set Base32Int[(Integer A)] = 18) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to d) then do (Set Base32Int[(Integer A)] = 31) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to e) then do (Set Base32Int[(Integer A)] = 1) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to f) then do (Set Base32Int[(Integer A)] = 21) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to g) then do (Set Base32Int[(Integer A)] = 30) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to h) then do (Set Base32Int[(Integer A)] = 27) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to i) then do (Set Base32Int[(Integer A)] = 25) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to k) then do (Set Base32Int[(Integer A)] = 3) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to m) then do (Set Base32Int[(Integer A)] = 8) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to n) then do (Set Base32Int[(Integer A)] = 2) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to p) then do (Set Base32Int[(Integer A)] = 14) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to r) then do (Set Base32Int[(Integer A)] = 22) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to s) then do (Set Base32Int[(Integer A)] = 16) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to t) then do (Set Base32Int[(Integer A)] = 7) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to u) then do (Set Base32Int[(Integer A)] = 12) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to v) then do (Set Base32Int[(Integer A)] = 15) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to w) then do (Set Base32Int[(Integer A)] = 28) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to x) then do (Set Base32Int[(Integer A)] = 20) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to y) then do (Set Base32Int[(Integer A)] = 29) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to z) then do (Set Base32Int[(Integer A)] = 19) else do (Do nothing)
        Set Base10Output = (((Base32Int[2] x 1024) + (Base32Int[1] x 32)) + Base32Int[0])

Information
Pre:Base32Input contains string to be convert in range 000-zzz
Post:Base10Output contains Int value
23, 26, 17, 24, 6, 5, 11, 4, 10, 13, 0, 9, 18, 31, 1, 21, 30, 27, 25, 3, 8, 2, 14, 22, 16, 7, 12, 15, 28, 20, 29, 19


All and again all is in the Information. Base32Input contains what to convert, from a range to 000-zzz. The Trigger transforms it from Base32Input to Base10Output which contains a Integer value, from 0 to 31.


Code:
Save Char
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
        Player - Player 5 (Yellow) types a chat message containing -save as An exact match
        Player - Player 6 (Orange) types a chat message containing -save as An exact match
        Player - Player 7 (Green) types a chat message containing -save as An exact match
        Player - Player 8 (Pink) types a chat message containing -save as An exact match
        Player - Player 9 (Gray) types a chat message containing -save as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
    Conditions
        (Substring((Entered chat string), 1, 5)) Equal to -save
    Actions
        Trigger - Turn off (This trigger)
        Set Part1 = NONE
        Set LevelCode = (Hero level of Hero[(Player number of (Triggering player))])
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        HeroType[(Integer A)] Equal to (Unit-type of Hero[(Player number of (Triggering player))])
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Integer A) Less than 10
                            Then - Actions
                                Set Part1 = (0 + (String((Integer A))))
                            Else - Actions
                                Set Part1 = (String((Integer A)))
                    Else - Actions
        If (Part1 Not equal to NONE) then do (Set SavingHero = Hero[(Player number of (Triggering player))]) else do (Do nothing)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Part1 Equal to NONE
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR:No Hero Found...
                Trigger - Turn on (This trigger)
                Skip remaining actions
            Else - Actions
        Set Playername = (Name of (Triggering player))
        Trigger - Run Randomize <gen> (ignoring conditions)
        Set Base10Input = ((Integer(Part1)) x RandomizeCode)
        Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
        Set SaveCode[0] = (Base32String[1] + Base32String[0])
        Set Base10Input = ((LevelCode x RandomizeCode) x (((Integer(Part1)) mod 9) + 1))
        Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
        Set SaveCode[1] = ((Base32String[2] + Base32String[1]) + Base32String[0])
        For each (Integer A) from 0 to 5, do (Set CarriedItems[(Integer A)] = 500)
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                For each (Integer A) from 100 to 499, do (Actions)
                    Loop - Actions
                        If ((Item-type of (Item carried by SavingHero in slot ((Integer B) + 1))) Equal to InitializeItems[(Integer A)]) then do (Set CarriedItems[(Integer B)] = (Integer A)) else do (Do nothing)
        For each (Integer WhileLoop) from 0 to 4, do (Actions)
            Loop - Actions
                For each (Integer B) from (WhileLoop + 1) to 5, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                CarriedItems[WhileLoop] Greater than CarriedItems[(Integer B)]
                            Then - Actions
                                Set SortTempInt = CarriedItems[WhileLoop]
                                Set CarriedItems[WhileLoop] = CarriedItems[(Integer B)]
                                Set CarriedItems[(Integer B)] = SortTempInt
                            Else - Actions
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                Set Base10Input = (((Integer(Part1)) + (Integer B)) + ((CarriedItems[(Integer B)] - 100) x ((RandomizeCode mod 2) + 1)))
                Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
                Set SaveCode[((Integer B) + 2)] = (Base32String[1] + Base32String[0])
        Set FinalCode = (((SaveCode[0] + SaveCode[1]) + (SaveCode[2] + SaveCode[3])) + ((SaveCode[4] + SaveCode[5]) + (SaveCode[6] + SaveCode[7])))
        Game - Display to (Player group((Triggering player))) for 200.00 seconds the text: (((Character:  + (Proper name of Hero[(Player number of (Triggering player))])) +  - ) + (Loading Code:  + FinalCode))
        Trigger - Turn on (This trigger)

This is the code to Save your hero. I will explain later what it exactly does.


Code:
Load Char
    Events
        Player - Player 1 (Red) types a chat message containing -load as A substring
        Player - Player 2 (Blue) types a chat message containing -load as A substring
        Player - Player 3 (Teal) types a chat message containing -load as A substring
        Player - Player 4 (Purple) types a chat message containing -load as A substring
        Player - Player 5 (Yellow) types a chat message containing -load as A substring
        Player - Player 6 (Orange) types a chat message containing -load as A substring
        Player - Player 7 (Green) types a chat message containing -load as A substring
        Player - Player 8 (Pink) types a chat message containing -load as A substring
        Player - Player 9 (Gray) types a chat message containing -load as A substring
        Player - Player 10 (Light Blue) types a chat message containing -load as A substring
        Player - Player 11 (Dark Green) types a chat message containing -load as A substring
    Conditions
        (Substring((Entered chat string), 1, 5)) Equal to -load
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Length of (Entered chat string)) Not equal to 23
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR: Code Length ...
                Skip remaining actions
            Else - Actions
        Trigger - Turn off (This trigger)
        Set Playername = (Name of (Triggering player))
        Set LoadString = (abcde + (Entered chat string))
        Trigger - Run Randomize <gen> (ignoring conditions)
        Set Base32Input = (a + (Substring(LoadString, 12, 13)))
        Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
        Set UnitNumber = (Base10Output / RandomizeCode)
        Set Base32Input = (Substring(LoadString, 14, 16))
        Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
        Set LoadLevel = (Base10Output / (RandomizeCode x ((UnitNumber mod 9) + 1)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        UnitNumber Greater than MaxSavableHeroes
                        UnitNumber Less than 1
                        LoadLevel Greater than MaxLevel
                        LoadLevel Less than 0
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR: Error Loadin...
                Trigger - Turn on (This trigger)
                Skip remaining actions
            Else - Actions
                Do nothing
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        UnitNumber Equal to (Integer A)
                    Then - Actions
                        Unit - Create 1 HeroType[(Integer A)] for (Triggering player) at (Point(0.00, 0.00)) facing 0.00 degrees
                        Set Hero[(Player number of (Triggering player))] = (Last created unit)
                    Else - Actions
        Hero - Set (Last created unit) Hero-level to LoadLevel, Show level-up graphics
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Hero - Drop the item from slot (Integer A) of (Last created unit)
                Item - Remove (Last dropped item)
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                Set Base32Input = (a + (Substring(LoadString, (17 + ((Integer B) x 2)), (18 + ((Integer B) x 2)))))
                Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
                Set ItemNumber = ((Base10Output - (UnitNumber + (Integer B))) / ((RandomizeCode mod 2) + 1))
                Set ItemNumber = (ItemNumber + 100)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (ItemNumber Less than 100) or (ItemNumber Greater than 499)
                                InitializeItems[ItemNumber] Equal to Unknown Item
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ItemNumber Equal to 500
                            Then - Actions
                                Do nothing
                            Else - Actions
                                Game - Display to (Player group((Triggering player))) the text: ((|c00ff0000ERROR:Code Error Bit |r + (String(((Integer B) + 3)))) +  Continuing Load...)
                    Else - Actions
                        Hero - Create InitializeItems[ItemNumber] and give it to (Last created unit)
        Trigger - Turn on (This trigger)

This is the code to load your hero. I will again explain how it works later.


Code:
Initialize Items
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        For each (Integer A) from 100 to 499, do (Set InitializeItems[(Integer A)] = Unknown Item)
        Set InitializeItems[100] = Healing Scepter
        Set InitializeItems[101] = Ring of Protection
        Set InitializeItems[102] = Claws of Attack
        Set InitializeItems[103] = Heavy Axe
        Set InitializeItems[104] = Sacred Relic
        Set InitializeItems[105] = Spellbook
        Set InitializeItems[106] = Drek'thar Book
        Set InitializeItems[107] = Flag
        Set InitializeItems[108] = Flame Cloak
        Set InitializeItems[109] = War Drums
        Set InitializeItems[110] = Shadow Cloak
        Set MaxSavableHeroes = 3
        Set MaxLevel = 999
        Set HeroType[1] = Paladin Test
        Set HeroType[2] = Arch Mage Test
        Set HeroType[3] = Mountain King Test

Information
Define items and heroes type there.
Up to 399 items from 100 to 499. Below or after makes some bads things.


You have to define what there are to save. I will explain later what to modify here.


1.2 How Save works?

We will learn how the Save Trigger works.

Code:
Save Char
    Events
        Player - Player 1 (Red) types a chat message containing -save as An exact match
        Player - Player 2 (Blue) types a chat message containing -save as An exact match
        Player - Player 3 (Teal) types a chat message containing -save as An exact match
        Player - Player 4 (Purple) types a chat message containing -save as An exact match
        Player - Player 5 (Yellow) types a chat message containing -save as An exact match
        Player - Player 6 (Orange) types a chat message containing -save as An exact match
        Player - Player 7 (Green) types a chat message containing -save as An exact match
        Player - Player 8 (Pink) types a chat message containing -save as An exact match
        Player - Player 9 (Gray) types a chat message containing -save as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
        Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
    Conditions
        (Substring((Entered chat string), 1, 5)) Equal to -save

This first part detect when a player write exactly -save. The Condition is really useless because -save is -save.


Code:
        Trigger - Turn off (This trigger)
        Set Part1 = NONE
        Set LevelCode = (Hero level of Hero[(Player number of (Triggering player))])
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        HeroType[(Integer A)] Equal to (Unit-type of Hero[(Player number of (Triggering player))])
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Integer A) Less than 10
                            Then - Actions
                                Set Part1 = (0 + (String((Integer A))))
                            Else - Actions
                                Set Part1 = (String((Integer A)))
                    Else - Actions
        If (Part1 Not equal to NONE) then do (Set SavingHero = Hero[(Player number of (Triggering player))]) else do (Do nothing)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Part1 Equal to NONE
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR:No Hero Found...
                Trigger - Turn on (This trigger)
                Skip remaining actions
            Else - Actions

We will work a little in that part.


Code:
        Set Part1 = NONE
        Set LevelCode = (Hero level of Hero[(Player number of (Triggering player))])
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        HeroType[(Integer A)] Equal to (Unit-type of Hero[(Player number of (Triggering player))])
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Integer A) Less than 10
                            Then - Actions
                                Set Part1 = (0 + (String((Integer A))))
                            Else - Actions
                                Set Part1 = (String((Integer A)))
                    Else - Actions

This request take the Hero, and if the HeroType[Integer A] is equal to the Unit type of the Hero that should be saved (Hero[Player number of (Triggering Player)]), it sets the Part1 to a number from a range to 1-99. Number of Savable Heroes is defined in Initialize Items.


Code:
        If (Part1 Not equal to NONE) then do (Set SavingHero = Hero[(Player number of (Triggering player))]) else do (Do nothing)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Part1 Equal to NONE
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR:No Hero Found...
                Trigger - Turn on (This trigger)
                Skip remaining actions
            Else - Actions

If Part1 returns the base value (NONE), it fixes the Hero to SavingHero. But will ever fail. It is equal you have No Hero here. Then the trigger looks if Part1 equal to NONE, and if yes, it gives an error message and Skip all next actions.


Code:
        Set Playername = (Name of (Triggering player))
        Trigger - Run Randomize <gen> (ignoring conditions)
        Set Base10Input = ((Integer(Part1)) x RandomizeCode)
        Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
        Set SaveCode[0] = (Base32String[1] + Base32String[0])
        Set Base10Input = ((LevelCode x RandomizeCode) x (((Integer(Part1)) mod 9) + 1))
        Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
        Set SaveCode[1] = ((Base32String[2] + Base32String[1]) + Base32String[0])

This is the Player Name protection. It defines the Playername variable to the Triggering Player, detect its 1st letter, fixes a value of Base10Input to Part1 x RandomizeCode, converts it to Base32, fixes a value to SaveCode[0], fixes a new protection to Base10Input equal to the (LevelCode x RandomizeCode) x ((Part1 mod 9) + 1), convert it to Base32, then fixes a value to SaveCode[1].
This heavy protection adds 6 digits to the save code.


Code:
        For each (Integer A) from 0 to 5, do (Set CarriedItems[(Integer A)] = 500)
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                For each (Integer A) from 100 to 499, do (Actions)
                    Loop - Actions
                        If ((Item-type of (Item carried by SavingHero in slot ((Integer B) + 1))) Equal to InitializeItems[(Integer A)]) then do (Set CarriedItems[(Integer B)] = (Integer A)) else do (Do nothing)
        For each (Integer WhileLoop) from 0 to 4, do (Actions)
            Loop - Actions
                For each (Integer B) from (WhileLoop + 1) to 5, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                CarriedItems[WhileLoop] Greater than CarriedItems[(Integer B)]
                            Then - Actions
                                Set SortTempInt = CarriedItems[WhileLoop]
                                Set CarriedItems[WhileLoop] = CarriedItems[(Integer B)]
                                Set CarriedItems[(Integer B)] = SortTempInt
                            Else - Actions

This defines a value to the integer CarriedItems variable to 500, in a array range from 0 to 5. Then it detects in a loop what item the Hero has, and if the Item is equal to InitializeItems[Integer A], it changes the value of CarriedItems[Looked Slot Item - 1]. I will explain what there is after, it is extremly hard to understand if you look only like that.

Code:
[B]        For each (Integer WhileLoop) from 0 to 4, do (Actions)
            Loop - Actions
                For each (Integer B) from (WhileLoop + 1) to 5, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                CarriedItems[WhileLoop] Greater than CarriedItems[(Integer B)]
                            Then - Actions
                                Set SortTempInt = CarriedItems[WhileLoop]
                                Set CarriedItems[WhileLoop] = CarriedItems[(Integer B)]
                                Set CarriedItems[(Integer B)] = SortTempInt
                            Else - Actions[/B]

Lets get a Look. Lets say we have CarriedItems[0] = 135, [1] = 120, [2] = 116, [3] = 147, [4] = 169, and [5] = 138.
We start a Loop. Integer WhileLoop = 0. Then we have a Second Loop. Integer B = WhileLoop + 1 = 1. It checks if CarriedItems[0] is greater than CarriedItems[1]. If it is true, it sets SortTempInt to CarriedItems[0], sets CarriedItems[0] = CarriedItems[1], and CarriedItems[1] = SortTempInt. Else it does nothing.

So we have:
SortTempInt = CarriedItems[0] = 135
CarriedItems[0] = CarriedItems[1] = 120
CarriedItems[1] = SortTempInt = 135

Lets say we loop until end. We will calculate anything.

Condition = True
SortTempInt = CarriedItems[0] = 135
CarriedItems[0] = CarriedItems[1] = 120
CarriedItems[1] = SortTempInt = 135
Condition = True
SortTempInt = CarriedItems[1] = 120
CarriedItems[1] = CarriedItems[2] = 116
CarriedItems[2] = SortTempInt = 120
Condition = False
Nothing is Done
CarriedItems[3] = 147
Condition = True
SortTempInt = CarriedItems[3] = 147
CarriedItems[3] = CarriedItems[4] = 169
CarriedItems[4] = SortTempInt = 147
Condition = False
Nothing is Done
CarriedItems[5] = 138

So we have :
[0] = 135
[1] = 116
[2] = 120
[3] = 147
[4] = 169
[5] = 138

Understand it?


Code:
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                Set Base10Input = (((Integer(Part1)) + (Integer B)) + ((CarriedItems[(Integer B)] - 100) x ((RandomizeCode mod 2) + 1)))
                Trigger - Run Base10 to Base32 <gen> (ignoring conditions)
                Set SaveCode[((Integer B) + 2)] = (Base32String[1] + Base32String[0])
        Set FinalCode = (((SaveCode[0] + SaveCode[1]) + (SaveCode[2] + SaveCode[3])) + ((SaveCode[4] + SaveCode[5]) + (SaveCode[6] + SaveCode[7])))
        Game - Display to (Player group((Triggering player))) for 200.00 seconds the text: (((Character:  + (Proper name of Hero[(Player number of (Triggering player))])) +  - ) + (Loading Code:  + FinalCode))
        Trigger - Turn on (This trigger)

This is the last part of the Save.
We have a Loop from 0 to 5. Base10Input's value is defined to (Part1) + (Integer B) + ((CarriedItems[Integer B] - 100) x (RandomizeCode modulo 2) + 1)), then it converts it to Base32, and after defines a value to SaveCode[Integer B + 2]. Each item takes 2 digits. All SaveCode[0 to 7] are set to the FinalCode in the normal order (Not Little Indian Order, which is the inverse)
At end, it displays to the player the message. And voila! Its the Save Trigger finished.
 

Chocobo

White-Flower
Reaction score
409
1.3 How Load works?

Code:
Load Char
    Events
        Player - Player 1 (Red) types a chat message containing -load as A substring
        Player - Player 2 (Blue) types a chat message containing -load as A substring
        Player - Player 3 (Teal) types a chat message containing -load as A substring
        Player - Player 4 (Purple) types a chat message containing -load as A substring
        Player - Player 5 (Yellow) types a chat message containing -load as A substring
        Player - Player 6 (Orange) types a chat message containing -load as A substring
        Player - Player 7 (Green) types a chat message containing -load as A substring
        Player - Player 8 (Pink) types a chat message containing -load as A substring
        Player - Player 9 (Gray) types a chat message containing -load as A substring
        Player - Player 10 (Light Blue) types a chat message containing -load as A substring
        Player - Player 11 (Dark Green) types a chat message containing -load as A substring
    Conditions
        (Substring((Entered chat string), 1, 5)) Equal to -load

This detects when a player write -load, and if -load is the 5 first letters.


Code:
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Length of (Entered chat string)) Not equal to 23
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR: Code Length ...
                Skip remaining actions
            Else - Actions

This is supposed to detect the length of the entered chat. The code is 17 digits, with the space between -load and the code, and the -load, it results 17 digits. -load xxxxxxxxxxxxxxxxx


Code:
        Trigger - Turn off (This trigger)
        Set Playername = (Name of (Triggering player))
        Set LoadString = (abcde + (Entered chat string))
        Trigger - Run Randomize <gen> (ignoring conditions)
        Set Base32Input = (a + (Substring(LoadString, 12, 13)))
        Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
        Set UnitNumber = (Base10Output / RandomizeCode)
        Set Base32Input = (Substring(LoadString, 14, 16))
        Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
        Set LoadLevel = (Base10Output / (RandomizeCode x ((UnitNumber mod 9) + 1)))

This is a little tricky. First, it checks for the Player Name, it saves the string in a Variable called LoadString with abcde before the code, and it runs the trigger Randomize, which returns an integer depending on the player's name. Then it sets Base32Input string Variable to a + 12'st + 13'st digit of LoadString (-load abcdexxxxxxxxxxxxxxxxx), and convert it to Base10. It returns the Variable Base10Output, and then UnitNumber is set to (Base10Output / RandomizeCode). Base32Input is set to the 14st, 15st, and 16st digit of the LoadString ((-load abcdexxxxxxxxxxxxxxxxx), and convert it to Base10. The level of the hero is after calculated, resulting of the Algorithm (Base10Output / RandomizeCode x ((UnitNumber modulo 9) + 1))).


Code:
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        UnitNumber Greater than MaxSavableHeroes
                        UnitNumber Less than 1
                        LoadLevel Greater than MaxLevel
                        LoadLevel Less than 0
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: ERROR: Error Loadin...
                Trigger - Turn on (This trigger)
                Skip remaining actions
            Else - Actions
                Do nothing

This detects if the UnitNumber is a classified hero, it must be between the 1 and the Value of the Integer MaxSavableHeroes. In the demo map, it is 4, so if UnitNumber is greater than 4, or lesser than 1, it interrupts the loading. And so does for Level, if it is greater than MaxLevel, or less than 0, it stops the loading.


Code:
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        UnitNumber Equal to (Integer A)
                    Then - Actions
                        Unit - Create 1 HeroType[(Integer A)] for (Triggering player) at (Point(0.00, 0.00)) facing 0.00 degrees
                        Set Hero[(Player number of (Triggering player))] = (Last created unit)
                    Else - Actions
        Hero - Set (Last created unit) Hero-level to LoadLevel, Show level-up graphics

This part creates a Hero for the player. It checks if UnitNumber is equal to the Integer A while the loop from 1 to MaxSavableHeroes, then it creates the Hero if the Condition is true. After the loop, it sets the Level of the hero to LoadLevel.


Code:
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Hero - Drop the item from slot (Integer A) of (Last created unit)
                Item - Remove (Last dropped item)

Some bugs may appears during the loading because other triggers that adds items if a hero spawns, this part has been added to remove all items carried by the Hero.


Code:
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                Set Base32Input = (a + (Substring(LoadString, (17 + ((Integer B) x 2)), (18 + ((Integer B) x 2)))))
                Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
                Set ItemNumber = ((Base10Output - (UnitNumber + (Integer B))) / ((RandomizeCode mod 2) + 1))
                Set ItemNumber = (ItemNumber + 100)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (ItemNumber Less than 100) or (ItemNumber Greater than 499)
                                InitializeItems[ItemNumber] Equal to Unknown Item
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ItemNumber Equal to 500
                            Then - Actions
                                Do nothing
                            Else - Actions
                                Game - Display to (Player group((Triggering player))) the text: ((|c00ff0000ERROR:Code Error Bit |r + (String(((Integer B) + 3)))) +  Continuing Load...)
                    Else - Actions
                        Hero - Create InitializeItems[ItemNumber] and give it to (Last created unit)
        Trigger - Turn on (This trigger)

Lastest part of the load code. If the code for items is wrong, it doesn't interrupt the loading. We will analyze this more clearly.


Code:
        For each (Integer B) from 0 to 5, do (Actions)
            Loop - Actions
                Set Base32Input = (a + (Substring(LoadString, (17 + ((Integer B) x 2)), (18 + ((Integer B) x 2)))))
                Trigger - Run Base32 to Base10 <gen> (ignoring conditions)
                Set ItemNumber = ((Base10Output - (UnitNumber + (Integer B))) / ((RandomizeCode mod 2) + 1))
                Set ItemNumber = (ItemNumber + 100)

Here we have a Loop from 0 to 5. The Variable Base32Input is set to 2 digits. (a + (LoadString (17 + (Integer B x 2))'st digit to (18 + (Integer B x 2))'st digit).
Here what it results digits with the loop : 17-18, 19-20, 21-22, 23-24, 25-26, 26-27
-load abcdexxxxxxxxxxxxxxxxx
After, it converts it into Base10, returning Base10Output. ItemNumber is set to ((Base10Output - (UnitNumber + (Integer B))) / (RandomizeCode modulo 2) + 1)), and then add it 100.


Code:
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (ItemNumber Less than 100) or (ItemNumber Greater than 499)
                                InitializeItems[ItemNumber] Equal to Unknown Item
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ItemNumber Equal to 500
                            Then - Actions
                                Do nothing
                            Else - Actions
                                Game - Display to (Player group((Triggering player))) the text: ((|c00ff0000ERROR:Code Error Bit |r + (String(((Integer B) + 3)))) +  Continuing Load...)
                    Else - Actions
                        Hero - Create InitializeItems[ItemNumber] and give it to (Last created unit)
        Trigger - Turn on (This trigger)

This last part of the trigger is inside the Integer B loop. It checks if ItemNumber is less than 100, or greater than 499, or equal to Unknown Item (Returns a weird number unused).
If the Condition is true, it checks if the ItemNumber is equal to 500, and if not, it does nothing, else it gives to the player a Error Message that gives an error at the bit (Integer B + 3), and continue load without this slot.
If the Condition is false, it directly creates a item to the hero, the item type is InitializeItems[ItemNumber].
The Load trigger is finished.


1.4 What to modify?

There is a lot of things to modify, I will post here all to modify.

Code:
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (ItemNumber Less than 100) or (ItemNumber Greater than 499)
                                InitializeItems[ItemNumber] Equal to [B][U]Unknown Item[/U][/B]
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ItemNumber Equal to 500
                            Then - Actions
                                Do nothing
                            Else - Actions
                                Game - Display to (Player group((Triggering player))) the text: ((|c00ff0000ERROR:Code Error Bit |r + (String(((Integer B) + 3)))) +  Continuing Load...)
                    Else - Actions
                        Hero - Create InitializeItems[ItemNumber] and give it to (Last created unit)
        Trigger - Turn on (This trigger)

You have seen it in the last CODE. It is at the end of the Load Trigger. You must create a dummy item called Unknown Item with the Unknown Icon, and costing 0 gold. It must be this, else it can be sold.


Code:
        For each (Integer A) from 1 to MaxSavableHeroes, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        UnitNumber Equal to (Integer A)
                    Then - Actions
                        [B][U]Unit - Create 1 HeroType[(Integer A)] for (Triggering player) at (Point(0.00, 0.00)) facing 0.00 degrees[/U][/B]
                        Set Hero[(Player number of (Triggering player))] = (Last created unit)
                    Else - Actions
        Hero - Set (Last created unit) Hero-level to LoadLevel, Show level-up graphics

It is again on the Load Trigger. You must modify the Location where the Hero will spawn. (The at (Point(0.00, 0.00)))


Code:
Initialize Items
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
[B][U]        For each (Integer A) from 100 to 499, do (Set InitializeItems[(Integer A)] = Unknown Item)
        Set InitializeItems[100] = Healing Scepter
        Set InitializeItems[101] = Ring of Protection
        Set InitializeItems[102] = Claws of Attack
        Set InitializeItems[103] = Heavy Axe
        Set InitializeItems[104] = Sacred Relic
        Set InitializeItems[105] = Spellbook
        Set InitializeItems[106] = Drek'thar Book
        Set InitializeItems[107] = Flag
        Set InitializeItems[108] = Flame Cloak
        Set InitializeItems[109] = War Drums
        Set InitializeItems[110] = Shadow Cloak
        Set MaxSavableHeroes = 3
        Set MaxLevel = 999
        Set HeroType[1] = Paladin Test
        Set HeroType[2] = Arch Mage Test
        Set HeroType[3] = Mountain King Test[/U][/B]

Again, Unknown Item must be modified to its equivalent. Also, it is here where you must define values of InitializeItems, MaxSavableHeroes, MaxLevel, and HeroType.
InitializeItems handles Item types, that can be saved.
MaxSavableHeroes handles the Maximal number of "hero types" that can be saved. Not the Amount of number of saved heroes. It can not be greater than 99.
MaxLevel handles the maximal level possible. It can not be greater than 999.
HeroType handles Hero types, that can be saved.


All the rest is automatized, you have only to modify these part to get the save load feature to work perfectly.


1.5 How works Base10 to Base32 and what is it?

Base10 to Base32 (And vice-versa) is an encryption from "Base10", to "Base32". I can't really explain what is it, but I can show you how it really works.

Code:
Base10 to Base32
    Events
    Conditions
    Actions
        For each (Integer A) from 0 to 2, do (Set Base32Int[(Integer A)] = 0)
        Set Base10Convert = Base10Input
        For each (Integer WhileLoop) from 1 to 31, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Base10Convert Greater than or equal to 1024
                    Then - Actions
                        Set Base10Convert = (Base10Convert - 1024)
                        Set Base32Int[2] = (Base32Int[2] + 1)
                    Else - Actions
                        For each (Integer WhileLoop) from 1 to 31, do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Base10Convert Greater than or equal to 32
                                    Then - Actions
                                        Set Base10Convert = (Base10Convert - 32)
                                        Set Base32Int[1] = (Base32Int[1] + 1)
                                    Else - Actions
                                        Set Base32Int[0] = Base10Convert
                                        Set WhileLoop = 31
                        Set WhileLoop = 31
        For each (Integer A) from 0 to 2, do (Actions)
            Loop - Actions
                If (Base32Int[(Integer A)] Equal to 23) then do (Set Base32String[(Integer A)] = 0) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 26) then do (Set Base32String[(Integer A)] = 1) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 17) then do (Set Base32String[(Integer A)] = 2) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 24) then do (Set Base32String[(Integer A)] = 3) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 6) then do (Set Base32String[(Integer A)] = 4) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 5) then do (Set Base32String[(Integer A)] = 5) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 11) then do (Set Base32String[(Integer A)] = 6) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 4) then do (Set Base32String[(Integer A)] = 7) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 10) then do (Set Base32String[(Integer A)] = 8) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 13) then do (Set Base32String[(Integer A)] = 9) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 0) then do (Set Base32String[(Integer A)] = a) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 9) then do (Set Base32String[(Integer A)] = b) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 18) then do (Set Base32String[(Integer A)] = c) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 31) then do (Set Base32String[(Integer A)] = d) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 1) then do (Set Base32String[(Integer A)] = e) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 21) then do (Set Base32String[(Integer A)] = f) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 30) then do (Set Base32String[(Integer A)] = g) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 27) then do (Set Base32String[(Integer A)] = h) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 25) then do (Set Base32String[(Integer A)] = i) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 3) then do (Set Base32String[(Integer A)] = k) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 8) then do (Set Base32String[(Integer A)] = m) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 2) then do (Set Base32String[(Integer A)] = n) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 14) then do (Set Base32String[(Integer A)] = p) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 22) then do (Set Base32String[(Integer A)] = r) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 16) then do (Set Base32String[(Integer A)] = s) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 7) then do (Set Base32String[(Integer A)] = t) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 12) then do (Set Base32String[(Integer A)] = u) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 15) then do (Set Base32String[(Integer A)] = v) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 28) then do (Set Base32String[(Integer A)] = w) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 20) then do (Set Base32String[(Integer A)] = x) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 29) then do (Set Base32String[(Integer A)] = y) else do (Do nothing)
                If (Base32Int[(Integer A)] Equal to 19) then do (Set Base32String[(Integer A)] = z) else do (Do nothing)

Lets say Base10Input is 1200 (It can up to 31743). The trigger sets Base10Convert to Base10Input. The Condition during the 1 to 31 loop is true one time, Base10Convert = 1200-1024 = 176. During loop, if the condition is true, it adds to Base32Int[2] 1. Here, Base32Int[2] = 1.
Then it does again a loop between 1 to 31. It checks if Base10Convert is greater than 32, and if yes, it removes 32 from the Variable until it the condition returns false. For that, we have 5 loops, Base10Convert = 176 - 32*5 = 176 - 160 = 16. While looping, Base32Int[1] is set to its value + 1, like Base32Int[2]. Here, Base32Int[1] = 5. If the condition returned false, Base32Int[0] is set to the value of Base10Convert, which is lesser than to 32. Here, Base32Int[0] = 16.
After that, it does a loop from 0 to 2. It checks if the Integer in Base32Int[Integer A] is equal to <a fixed value between 0 to 31>, and if the condition is true, it sets Base32String[Integer A] to <a fixed value between 0 to z>.
Here, we had [0] = 16, [1] = 5, and [2] = 1.
16 = s = Base32String[0]
5 = 5 = Base32String[1]
1 = e = Base32String[2]
And voilà! It is finished!


But, how to convert it back?! Here is the trigger!

Code:
Base32 to Base10
    Events
    Conditions
    Actions
        Set Base32String[2] = (Substring(Base32Input, 1, 1))
        Set Base32String[1] = (Substring(Base32Input, 2, 2))
        Set Base32String[0] = (Substring(Base32Input, 3, 3))
        For each (Integer A) from 0 to 2, do (Actions)
            Loop - Actions
                If (Base32String[(Integer A)] Equal to 0) then do (Set Base32Int[(Integer A)] = 23) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 1) then do (Set Base32Int[(Integer A)] = 26) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 2) then do (Set Base32Int[(Integer A)] = 17) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 3) then do (Set Base32Int[(Integer A)] = 24) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 4) then do (Set Base32Int[(Integer A)] = 6) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 5) then do (Set Base32Int[(Integer A)] = 5) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 6) then do (Set Base32Int[(Integer A)] = 11) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 7) then do (Set Base32Int[(Integer A)] = 4) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 8) then do (Set Base32Int[(Integer A)] = 10) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to 9) then do (Set Base32Int[(Integer A)] = 13) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to a) then do (Set Base32Int[(Integer A)] = 0) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to b) then do (Set Base32Int[(Integer A)] = 9) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to c) then do (Set Base32Int[(Integer A)] = 18) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to d) then do (Set Base32Int[(Integer A)] = 31) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to e) then do (Set Base32Int[(Integer A)] = 1) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to f) then do (Set Base32Int[(Integer A)] = 21) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to g) then do (Set Base32Int[(Integer A)] = 30) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to h) then do (Set Base32Int[(Integer A)] = 27) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to i) then do (Set Base32Int[(Integer A)] = 25) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to k) then do (Set Base32Int[(Integer A)] = 3) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to m) then do (Set Base32Int[(Integer A)] = 8) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to n) then do (Set Base32Int[(Integer A)] = 2) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to p) then do (Set Base32Int[(Integer A)] = 14) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to r) then do (Set Base32Int[(Integer A)] = 22) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to s) then do (Set Base32Int[(Integer A)] = 16) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to t) then do (Set Base32Int[(Integer A)] = 7) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to u) then do (Set Base32Int[(Integer A)] = 12) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to v) then do (Set Base32Int[(Integer A)] = 15) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to w) then do (Set Base32Int[(Integer A)] = 28) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to x) then do (Set Base32Int[(Integer A)] = 20) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to y) then do (Set Base32Int[(Integer A)] = 29) else do (Do nothing)
                If (Base32String[(Integer A)] Equal to z) then do (Set Base32Int[(Integer A)] = 19) else do (Do nothing)
        Set Base10Output = (((Base32Int[2] x 1024) + (Base32Int[1] x 32)) + Base32Int[0])

The trigger that fires this had defined Base32Input value. Lets say we use the old value : s5e. In the save trigger, it is inversed, so s5e = e5s.
Base32String[2] = s
Base32String[1] = 5
Base32String[0] = e
After defining values, it starts a loop from 0 to 2, and does a lot of conditions, if Base32String[Integer A] is equal to <a value between 0 to z>, and if yes, it returns a Integer assigned to Base32Int.
s = 16 = Base32Int[2]
5 = 5 = Base32Int[1]
e = 1 = Base32Int[0]
Then, it sets Base10Output to (((Base32Int[2] x 1024) + (Base32Int[1] x 32)) + (Base32Int[0])))
Here it does : 1 x 1024 + 5 x 32 + 16 = 1024 + 160 + 16 = 1200
Finished! It returned the old value!
 
X

x_Phoenix_x

Guest
variables

i have downloaded Effrane's save/load thing you have linked... i opened it up in warcraft editor.. and it said that it wouldn't work because i don't have certain triggers and IU in the database.. or something like that... i have no idea how to get those
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top