TriggerHappy
...
- Reaction score
- 341
Information : This save/load is nothing special , its just a basic save/load code that im hoping people can learn from. Its not 100% Safe , if you saw the source code then you could decode it , or if you studied the code from saving alot , then you might be able to "hack" it.
Reason For Sumbitting : For Others to learn from , or use
What It Saves :
.Unlimited amount of heroes
.Unlimited amount of items
What It CAN Save :
.Anything
What I Am Looking to add:
.Level
.Abilites
Screenshot
Triggers:
Reason For Sumbitting : For Others to learn from , or use
What It Saves :
.Unlimited amount of heroes
.Unlimited amount of items
What It CAN Save :
.Anything
What I Am Looking to add:
.Level
.Abilites
Screenshot
Triggers:
Inialization
Alphabet
Save
Load
Save Hero
Save Items
Load Hero
Load Items
Code:
Inialization
Events
Map initialization
Conditions
Actions
Visibility - Disable fog of war
Visibility - Disable black mask
-------- --------
Set PlayersHero[1] = Blood Mage 0000 <gen>
Set PlayersHero[2] = Blood Mage 0049 <gen>
Set PlayersHero[3] = Blood Mage 0050 <gen>
Set PlayersHero[4] = Blood Mage 0051 <gen>
Set PlayersHero[5] = Blood Mage 0052 <gen>
-------- -------------------------Heroes-------------------------- --------
Set InitializeHeroes[1] = Blood Mage
Set InitializeHeroes_String[1] = 23
Set EndHeroes = 1
-------- -------------------------Items-------------------------- --------
Set InitializeItems[1] = Claws of Attack +15
Set InitializeItems_String[1] = 82
Set InitializeItems[2] = Ring of Protection +5
Set InitializeItems_String[2] = 34
Set InitializeItems[3] = Crown of Kings +5
Set InitializeItems_String[3] = 28
Set InitializeItems[4] = Kelen's Dagger of Escape
Set InitializeItems_String[4] = 15
Set InitializeItems[5] = Cheese
Set InitializeItems_String[5] = 75
Set InitializeItems[6] = Orb of Frost
Set InitializeItems_String[6] = 45
Set EndItems = 6
Alphabet
Code:
function Trig_Alphabet_Actions takes nothing returns nothing
set udg_TempInteger = 0
set udg_Alphabet[udg_TempInteger] = "1"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "2"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "3"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "4"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "5"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "6"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "7"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "8"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "9"
set udg_TempInteger = ( udg_TempInteger + 1 )
set udg_Alphabet[udg_TempInteger] = "0"
set udg_TempInteger = ( udg_TempInteger + 1 )
endfunction
//===========================================================================
function InitTrig_Alphabet takes nothing returns nothing
set gg_trg_Alphabet = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Alphabet, 0.00 )
call TriggerAddAction( gg_trg_Alphabet, function Trig_Alphabet_Actions )
endfunction
Save
Code:
Save
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
Conditions
Actions
Cinematic - Clear the screen of text messages for (Player group((Triggering player)))
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
For each (Integer A) from 1 to EndHeroes, do (Actions)
Loop - Actions
Set RandomNumber = (Random integer number between 1 and 10)
Set RandomNumber2 = (Random integer number between 1 and 10)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Alphabet[RandomNumber] + Alphabet[RandomNumber2]) Not equal to InitializeItems_String[(Integer A)]
Then - Actions
Set String_Items[(Integer B)] = (Alphabet[(Random integer number between 1 and 10)] + Alphabet[(Random integer number between 1 and 10)])
Else - Actions
Set String_Items[(Integer B)] = (81 + Alphabet[(Random integer number between 1 and 10)])
Wait 0.15 seconds
Trigger - Run Save Hero <gen> (checking conditions)
Trigger - Run Save Items <gen> (checking conditions)
-------- DisplayCode --------
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: |c000080FF=========...
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: |c00D7D700Code : |r
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: ((((((|c00FF8000 + (Substring(String_Hero, 1, 1))) + (String_Items[5] + String_Items[1])) + String_Items[2]) + String_Items[4]) + (String_Items[3] + (Substring(String_Hero, 2, 2)))) + (String_Items[6] + (<Empty String> + |r)))
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: |c000080FF=========...
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text:
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text:
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text:
Load
Code:
Load
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
Conditions
Actions
Set KeepLoading = True
Cinematic - Clear the screen of text messages for (Player group((Triggering player)))
Trigger - Run Load Hero <gen> (checking conditions)
Trigger - Run Load Items <gen> (checking conditions)
Save Hero
Code:
Save Hero
Events
Conditions
Actions
For each (Integer A) from 1 to EndHeroes, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of PlayersHero[(Player number of (Triggering player))]) Equal to InitializeHeroes[(Integer A)]
Then - Actions
Set String_Hero = InitializeHeroes_String[(Integer A)]
Skip remaining actions
Else - Actions
Save Items
Code:
Save Items
Events
Conditions
Actions
For each (Integer B) from 1 to 6, do (Actions)
Loop - Actions
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by PlayersHero[(Player number of (Triggering player))] in slot (Integer B))) Equal to InitializeItems[(Integer A)]
Then - Actions
Set String_Items[(Integer B)] = InitializeItems_String[(Integer A)]
Else - Actions
Load Hero
Code:
Load Hero
Events
Conditions
Actions
For each (Integer A) from 1 to EndHeroes, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 7, 7)) Equal to (Substring(InitializeHeroes_String[(Integer A)], 1, 1))
(Substring((Entered chat string), 18, 18)) Equal to (Substring(InitializeHeroes_String[(Integer A)], 2, 2))
Then - Actions
Unit - Remove PlayersHero[(Player number of (Triggering player))] from the game
Unit - Create 1 InitializeHeroes[(Integer A)] for (Triggering player) at ((Triggering player) start location) facing (Position of (Triggering unit))
Set PlayersHero[(Player number of (Triggering player))] = (Last created unit)
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created unit)) + : |c0000FF00Loaded|r)
Else - Actions
Game - Display to (Player group((Triggering player))) the text: |c00FF0000Error #1 ...
Set KeepLoading = False
Load Items
Code:
Load Items
Events
Conditions
KeepLoading Not equal to False
Actions
-------- Load Item #1 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 8, 9)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions
-------- Load Item #2 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 10, 11)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions
-------- Load Item #3 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 12, 13)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions
-------- Load Item #4 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 14, 15)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions
-------- Load Item #5 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 16, 17)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions
-------- Load Item #6 --------
For each (Integer A) from 1 to EndItems, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 19, 20)) Equal to InitializeItems_String[(Integer A)]
Then - Actions
Hero - Create InitializeItems[(Integer A)] and give it to PlayersHero[(Player number of (Triggering player))]
Game - Display to (Player group((Triggering player))) the text: ((Name of (Last created item)) + : |c0000FF00Loaded|r)
Else - Actions