Save/Load Code

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,496
> it is the best protection for very small save load codes

A001-BC23-DEF4 doesn't make any more or less sense than 4FED-32CB-100A.
Is also isn't any safer. Or easier to guess.
 

Chocobo

White-Flower
Reaction score
409
I mean save load codes with only strings like aa ab ac ad ae af ag... zx zy zz.

Example your map is openable with jass shop pro, it will be easy to guess what type of hero you want, what items you want, and what level you want.

Code:
Setup
Events
Game - Time elasped 0.00 seconds of game-time

Conditions
None

Actions
Set ItemSetup[0] = no item
Set ItemSetup[1] = <whatever item1>
Set ItemSetup[2] = <whatever item2>
..
Set ItemCode[0] = ia
Set ItemCode[1] = ai
Set ItemCode[2] = kl
..
Set HeroSetup[1] = <whatever hero1>
Set HeroSetup[2] = <whatever hero2>
..
Set HeroCode[1] = a
Set HeroCode[2] = i

Code:
Save
Events
....

Conditions
....

Actions
....
....
<I wrote it on 2 min>
For Each Integer A from 1 to 2, Do Actions
       If (Hero type of (Hero[Player number of (Triggering player)]) Equal to HeroSetup[Integer A])
       Then Set ItCd[1] = (Integer A)
       Else //Do Nothing
For Each Integer A from 1 to 2, Do Actions
       For Each Integer B from 1 to 6, Do Actions
             If (Item type in slot (Integer B) of (Hero[Player number of (Triggering player)])) Equal to ItemSetup[Integer A])
             Then Set ItCd[Integer B] = (Integer A)
             Else //Do Nothing
Set SaveCode1 = (IC[ItCd[1]] + IC[ItCd[2]] + IC[ItCd[3]] + IC[ItCd[4]] + IC[ItCd[5]] + IC[ItCd[6]] + IC[ItCd[7]]
For Each (Integer A) from 0 to ((Length of SaveCode1) - 1), do (Actions)
       Set SaveCode2 = (SaveCode2 + (Substring(SaveCode1, ((Length of SaveCode1) - (Integer A)), (((Length of SaveCode1) - (Integer A))))))
Game - Display... Your loading code is : SaveCode2

:D Guess the code!

-load lkaiialkaiiai :nuts: :banghead:
 

Effane

Save/Load Code Tutorial
Reaction score
51
I dont know why this has been a contest for you Chocobo. :) Writing more obscure code isnt going to stop someone from breaking the map encryption, then looking for what they want and getting it. There is only ONE way to protect the encryption, and that is you have to protect the code in the map itself from any access, and no one can do that with what WC3/Blizzard has given us. :banghead:

Just going step by step through with a pen and a paper anyone who knows what he is looking at will be able to break it. :eek:

The answer is Hero 2, Item1, No item, Item 2, Item 1, No item, Item 2, BTW. It took me about 3 mins to crack it. :cool:

And looking at the code, its much easier to crack yours than others I have seen. took three steps, flip the code around. Break it down into groups of the variable size, then convert to the right variables. And the worst thing about your code, you have to pre create massive arrays and its not scalable on the fly, so in order to change the number system, you would have to retype everything by hand. Thats not creating secure code, thats wasting time.
Lets say a map maker has 20 heroes, and 150 items. That means they have to enter by hand 170 entries X 2. And all the time, keeping track of the characters hoping they dont accidently enter the same character set twice, wouldnt that be a fun bug to chase, 170 entries for a wrong character.

If I wanted I could make the Code totally convoluted for encryption I could do this. :nuts: Check for player name, hash code it out. Compress it into the Checksum, then double encrypt the whole thing, insert a password that the player has to type in by hand, finally check for spoofing playernames. But what would that accomplish, it would cost me 3X more time. The player would hate typing in the password. And odds are they would type it into the playerchat anyways, screwing the whole concept. As long as we cant encrypt the information in the map with a true encryption, then there is no point. :mad: @ Blizzard
 
E

Eggz

Guest
When i paste the triggers onto my map, the hero doesn't spawn? and when i do -save it's always like 3-AAAA-AAAA-AAAA-AAAA-AAAA-A :(
 

Effane

Save/Load Code Tutorial
Reaction score
51
Sounds like your variables arent loading with the right player info. Your basically getting Encryption Set 3, and All 0s across the board. So its getting NULL set for everything.

Now, I bet when you create your hero your not setting that unit to a variable to track that hero. Check out the Random Trigger for info about creating the hero with the tracking element.
 

Sooda

Diversity enchants
Reaction score
318
Eggz said:
When i paste the triggers onto my map, the hero doesn't spawn? and when i do -save it's always like 3-AAAA-AAAA-AAAA-AAAA-AAAA-A :(
I just love these kind of posts :D He tried so hardly to understand it poor him :( ( I' m just- sarcasm )
 

Effane

Save/Load Code Tutorial
Reaction score
51
Well I did warn them the Tutorial was Intermediate level. This isnt stuff for unexperienced trigger makers to try and tackle. Caches are about the only thing I can think of harder to do than maybe the upper level JASS stuff.
 
G

grimmyx

Guest
Help!

Hello. I am relatively new to the mapping as well as the forum. I copied over your triggers and all of the variables, but everytime I choose a character and try to save it, I get the same problem as Eggz. For almost the whole thing i get A's.
EX(2-AAAA-AAAA-AAAA-AAAA-ACE2-AAAA-G) [not sure about the last character]

When I use your -random test code, it works and I get a hero. When I try to save, it also works and the characters are things other than A. Do you have any idea why this would be happening? I dont understand why it doesnt work if I dont random :(

In addition, where it says SaveLoadHeroesStored = Paladin etc, do i have to make more of those depending on how many heroes I have? Im going to post my map in case you are able to analyze the problem. Thanks for any help you can give me. ;)
 

Attachments

  • Fantastic 6 Fighers Beta.w3x
    171.5 KB · Views: 547
N

Nezgibs

Guest
Effane can u plz alter the code a bit for me to save 250 items, up to 7000 lumber and also can u fix or explain how to fix the problem where when we save a non random hero it shows mostly A's? thx for the help and kickass save/load code.
 

Effane

Save/Load Code Tutorial
Reaction score
51
Sorry for the few day responce. I dont work in the same town as my wife and son live in, I take off weekends for time with them and I dont touch the computer during that.

-------------------------------------------------------------

Okay, going to add this to the FAQs, but I will explain it here. Alot of people are stuck on this one thing, and I assumed it was obvious. When you get that many PMs, its definetly not obvious. :p

Code:
CreateSingleStuff
    Events
        Player - Player 1 (Red) types a chat message containing -Random as An exact match
        Player - Player 2 (Blue) types a chat message containing -Random as An exact match
        Player - Player 3 (Teal) types a chat message containing -Random as An exact match
        Player - Player 4 (Purple) types a chat message containing -Random as An exact match
    Conditions
    Actions
        Set SaveLoadHasLoaded[(Player number of (Triggering player))] = True
        Unit - Create 1 SaveLoadHeroesStored[(Random integer number between 1 and SaveLoadMaxHeroesStored)] for (Triggering player) at (Center of Regions[(Random integer number between 1 and 9)]) facing Default building facing degrees
        Set SaveLoadPlayerHeroSingle[(Player number of (Triggering player))] = (Last created unit)
        Hero - Set SaveLoadPlayerHeroSingle[(Player number of (Triggering player))] Hero-level to (Random integer number between 1 and 10), Hide level-up graphics
        Set IntegerC = (Random integer number between 2 and 6)
        For each (Integer A) from 1 to IntegerC, do (Actions)
            Loop - Actions
                Hero - Create SaveLoadItemsStored[(Random integer number between 1 and SaveLoadMaxItemsStored)] and give it to SaveLoadPlayerHeroSingle[(Player number of (Triggering player))]
        Player - Set (Triggering player) Current gold to (Random integer number between 100000 and 1000000)
        Player - Set (Triggering player) Current lumber to (Random integer number between 100000 and 1000000)

This is a code example from the Demo Map. Now, here is how the map "Remembers" which player has which hero. Tracking variables are very powerful and I recommend everyone use them. They also kill leaks. This following section is the heart of this problem.

Code:
Set SaveLoadHasLoaded[(Player number of (Triggering player))] = True
        Unit - Create 1 SaveLoadHeroesStored[(Random integer number between 1 and SaveLoadMaxHeroesStored)] for (Triggering player) at (Center of Regions[(Random integer number between 1 and 9)]) facing Default building facing degrees
        Set SaveLoadPlayerHeroSingle[(Player number of (Triggering player))] = (Last created unit)

Whats happening here is first it sets the SaveLoadHasLoaded, this is to stop people from loading over and over, that would be bad. Then you are creating a hero. That we all should have mastered by now, if your map starts with a hero on it, then instead assign all player heroes to a tempUnitGroup and then use pick all in group and perform multiple actions.

Now, each hero needs to be put into another variable to track them. This is a powerful and fast way to get them without any craziness later.

Notice the following.
Code:
        Set SaveLoadPlayerHeroSingle[(Player number of (Triggering player))] = (Last created unit)

This basically grabs the last created unit, the hero. And then finds out what hero it is and assigns that hero to a unit array with the index (spot its stored in) as the player number.

Then to retrieve that hero all you do is access the Array with the player number and viola, you got your hero without using pick/unitgroups and all the leaks/processor cycles.


So to wrap this up, make sure you assign any heroes created to the correct array slot, that shoudl fix most of your issues with the 3-AAAA... ... ...

-------------------------------------------------------------------

Now the issue with getting 3-AAAA-AAAA-AAAA-AAAA-AAAJ-AAAH-T or something like that. Its an easy answer and its not a terribly unsecure result.
The first set of 4 chars is the hero level and hero type. You will need to refer to above answer for that fix.


The 3 middle sets of 4 chars are the items slots. The above issue will cause this, or you probly dont have anything in them at the time of saving. Looking at your result I suspect its the first problem.

Now if its the empty item slot issue, then thats normal results. They are just encrypted versions of the number 0. Now this isnt a encryption security issue for the most part. Why? Because we dont really care if they can make 0s, they still will not know how to create items, and also they still have to get around the checksum. Both will be a total nightmare for the novice to crack from the outside.
 
D

Dark_Onix

Guest
It's cool Effane,i waited for this for weeks,look much better than elil save code,hope that it get with other official tutorials.
 
A

Abraxas

Guest
Last post was a month ago, I hope youll answer this.

You said (in page 2) that you created a 2 digit system to store up to 50 heroes.

now am I misunderstanding the system completely but doesnt 2 slots give you up to 1296 heroes?

does the same go for items?

and by the way, you should edit your FAQ, it took me a couple hours to implement your codes because I needed to edit all the 'auto created variables' to have the correct amount of array sizes. for example, I have 8 players so I needed to change a couple array sizes, and they all default to 1, so that confused me a little.

I got it to work eventually... and now im gonna try to set it up so it can store more info. can you add on a little tutorial on how to add and load more variables? (like for example, I set up an array with abilities same as items, and 2 of them get saved. how do I add on 2 more slots and load them?)

thanks. (+ rep for help of course)
 

Effane

Save/Load Code Tutorial
Reaction score
51
I used a 2 digit system so people could have a default system capable of 50 heroes.

You kinda took this out of context. When ever creating anything its best to say to yourself. "What do I want this to be able to do?"

I decided when I first sat down for the Tutorial I wanted a code that would save 50 heroes, 100 levels, 6 items on the hero, Default Max Gold and Max Lumber, also creating a simple method to ensure the code is good with a checksum.

If you read Part 4, in the FAQ section, you will see the list of what it can really handle by default.

Q. How large of numbers can this thing handle? By Default? With simple Modifications?

A. 1295 Heroes, Levels, and Items. 1.6 mill gold and lumber. You can go as large as the integer system will allow though for the items. But I doubt you would go beyond 46655 for items, heroes, levels, and other small things, thats just 3 slots for each item. While gold and lumber I could see going till 5 or 6 slots in some maps. Thats easy for the code to handle by just changing Slots variables in the Initialization trigger.

Notice it even mentions where you can change the size of stuff stored!!!

[beginrant]

This is why I am frustrated with this topic. Alot of people send me messages without reading the entire article, or they are reading it once, then sending questions without reading it again for better comprehension. I spend plenty of time sending quotes, links and pointing out the obvious. I actually have a 1.01 version of the SaveLoad code BTW, but I know posting it (It has a ton of advanced and extra triggers and sample codes in it) will result in more obvious or grossly uneducated questions. One of the biggest pet peeves is people sending PMs when they dont even understand the basics of triggers and map making.

So please, in the future. Learn the basics of triggers first, read the article more than once for comprehension (If youre one of those people that cant read a computer screen slowly, print it out). Then if you cant find anything about what youre asking in the tutorial (Especially in the FAQ section) by all means send me a PM. You wouldnt want me to ask you a question because I didnt want to take the time to read all the info posted, would you?

[endrant]
 
K

Knyves

Guest
***Attached is the SaveLoadCode.W3X map. You can copy anything you see in the map, but make sure to always give credit please.***[/QUOTE]

This prettymuch sums up the whole thing. Thanks for the trigger(s). :D
 

United

New Member
Reaction score
1
I was wondering if this save/load tutorial would end up working/save hero spellbooks. For example, in my map each hero has spellbooks. If I implement this, will the spellbooks be saved in the code?

I just wanted to ask before I set this whol thing up and then it ending up not working.

edit: I copied and pasted into my map from the demo map you provided. It works well after adding my heroes and items to the triggers. One thing, though. When I -save, then -load and it says something along the lines of "You can't load, but we can check your code to see if it works." and it always says Load Unsuccessful, even if I quit, restart, type in my code, and it works.

Also, I'm using an Equipment spellbook in which your items get equipped to so there's more room in the inventory for other stuff. Is there a way I could get that spellbook's info saved, too? Right now, the loading/saving screws up my equipment spellbook.
 
K

Knyves

Guest
I just asked a question about it, but I realized I could figure it out from the tutorial map. I have to edit it because I can't delete it... I feel like such a douche...
 
N

Naminator_X_

Guest
Guys i have little error here...i save my char...it save it's awesome good work Effane...so let's go to problem...first i copy and paste everything with the variables(WE function you know :) ) and test the map i saved it and restart...i type load code but nothing...i told my self hmm...let's see the triggers...i saw the trigger that spawns the hero...i had change the region to existing one but...when i load it up...my hero didn't spawns anywhere...oh and i copy only the SaveLoadEngine category....

Sorry for my bad english :(

EDIT: here is the link to my map.If anyone want's to see what i had done http://www.thehelper.net/forums/showthread.php?t=42728
 
D

Dark_Onix

Guest
Hey effane,could it be possible that you add player specific?I must admit this is great work but people tend to borrow/steal codes and it change the lenght of the game.
 

Arkan

Nobody rides for free
Reaction score
92
Is there a way to prevent item duplication abuse? I figure saving the playername might help, but it's not 100% protective, any other suggestions?
Great tutorial by the way.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top