Chocobo
White-Flower
- Reaction score
- 409
This is the guide which will be frequently updated because the lot of questions given in the thread 29952 (http://www.thehelper.net/forums/showthread.php?t=29952&page=6&pp=15).
It will be on 9 parts, the 3 first for 0.18f and 0.19a Versions, and the 3 nexts for 0.19h Version (Coming), and the 3 lasts for 0.20c Version (Coming). I also "publicize" Effane's tutorial, so less threads will be created because the most of threads that wants Save Load Codes. The Guide will be splited into 3 parts (Which contains 3 Consecutive Posts) mentionned at the top of the post.
To all who wants to ask a question about the Save Load Code map, post it here.
*Little Indian Order, mentionned at the end of this post, mean the Inverse Order. Example : 1 2 3 4 = 4 3 2 1
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
The Little Hard Mode
1. High Protection Code (0.18f/0.19a) (Post 1)
1.1 Source Code (Post 1)
1.2 How Save works? (Post 1)
1.3 How Load works? (Post 2)
1.4 What to modify? (Post 2)
1.5 How works Base10 to Base32 and what is it? (Post 2)
1.6 Dummy Functions inside the map. How it works? (Post 3)
1.7 Variable List Used (Post 3)
1.8 Frequently Asked Questions (Post 3)
The Easiest Mode
2. Unprotected Code (0.19h) (LATER, Post 4)
2.1 Source Code (LATER, Post 4)
2.2 Save Code Work (LATER, Post 4)
2.3 Load Code Work (LATER, Post 5)
2.4 What to modify there? (LATER, Post 5)
2.5 Frequently Asked Questions (LATER, Post 6)
The Hardest Mode Possible (LATER, Post 7, REALLY LATER)
3 Unproteted Code (LATER, Post 7, REALLY LATER)
3.1 Source Code (LATER, Post 7, REALLY LATER)
3.2 Save Code in JASS Scripts (LATER, Post 7, REALLY LATER)
3.3 Load Code in JASS Scripts (LATER, Post 8, REALLY LATER)
3.4 How to modify it (LATER, Post 8, REALLY LATER)
3.5 Frequently Asked Questions (LATER, Post 9, REALLY 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
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].
Information
Takes string Playername
Returns int RandomizeCode
All is in the Information : It takes the variable string Playername, and returns an integer variable RandomizeCode.
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
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.
This is the code to Save your hero. I will explain later what it exactly does.
This is the code to load your hero. I will again explain how it works later.
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.
This first part detect when a player write exactly -save. The Condition is really useless because -save is -save.
We will work a little in that part.
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.
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.
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.
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.
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?
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.
It will be on 9 parts, the 3 first for 0.18f and 0.19a Versions, and the 3 nexts for 0.19h Version (Coming), and the 3 lasts for 0.20c Version (Coming). I also "publicize" Effane's tutorial, so less threads will be created because the most of threads that wants Save Load Codes. The Guide will be splited into 3 parts (Which contains 3 Consecutive Posts) mentionned at the top of the post.
To all who wants to ask a question about the Save Load Code map, post it here.
*Little Indian Order, mentionned at the end of this post, mean the Inverse Order. Example : 1 2 3 4 = 4 3 2 1
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
The Little Hard Mode
1. High Protection Code (0.18f/0.19a) (Post 1)
1.1 Source Code (Post 1)
1.2 How Save works? (Post 1)
1.3 How Load works? (Post 2)
1.4 What to modify? (Post 2)
1.5 How works Base10 to Base32 and what is it? (Post 2)
1.6 Dummy Functions inside the map. How it works? (Post 3)
1.7 Variable List Used (Post 3)
1.8 Frequently Asked Questions (Post 3)
The Easiest Mode
2. Unprotected Code (0.19h) (LATER, Post 4)
2.1 Source Code (LATER, Post 4)
2.2 Save Code Work (LATER, Post 4)
2.3 Load Code Work (LATER, Post 5)
2.4 What to modify there? (LATER, Post 5)
2.5 Frequently Asked Questions (LATER, Post 6)
The Hardest Mode Possible (LATER, Post 7, REALLY LATER)
3 Unproteted Code (LATER, Post 7, REALLY LATER)
3.1 Source Code (LATER, Post 7, REALLY LATER)
3.2 Save Code in JASS Scripts (LATER, Post 7, REALLY LATER)
3.3 Load Code in JASS Scripts (LATER, Post 8, REALLY LATER)
3.4 How to modify it (LATER, Post 8, REALLY LATER)
3.5 Frequently Asked Questions (LATER, Post 9, REALLY 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.