• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

CodeGen 1.0.2

Introduction

Sometimes you need to transfer data between games in order to keep the progress you've made. For example in RPG maps you probably want to save your hero, levels, gold and items so you can continue next time you play. The way this is done in Warcraft III by generating codes that contain all of your data, which can later be re-entered to restore that saved information. This is nothing new in the modding world however it's commonly asked about and requested yet many people still have issues. This is part of the reason why I decided to create an easy to use, universal, GUI-friendly save and load system which I'm calling the Code Generator.

Main Features
  1. Player-name sensitive (optional).
  2. Highly configurable.
  3. Can be used in the normal World Editor (doesn't require JNGP).
  4. Very easy to use.


  • -------- -------------------- --------
  • -------- The below options are for saving load codes to the Warcraft III folder. --------
  • -------- You can modify the file name via the SaveLoad_Filename variable within the save trigger. --------
    • -------- -------------------- --------
    • Set SaveLoad_SaveToDisk = True
    • Set SaveLoad_Directory = Save
    • -------- -------------------- --------
    • -------- Some configurables --------
    • -------- -------------------- --------
    • Set SaveLoad_Alphabet = abcdefghkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789
    • Set SaveLoad_CheckName = True
    • Set SaveLoad_Security = True
    • Set SaveLoad_HyphenSpace = 4
    • Set SaveLoad_SeperationChar = -
    • Set SaveLoad_Lower = |c002a4580
    • Set SaveLoad_Number = |cffffcc00
    • Set SaveLoad_Upper = |cff008000
    • -------- -------------------- --------
    • -------- Increase the value if you want to save bigger numbers --------
    • -------- Decrease it if you want to generate a smaller save code but only be able to save smaller values --------
    • -------- It's suggested to not increase it above 7 --------
    • -------- -------------------- --------
    • Set SaveLoad_MaxValue = 6
    • -------- -------------------- --------
    • -------- Store all the heroes you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Hero[0] = Blood Mage
    • Set SaveLoad_Hero[1] = Lich
    • Set SaveLoad_Hero[2] = Blademaster
    • Set SaveLoad_Hero[3] = Demon Hunter
    • Set SaveLoad_HeroCount = 3
    • -------- -------------------- --------
    • -------- Store all the abilities you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Abilities[0] = Flame Strike
    • Set SaveLoad_Abilities[1] = Siphon Mana
    • Set SaveLoad_Abilities[2] = Phoenix
    • Set SaveLoad_Abilities[3] = Banish
    • Set SaveLoad_AbilityCount = 3
    • -------- -------------------- --------
    • -------- Store all the items you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Item[0] = (Item-type of No item)
    • Set SaveLoad_Item[1] = Claws of Attack +15
    • Set SaveLoad_Item[2] = Crown of Kings +5
    • Set SaveLoad_Item[3] = Kelen's Dagger of Escape
    • Set SaveLoad_Item[4] = Mask of Death
    • Set SaveLoad_Item[5] = Orb of Frost
    • Set SaveLoad_Item[6] = Ring of Protection +5
    • Set SaveLoad_ItemCount = 6
    • -------- -------------------- --------
    • -------- Don't modify below this line. --------
    • -------- This is just here to copy variables to your map --------
    • -------- -------------------- --------
    • Set SaveLoad_Full = SaveLoad_Alphabet
    • Set SaveLoad_Error = <Empty String>
    • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
    • Set SaveLoad_Char[0] = <Empty String>
    • Set Load[0] = 0
    • Set LoadCount = 0
    • Custom script: call CodeGen_Init()
Installation
  1. Make sure your settings allow copying variables (Image)
  2. Copy the CodeGen folder over to your map.
  3. Paste the maps script into yours (Image)

How do I use it?

Let's take a look at the most basic example.

  • Set Save[0] = (Player 1 (Red) Current gold)
  • Custom script: set udg_Code = CodeGen_Compile()
  • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

The above will save Players 1's gold. Simple, isn't it? Now you're probably asking "How do I load it?".

  • -------- Check if load is valid --------
  • Set Code = (Substring((Entered chat string), 7, 999))
  • Custom script: call CodeGen_Load(udg_Code)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SaveLoad_Valid Equal to False
    • Then - Actions
      • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: SaveLoad_Error
      • Skip remaining actions
    • Else - Actions
  • Player - Set Player 1 (Red) Current gold to Load[0]

Equally as simple and there are more examples are available in the demo map.

Keywords:
save,load,save load,save and load,code,codegen,code gen,triggerhappy,password,gen,generator,generate,preloadgen,preload,file,io,to,disk
Contents

CodeGen v1.0.2 (Map)

Reviews
8 March 2014 PurgeandFire: Approved. Review: http://www.hiveworkshop.com/forums/2496968-post145.html 21 December 2013 Bribe: changed status to needs fix. 8 Sep 2011 Bribe: Deprecated in favor of: Save/Load with Snippets 21:27, 29th Aug...
Level 8
Joined
Apr 8, 2009
Messages
499
myeah xD since we tried fixing it alot not so long ago, its kinda coincidental we both read that "plea" for help :infl_thumbs_up:

lets just hope that guy reads that post with the working triggers .__.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
I suppose i could. just a sec, posting link here when i've created the map
----EDIT-----
Link

thnx dude +rep :thumbs_up:

lazy to add gui? Gosh

dude chill
it's not only that im too lazy but also i don't understand anything about the triggers of this system
they are just too advanced for me :grin:

EDIT:
dude wtf? :O
when i saved, a text appeared "Items in your Bag will NOT be saved."
how can this system save charges and not the items? o_O
is this some kind of joke? -.-

EDIT 2:
ok after all it wasn't a joke lol
i kinda combined the triggers and it managed to load with charges
but there is a problem...(as always -.-)
when i loaded all items had 2 charges and when i saved they had 6,4,10 =/
can you pls help me?

EDIT 3:
i think i found the problem
the variable called "Integer_A_Replacement" dosesn't have a variable type o_O
and when i change it's type to integer some actions are disabled due to missing variables -.-
yeah i know im annoying but i really need this system =/
 
Last edited:
Level 8
Joined
Apr 8, 2009
Messages
499
thnx dude +rep :thumbs_up:



dude chill
it's not only that im too lazy but also i don't understand anything about the triggers of this system
they are just too advanced for me :grin:

EDIT:
dude wtf? :O
when i saved, a text appeared "Items in your Bag will NOT be saved."
how can this system save charges and not the items? o_O
is this some kind of joke? -.-

EDIT 2:
ok after all it wasn't a joke lol
i kinda combined the triggers and it managed to load with charges
but there is a problem...(as always -.-)
when i loaded all items had 2 charges and when i saved they had 6,4,10 =/
can you pls help me?

EDIT 3:
i think i found the problem
the variable called "Integer_A_Replacement" dosesn't have a variable type o_O
and when i change it's type to integer some actions are disabled due to missing variables -.-
yeah i know im annoying but i really need this system =/

did you turn on the "create unknown variables" thingy in preferences?

also, that "the items in your bag wil not be saved" is for my map, its becuz you have a hero, AND an extra bag, therefore the "items in your bag wont be saved".



walktrough:
set preferences to "create unknown variables automaticly"
Copy triggers to your map,
Remove game message saying "items in the bag wont be saved"
Done. works.
 
thnx dude +rep :thumbs_up:

dude chill
it's not only that im too lazy but also i don't understand anything about the triggers of this system
they are just too advanced for me :grin:

/

you dont need to understand his trigger in order to copy-paste... understanding comes after copy-pasting... its no difference if you or him pasting it into your map really...
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
did you turn on the "create unknown variables" thingy in preferences?

also, that "the items in your bag wil not be saved" is for my map, its becuz you have a hero, AND an extra bag, therefore the "items in your bag wont be saved".



walktrough:
set preferences to "create unknown variables automaticly"
Copy triggers to your map,
Remove game message saying "items in the bag wont be saved"
Done. works.

i did the "create unknown variables automaticly" and i copyed the triggers in my map but still it loads items with 2 charges only
oh well ill just stay with the normal version..
 
Level 1
Joined
Oct 9, 2010
Messages
31
Hmm. 5/5 i think this tool is really good but yet it is the best because from all the other Save/Load systems its either at Pending/Needs Fix/Rejected but so far this is the only one that works approved i thank you for making it so now i can start my own RPG game this is a really helpfull tool of my opinion. But,,,, one question could people load your save code? and then well yea because if that happens them i might put 3/5 but either way its still pretty good keep up the good work!
 
Level 8
Joined
Apr 8, 2009
Messages
499
i'm using this system in my orpg, it works well but how can i make it saving an extra hero(backpack) and it's items?

you got triggers for saving/loading the items of your main hero? if so, a simple copy, paste and edit of certain unit specified values will do.

if you don't have any triggers for saving your items, check the map link i posted above?... although i dont know if that already has been deleted from my pastebin ¬¬
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
i've tried it and it won't works
added to the save heroes in the init the backpack and changed in the copy to only save the backpack
when i save it it makes mi a little different code but don't works, it won't load the backpack and won't write the wrong code thing
 
Level 8
Joined
Apr 8, 2009
Messages
499
i've tried it and it won't works
added to the save heroes in the init the backpack and changed in the copy to only save the backpack
when i save it it makes mi a little different code but don't works, it won't load the backpack and won't write the wrong code thing

can you post the triggers?
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
here they are

  • SaveLoad Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Some configurables --------
      • Set SaveLoad_Alphabet = aA5bB0cCdDeE9fFgGhH8iIj1mMn7NoOp3PqQrRsStTu2UJkK4lLvV6wWxXyYzZ
      • Set SaveLoad_CheckName = True
      • Set SaveLoad_HyphenSpace = 4
      • Set SaveLoad_Lower = |c00ff0000
      • Set SaveLoad_Number = |cff00ff00
      • Set SaveLoad_Upper = |cffffcc00
      • -------- Store all the items you want to be able to be saved below. --------
      • Set SaveLoad_Item[1] = Ancestral Staff
      • Set SaveLoad_Item[2] = Iron Staff
      • Set SaveLoad_Item[3] = Mithril Staff
      • Set SaveLoad_Item[4] = Neol's Scepter
      • Set SaveLoad_Item[5] = Oak Staff
      • Set SaveLoad_Item[6] = Silver Staff
      • Set SaveLoad_Item[7] = Staff of the Druid
      • Set SaveLoad_Item[8] = Staff of the Ice Queen
      • Set SaveLoad_Item[9] = Staff of the Master Druid
      • Set SaveLoad_Item[10] = Staff of the Necromancer
      • Set SaveLoad_Item[11] = Steel Staff
      • Set SaveLoad_Item[12] = Wooden Staff
      • Set SaveLoad_Item[13] = Amulet of Flowing Power
      • Set SaveLoad_Item[14] = Amulet of Manafeeder
      • Set SaveLoad_Item[15] = Amulet of Spirit Balance
      • Set SaveLoad_Item[16] = Copper Ring
      • Set SaveLoad_Item[17] = Darksteel Ring
      • Set SaveLoad_Item[18] = Necklace of the Phantom
      • Set SaveLoad_Item[19] = Ring of Destruction
      • Set SaveLoad_Item[20] = Ring of Regeneration
      • Set SaveLoad_Item[21] = Ring of the Champion
      • Set SaveLoad_Item[22] = Ring of the Rogue
      • Set SaveLoad_Item[23] = Ring of the Wise
      • Set SaveLoad_Item[24] = Coral Armor
      • Set SaveLoad_Item[25] = Dragonskin Armor
      • Set SaveLoad_Item[26] = Dragonskin Tunic
      • Set SaveLoad_Item[27] = Iron Helmet
      • Set SaveLoad_Item[28] = Leather Armor
      • Set SaveLoad_Item[29] = Leather Helmet
      • Set SaveLoad_Item[30] = Mithril Helmet
      • Set SaveLoad_Item[31] = Reinforced Leather Armor
      • Set SaveLoad_Item[32] = Reinforced Leather Tunic
      • Set SaveLoad_Item[33] = Ritual Mask
      • Set SaveLoad_Item[34] = Silk Tunic
      • Set SaveLoad_Item[35] = Steel Helmet
      • Set SaveLoad_Item[36] = Studded Leather Armor
      • Set SaveLoad_Item[37] = Coral Sword
      • Set SaveLoad_Item[38] = Iron Bow
      • Set SaveLoad_Item[39] = Iron Sword
      • Set SaveLoad_Item[40] = Mithril Bow
      • Set SaveLoad_Item[41] = Mithril Sword
      • Set SaveLoad_Item[42] = Oak Bow
      • Set SaveLoad_Item[43] = Steel Bow
      • Set SaveLoad_Item[44] = Steel Sword
      • Set SaveLoad_Item[45] = Thieves Dagger
      • Set SaveLoad_Item[46] = Wooden Bow
      • Set SaveLoad_Item[47] = Wooden Sword
      • Set SaveLoad_Item[48] = |c00ff0000Shivering Axe|r
      • Set SaveLoad_Item[49] = |c00ff0000Shivering Boots|r
      • Set SaveLoad_Item[50] = |c00ff0000Shivering Horn|r
      • Set SaveLoad_Item[51] = Coral Shield
      • Set SaveLoad_Item[52] = Enchanted Iron Shield
      • Set SaveLoad_Item[53] = Iron Shield
      • Set SaveLoad_Item[54] = Iron Tower Shield
      • Set SaveLoad_Item[55] = Mithril Round Shield
      • Set SaveLoad_Item[56] = Mithril Shield
      • Set SaveLoad_Item[57] = Plated Mithril Shield
      • Set SaveLoad_Item[58] = Ritual Wooden Shield
      • Set SaveLoad_Item[59] = Spiked Steel Shield
      • Set SaveLoad_Item[60] = Steel Shield
      • Set SaveLoad_Item[61] = Steel Tower Shield
      • Set SaveLoad_Item[62] = Unholy Wooden Shield
      • Set SaveLoad_Item[63] = Wooden Shield
      • Set SaveLoad_ItemCount = 63
      • -------- Store all the heroes you want to be able to be saved below. --------
      • Set SaveLoad_Hero[1] = |c00ff0000Phoenix Warrior|r
      • Set SaveLoad_Hero[2] = |c00ffff00Holy Knight|r
      • Set SaveLoad_Hero[3] = |c00ffff00Priest|r
      • Set SaveLoad_Hero[4] = |c0000ff00Illusionist|r
      • Set SaveLoad_Hero[5] = |c00a400ffMoonmage|r
      • Set SaveLoad_Hero[6] = |c000000ffIcy Warrior|r
      • Set SaveLoad_Hero[7] = |c0000ff00Amazon|r
      • Set SaveLoad_Hero[8] = |c000000ffElementalist|r
      • Set SaveLoad_Hero[9] = |c00a400ffDark Stalker|r
      • Set SaveLoad_Hero[10] = Backpack
      • Set SaveLoad_HeroCount = 10
      • -------- Don't modify below this line. --------
      • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
      • Set SaveLoad_Char = <Empty String>
      • Set Load[0] = 0
      • Set LoadCount = 0
      • Custom script: call CodeGen_Init()
  • SaveLoad 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
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((((Matching unit) is A Hero) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Backpack))) and do (Set Hero = (Picked unit))
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players gold. --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes level. --------
      • Set Save[SaveCount] = (Hero level of Hero)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes items. --------
      • Set Save[SaveCount] = (Number of items carried by Hero)
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer A) from 1 to 6, 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 Hero in slot (Integer A))) Not equal to (Item-type of No item)
            • Then - Actions
              • Set Item = (Item carried by Hero in slot (Integer A))
              • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
              • Set SaveCount = (SaveCount + 1)
            • Else - Actions
      • -------- Show Code --------
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to (Player group((Triggering player))) for 120.00 seconds the text: (Your code is: + Code)
  • SaveLoad 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
      • (Substring((Entered chat string), 1, 6)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerLoad[(Player number of (Triggering player))] Equal to 1
            • Then - Actions
              • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: You have already lo...
              • Skip remaining actions
            • Else - Actions
              • Set PlayerLoad[(Player number of (Triggering player))] = 1
      • -------- Start loading, load the hero first. --------
      • Set LoadCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Random point in Respawn <gen>) facing Default building facing degrees
      • Set Hero = (Last created unit)
      • Selection - Select (Last created unit) for (Triggering player)
      • -------- Now load players gold --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- Load heroes level --------
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
      • -------- Now items --------
      • Set LoadCount = (LoadCount + 1)
      • For each (Integer A) from 0 to Load[LoadCount], do (Actions)
        • Loop - Actions
          • Set LoadCount = (LoadCount + 1)
          • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
  • SaveLoad Save Backpack
    • Events
      • Player - Player 1 (Red) types a chat message containing -savebp as An exact match
      • Player - Player 2 (Blue) types a chat message containing -savebp as An exact match
      • Player - Player 3 (Teal) types a chat message containing -savebp as An exact match
      • Player - Player 4 (Purple) types a chat message containing -savebp as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -savebp as An exact match
      • Player - Player 6 (Orange) types a chat message containing -savebp as An exact match
      • Player - Player 7 (Green) types a chat message containing -savebp as An exact match
      • Player - Player 8 (Pink) types a chat message containing -savebp as An exact match
      • Player - Player 9 (Gray) types a chat message containing -savebp as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -savebp as An exact match
    • Conditions
    • Actions
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Equal to Backpack)) and do (Set Hero = (Picked unit))
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players gold. --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes level. --------
      • Set Save[SaveCount] = (Hero level of Hero)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes items. --------
      • Set Save[SaveCount] = (Number of items carried by Hero)
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer A) from 1 to 6, 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 Hero in slot (Integer A))) Not equal to (Item-type of No item)
            • Then - Actions
              • Set Item = (Item carried by Hero in slot (Integer A))
              • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
              • Set SaveCount = (SaveCount + 1)
            • Else - Actions
      • -------- Show Code --------
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to (Player group((Triggering player))) for 120.00 seconds the text: (Your backpack code is: + Code)
  • SaveLoad Load Backpack
    • Events
      • Player - Player 1 (Red) types a chat message containing -loadbp as A substring
      • Player - Player 2 (Blue) types a chat message containing -loadbp as A substring
      • Player - Player 3 (Teal) types a chat message containing -loadbp as A substring
      • Player - Player 4 (Purple) types a chat message containing -loadbp as A substring
      • Player - Player 5 (Yellow) types a chat message containing -loadbp as A substring
      • Player - Player 6 (Orange) types a chat message containing -loadbp as A substring
      • Player - Player 7 (Green) types a chat message containing -loadbp as A substring
      • Player - Player 8 (Pink) types a chat message containing -loadbp as A substring
      • Player - Player 9 (Gray) types a chat message containing -loadbp as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -loadbp as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
      • -------- Start loading, load the hero first. --------
      • Set LoadCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) of type Backpack) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Random point in Respawn <gen>) facing Default building facing degrees
      • Hero - Disable experience gain for (Last created unit)
      • Set Hero = (Last created unit)
      • -------- Now load players gold --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- Load heroes level --------
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
      • -------- Now items --------
      • Set LoadCount = (LoadCount + 1)
      • For each (Integer A) from 0 to Load[LoadCount], do (Actions)
        • Loop - Actions
          • Set LoadCount = (LoadCount + 1)
          • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
 
Level 8
Joined
Apr 8, 2009
Messages
499
The problem, lies with these lines in the Load triggers for the backpack.

  • Conditions:
    • (Substring((Entered chat string), 1, 6)) Equal to -load
  • Actions:
    • Set Code = (Substring((Entered chat string), 7, 999))
Since the entered string is "-loadbp " the substring shouldn't be 1,6 but 1,8 and the part after it shouldnt be "-load" but "-loadbp"....
and the substring should also be changed in the action part obviously.

  • Conditions:
    • (Substring((Entered chat string), 1, 8)) Equal to -loadbp
  • Actions:
    • Set Code = (Substring((Entered chat string), 9, 999))
 
Level 8
Joined
Apr 8, 2009
Messages
499
oooooh i haven't seen it yet, thx for the help but i still don't understand something...
when i typed -savebp it made me a code that in 8-9 letters differs from the hero code and when i typed -loadbp it hanven't sent the "your code is invalid" message

Thats because it didn't get past the Condition, so typing
-loadbp code-code-code would be ignored and nothing would happen. right?
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
i didn't forgot it
but when i don't have a backpack because of the hero load and i type in "-savebp" it makes me a code again o_O
i've changed the unit pick but it still not workin
  • SaveLoad Load Backpack
    • Events
      • Player - Player 1 (Red) types a chat message containing -loadbp as A substring
      • Player - Player 2 (Blue) types a chat message containing -loadbp as A substring
      • Player - Player 3 (Teal) types a chat message containing -loadbp as A substring
      • Player - Player 4 (Purple) types a chat message containing -loadbp as A substring
      • Player - Player 5 (Yellow) types a chat message containing -loadbp as A substring
      • Player - Player 6 (Orange) types a chat message containing -loadbp as A substring
      • Player - Player 7 (Green) types a chat message containing -loadbp as A substring
      • Player - Player 8 (Pink) types a chat message containing -loadbp as A substring
      • Player - Player 9 (Gray) types a chat message containing -loadbp as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -loadbp as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 8)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 9, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
      • -------- Start loading, load the hero first. --------
      • Set LoadCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) of type Backpack) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Random point in Respawn <gen>) facing Default building facing degrees
      • Hero - Disable experience gain for (Last created unit)
      • Set Hero = (Last created unit)
      • -------- Now load players gold --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- Load heroes level --------
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
      • -------- Now items --------
      • Set LoadCount = (LoadCount + 1)
      • For each (Integer A) from 0 to Load[LoadCount], do (Actions)
        • Loop - Actions
          • Set LoadCount = (LoadCount + 1)
          • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
 
Level 8
Joined
Apr 8, 2009
Messages
499
The problem, lies with these lines in the Load triggers for the backpack.

  • Conditions:
    • (Substring((Entered chat string), 1, 6)) Equal to -load
  • Actions:
    • Set Code = (Substring((Entered chat string), 7, 999))
Since the entered string is "-loadbp " the substring shouldn't be 1,6 but 1,8 and the part after it shouldnt be "-load" but "-loadbp"....
and the substring should also be changed in the action part obviously.

  • Conditions:
    • (Substring((Entered chat string), 1, 8)) Equal to -loadbp
  • Actions:
    • Set Code = (Substring((Entered chat string), 9, 999))

... should at least fully read it ¬¬



extra item for the backpack? what? o_O;
explain what you did and what happened mkay ^__^?
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
i haven't changed the save trigger
here they are

  • SaveLoad Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Some configurables --------
      • Set SaveLoad_Alphabet = aA5bB0cCdDeE9fFgGhH8iIj1mMn7NoOp3PqQrRsStTu2UJkK4lLvV6wWxXyYzZ
      • Set SaveLoad_CheckName = True
      • Set SaveLoad_HyphenSpace = 4
      • Set SaveLoad_Lower = |c00ff0000
      • Set SaveLoad_Number = |cff00ff00
      • Set SaveLoad_Upper = |cffffcc00
      • -------- Store all the items you want to be able to be saved below. --------
      • Set SaveLoad_Item[1] = Ancestral Staff
      • Set SaveLoad_Item[2] = Iron Staff
      • Set SaveLoad_Item[3] = Mithril Staff
      • Set SaveLoad_Item[4] = Neol's Scepter
      • Set SaveLoad_Item[5] = Oak Staff
      • Set SaveLoad_Item[6] = Silver Staff
      • Set SaveLoad_Item[7] = Staff of the Druid
      • Set SaveLoad_Item[8] = Staff of the Ice Queen
      • Set SaveLoad_Item[9] = Staff of the Master Druid
      • Set SaveLoad_Item[10] = Staff of the Necromancer
      • Set SaveLoad_Item[11] = Steel Staff
      • Set SaveLoad_Item[12] = Wooden Staff
      • Set SaveLoad_Item[13] = Amulet of Flowing Power
      • Set SaveLoad_Item[14] = Amulet of Manafeeder
      • Set SaveLoad_Item[15] = Amulet of Spirit Balance
      • Set SaveLoad_Item[16] = Copper Ring
      • Set SaveLoad_Item[17] = Darksteel Ring
      • Set SaveLoad_Item[18] = Necklace of the Phantom
      • Set SaveLoad_Item[19] = Ring of Destruction
      • Set SaveLoad_Item[20] = Ring of Regeneration
      • Set SaveLoad_Item[21] = Ring of the Champion
      • Set SaveLoad_Item[22] = Ring of the Rogue
      • Set SaveLoad_Item[23] = Ring of the Wise
      • Set SaveLoad_Item[24] = Coral Armor
      • Set SaveLoad_Item[25] = Dragonskin Armor
      • Set SaveLoad_Item[26] = Dragonskin Tunic
      • Set SaveLoad_Item[27] = Iron Helmet
      • Set SaveLoad_Item[28] = Leather Armor
      • Set SaveLoad_Item[29] = Leather Helmet
      • Set SaveLoad_Item[30] = Mithril Helmet
      • Set SaveLoad_Item[31] = Reinforced Leather Armor
      • Set SaveLoad_Item[32] = Reinforced Leather Tunic
      • Set SaveLoad_Item[33] = Ritual Mask
      • Set SaveLoad_Item[34] = Silk Tunic
      • Set SaveLoad_Item[35] = Steel Helmet
      • Set SaveLoad_Item[36] = Studded Leather Armor
      • Set SaveLoad_Item[37] = Coral Sword
      • Set SaveLoad_Item[38] = Iron Bow
      • Set SaveLoad_Item[39] = Iron Sword
      • Set SaveLoad_Item[40] = Mithril Bow
      • Set SaveLoad_Item[41] = Mithril Sword
      • Set SaveLoad_Item[42] = Oak Bow
      • Set SaveLoad_Item[43] = Steel Bow
      • Set SaveLoad_Item[44] = Steel Sword
      • Set SaveLoad_Item[45] = Thieves Dagger
      • Set SaveLoad_Item[46] = Wooden Bow
      • Set SaveLoad_Item[47] = Wooden Sword
      • Set SaveLoad_Item[48] = |c00ff0000Shivering Axe|r
      • Set SaveLoad_Item[49] = |c00ff0000Shivering Boots|r
      • Set SaveLoad_Item[50] = |c00ff0000Shivering Horn|r
      • Set SaveLoad_Item[51] = Coral Shield
      • Set SaveLoad_Item[52] = Enchanted Iron Shield
      • Set SaveLoad_Item[53] = Iron Shield
      • Set SaveLoad_Item[54] = Iron Tower Shield
      • Set SaveLoad_Item[55] = Mithril Round Shield
      • Set SaveLoad_Item[56] = Mithril Shield
      • Set SaveLoad_Item[57] = Plated Mithril Shield
      • Set SaveLoad_Item[58] = Ritual Wooden Shield
      • Set SaveLoad_Item[59] = Spiked Steel Shield
      • Set SaveLoad_Item[60] = Steel Shield
      • Set SaveLoad_Item[61] = Steel Tower Shield
      • Set SaveLoad_Item[62] = Unholy Wooden Shield
      • Set SaveLoad_Item[63] = Wooden Shield
      • Set SaveLoad_ItemCount = 63
      • -------- Store all the heroes you want to be able to be saved below. --------
      • Set SaveLoad_Hero[1] = |c00ff0000Phoenix Warrior|r
      • Set SaveLoad_Hero[2] = |c00ffff00Holy Knight|r
      • Set SaveLoad_Hero[3] = |c00ffff00Priest|r
      • Set SaveLoad_Hero[4] = |c0000ff00Illusionist|r
      • Set SaveLoad_Hero[5] = |c00a400ffMoonmage|r
      • Set SaveLoad_Hero[6] = |c000000ffIcy Warrior|r
      • Set SaveLoad_Hero[7] = |c0000ff00Amazon|r
      • Set SaveLoad_Hero[8] = |c000000ffElementalist|r
      • Set SaveLoad_Hero[9] = |c00a400ffDark Stalker|r
      • Set SaveLoad_Hero[10] = Backpack
      • Set SaveLoad_HeroCount = 10
      • -------- Don't modify below this line. --------
      • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
      • Set SaveLoad_Char = <Empty String>
      • Set Load[0] = 0
      • Set LoadCount = 0
      • Custom script: call CodeGen_Init()
  • SaveLoad 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
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((((Matching unit) is A Hero) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Backpack))) and do (Set Hero = (Picked unit))
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players gold. --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes level. --------
      • Set Save[SaveCount] = (Hero level of Hero)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes items. --------
      • Set Save[SaveCount] = (Number of items carried by Hero)
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer A) from 1 to 6, 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 Hero in slot (Integer A))) Not equal to (Item-type of No item)
            • Then - Actions
              • Set Item = (Item carried by Hero in slot (Integer A))
              • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
              • Set SaveCount = (SaveCount + 1)
            • Else - Actions
      • -------- Show Code --------
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to (Player group((Triggering player))) for 120.00 seconds the text: (Your code is: + Code)
  • SaveLoad 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
      • (Substring((Entered chat string), 1, 6)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerLoad[(Player number of (Triggering player))] Equal to 1
            • Then - Actions
              • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: You have already lo...
              • Skip remaining actions
            • Else - Actions
              • Set PlayerLoad[(Player number of (Triggering player))] = 1
      • -------- Start loading, load the hero first. --------
      • Set LoadCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Random point in Respawn <gen>) facing Default building facing degrees
      • Set Hero = (Last created unit)
      • Selection - Select (Last created unit) for (Triggering player)
      • -------- Now load players gold --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- Load heroes level --------
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero Hero-level to Load[LoadCount], Hide level-up graphics
      • -------- Now items --------
      • Set LoadCount = (LoadCount + 1)
      • For each (Integer A) from 0 to Load[LoadCount], do (Actions)
        • Loop - Actions
          • Set LoadCount = (LoadCount + 1)
          • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
  • SaveLoad Save Backpack
    • Events
      • Player - Player 1 (Red) types a chat message containing -savebp as An exact match
      • Player - Player 2 (Blue) types a chat message containing -savebp as An exact match
      • Player - Player 3 (Teal) types a chat message containing -savebp as An exact match
      • Player - Player 4 (Purple) types a chat message containing -savebp as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -savebp as An exact match
      • Player - Player 6 (Orange) types a chat message containing -savebp as An exact match
      • Player - Player 7 (Green) types a chat message containing -savebp as An exact match
      • Player - Player 8 (Pink) types a chat message containing -savebp as An exact match
      • Player - Player 9 (Gray) types a chat message containing -savebp as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -savebp as An exact match
    • Conditions
    • Actions
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Equal to Backpack)) and do (Set Hero = (Picked unit))
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players gold. --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes level. --------
      • Set Save[SaveCount] = (Hero level of Hero)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes items. --------
      • Set Save[SaveCount] = (Number of items carried by Hero)
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer A) from 1 to 6, 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 Hero in slot (Integer A))) Not equal to (Item-type of No item)
            • Then - Actions
              • Set Item = (Item carried by Hero in slot (Integer A))
              • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
              • Set SaveCount = (SaveCount + 1)
            • Else - Actions
      • -------- Show Code --------
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to (Player group((Triggering player))) for 120.00 seconds the text: (Your backpack code is: + Code)
 
Level 1
Joined
Apr 13, 2010
Messages
2
Hmmm, if im gonna use this in my map and when i will release a new version in my map and the players will gonna try to load the heroes at the old version of my map in to the new one, will this still work?
 
Hmmm, if im gonna use this in my map and when i will release a new version in my map and the players will gonna try to load the heroes at the old version of my map in to the new one, will this still work?

yup, as long as you don't edit the save-codes (example: add new things to be saved) and that you don't delete object editor data (can cause bugs if the save-code has a saved object that was removed from the OE)...
 
Level 1
Joined
Oct 9, 2010
Messages
31
Ehh,, This will require all of us who used it to find out Anti-Cheat triggers. Because im more of a skill inspector and so what i found out that is: If you type in cheats and then kill really hard creeps then the person types "-save" well i realized that well....... If you load your code in Local Area Network, Or Battle.net it will load and that person had done nothing. So im looking forward for everyone who uses this to find Anti-Cheat Triggers so then they have the opportunity to save in Single Player Mode but cant cheat as for me i have a link for you guys and here it is http://www.hiveworkshop.com/forums/spells-569/anti-cheat-version-0-a-184377/
 
Top