Warcraft III resources & community, 2003–2006 · archived

Save/Load system 1.5

not rated
Submitted by low-lifeSystems837 downloads43 KB
Screenshot
Screenshot
Allows to save and load heroes using codes.

Features: Saves Hero type, level, abilities, attributes(optional), inventory; player name dependant, has 12 bit checksum.
File Name
codes15.w3x
Author
low-life
Download

Comments

26
Well...
I can use triggers, but I can't use JASS very well, does this even works if i convert everything to JASS and then copy - paste, otherwise i need lots of time :(

proute.fr: Please someone tell me how to do it I really need a save/load code


Unless this saves exactly what you want it to save proute.fr, there is no point in you using this..because you have to be able to customize..and i take it you dont know how to..
> This save/load system may be more efficient if you make it able to save gold and lumber?
The idea is, _you make it_.
Look at the trigger CodeGenSaveAgi,
copy it,
name it CodeGenSaveGold,
in it change Size variable to some value (it will determine maximum maount of gold that can be saved; Size=12 - 4095 gold, Size=24 - 16777216 gold),
also change Value to gold of player.
Then look at trigger CodeGenLoadAgi,
copy it,
name it CodeGenLoadGold,
in it change Size variable to same value as in CodeGenSaveGold,
and set player gold to Value
Then add your two new triggers to InitCodeGenDefault.

>Also, may I ask whether it saves the number of item charges and item has?
Does not, you can make it save them. Althought that would probably increase code size dramatically.

>I don't really understand how to use it ...
You need at least basic knowledge of triggers to understand how to use it.
Please someone tell me how to do it I really need a save/load code :?
I don't really understand how to use it ...
I copied the first thing http://img207.imageshack.us/img207/2797/untitled3pt7.th.png but then I didn't understand what to do... can someone explain?
This save/load system may be more efficient if you make it able to save gold and lumber? Also, may I ask whether it saves the number of item charges and item has?
Damn you low-life. Every time I start to use your system, you come out with a new version. Don't get me wrong though, this is way easier to use than your past versions. And now it supports more than 64 items (I believe in one of your versions you said that more than 64 items could cause lag and crashes, which it sometimes did, but not always).

EmoEnigma, I find this system easier to use than neostorms. If I remember correctly, it didn't save abilities and had way more JASS than this. But I may be thinking of another system. Either way, this is way better. :D
System fully redone,it should be fairly easy to add your own code structures now.

EmoEnigma
I doubt you'll be able to use either. But yes i believe my system is better.
.Forsaken
I'd be glad to help you. (Notice: "help", not "do it for you"). How many spells are there? Do you know binary? Problem can be worked around by adding five more values describing what spells your hero has. So, basically, if you have 64 spells or less, that'd be 5 more characters.
256 or less - 7 characters.
^^ downloaded and tested new version.

Also took a look at the triggers, and I noticed one thing... :)

It seems like each hero must have a specific set of abilities that he uses, which will cause problems cause in my map hero's will be able to get all spells... (well, only 5 of them, but they get to chose)..

How would I work around that mate?
Oh and rebel rebel, those are some funky scripts :)
Im guessing he can write jass :roll:
SO is this better than neostorms?
cuse i know neostorms is nice or thats what iv herd
soo yeah input
i have yet to use either of these lol
updated..
It will always load the hero under the control of Player 1. Others can save. But no matter who types "-load" it will always give the hero to Player 1. I can find that problem at a glance. I've done it a lot in my maps, and the difficulty in fixing it can range fro "Well that was simple, why didn't I think of that?" to "AAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!" I can't make sense of your custom scipts, but you may just have to change who it gives the hero to and who's hero it saves. I think you just mised a line.

Sorry, I bet all this is all getting pretty old by now.
What is not multiinstanceable? All you have to do is add a few lines

__Edit__
Nevermind i did this.
Ok, my bad on that whole upper case/lower case thing. I misunderstood and thought you meant the lower case 'i' was disabled and the upper case 'i' were disabled, instead of the upper case 'i' and lower case 'L' as you meant (I think). I still have trouble with the 'O' and zero sometimes, but I just realized a small difference in their shapes, so I shouldn't have trouble with that any more. :D

And I see you fixed the random item problem. Just so people know, it happened whenever you changed the max hero level (at least that's when it happened for me).

And the unusually high atributes problem has been fixed as well. I found that it acured when I changed the hero level size to '2' while I had save atributes enabled. This is of course completely useless information, considering the fact that low-life already fixed all this. :(

Well, as of now I see no problems ocurring within this system. Bravo, you fixed it in a day. I hearby declare this the best save/load system I have ever seen.

And Bloodsnowman: As far as I can tell, there is no pre-existing trigger function to disable the default save/load system. You may want to make a request in the forums section. But be warned, if someone does make it, it will probably be in JASS. And as for the equip system, I've never played any of the Diablo games (yeah, yeah, I know, I'm shunned now) but there is a very well made equipment system. It's completely GUI, which means you only need a left mouse button to use it. This adress will take you to it: http://wc3sear.ch/index.php?p=Spells&ID=1721&sid=fad50b81108fed899fbd4e9efb4c2e3f I doubt it will work with this system though.

Anyway I got a little off topic, but again, best save/load sytem out there.

---Edit---

IT'S NOT MULTI INSTANCEABLE!!! Wtf. It's useless if only one player can use it. Well that shouldn't be to hard to fix, but every time I touch the triggers, I f**k something up, so I'll leave it you to fix. That is of course if you want to. It's your system after all.
There are _no_ bugs. Until someone posts buggy code, there are no bugs.

__Edit__
Also. SpanEtherX09 you're not competent enough to rank anyting. No one except yourself cares about your 3.5/5


__Edit__
Map updated, 5 skills ok, random item glich fixed.
i have to agree with emo enigma, i've been looking for a save/load system but since your's is limited to 4 spells there's no way i can use this since each of my heroes has 5 menus, containing a total of 45 options (In spell form). And also considering that the max # normally is 6 not 4 you should implement atleast 2 more spells and fix the few bugs already in the system.

despite the glitches/shortcomings...3.5/5
use your mind.
Oh sorry so use to making heros with 5 spells
okie umm how does this affect with units or heros
with a defualt ability
giving them a total of like 5 or so spells?
Also does this work with spell books
since spell books seem to be all the rave with upcoming games
Rebel_Rebel
> But contrary to what you said, it does use the upper and lower case 'i's.
It can't use "I" and "l". Simply impossible, but if you insist it happens, could you please be more specific? Provide a working code maybe?
> I don't know why you would have gotten rid of these in the first place;
My warcraft uses different fonts (to support my language), and "I" and "l" look completely alike.
> it's really the upper case 'o' and the zero that screw me up.
You can change characters used by map by changing variable named base (initial value - " 0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ/.-= "). Just make sure it's length is 64, or shit would happen.
> I came across a bug. Sometimes when you load a hero, it will give it a random item.
More specific please? Edited map or original? code please? I'll work on it this evening anyway. Thanks for pointing that out.

Bloodsnowman
> You know you go to region and you can save the game while main menu's default Save\Load options are disabled.
what?
> Otherwise i would also like an equip item system like in diablo series.
what?
- low-life

__Edit:__
Oh, nevermind, i get it. This is a request.

EmoEnigma
> i mean its great theres a save/load system that lets us save spells but a limit of 4 can ruin of things
Misundrestanding? Four skills for each hero. How much do you want? Originial game has four skills with max levels 3, 3, 3, 1 (compared to four skills with max 15, 15, 15, 7 here)

.Forsaken
> I'll probably learn some from this.
Probably not :( With state the map is in now, even for me it'd take much time to understand what happens where. New version pending, with most of code commented, so you better wait until that.
Why did you only choose 4 abilities?
i mean its great theres a save/load system that lets us save spells but a limit of 4 can ruin of things
This confusd me a little. I was looking for a system to save like in GTA Series. You know you go to region and you can save the game while main menu's default Save\Load options are disabled. Maybe you feel it a little useless but i would be happy if i would find something like that. Otherwise i would also like an equip item system like in diablo series. These two would finally finish my map, and i could release it for public. So. Low - Life, may i request these two :?:
-Bloodsnowman 8)
I came across a bug. Sometimes when you load a hero, it will give it a random item. Usually a Clarity Potion or Lesser Clarity Potion. Also, if you change certain things the heroes will load with more atributes than they should. I like this save/load most out of all the others because it saves ability levels, but if it has problems like this, it becomes unusable. Pleasem, please, try and find the source of these problems and fix them for us. :(
Mate... This is exactly what I have been looking for.
Seriously, thnx ;)

+ I'll probably learn some from this.
5/5 (I love that its max 22 chars, since thats a acceptable length imo)
It's the best save/load code I've seen so far. Mainly because it's the only one to save hero abilities. But contrary to what you said, it does use the upper and lower case 'i's. I don't know why you would have gotten rid of these in the first place; it's really the upper case 'o' and the zero that screw me up.

Anyway, 5/5, best save/load code I've ever seen. Definately usin' this puppy. :D
Has some JASS functions, but to use system you don't need to know anything.
1. Copy triggers and variables used by map. Don't forget to copy this:
http://img159.imageshack.us/img159/4728/untitled2ks2.th.pnghttp://img207.imageshack.us/img207/2797/untitled3pt7.th.png
2. Add your heroes:
- -Set CodeUnitType to type of hero to be added
- -Set CodeAbilitiy1, CodeAbilitiy2, CodeAbilitiy3 and CodeAbilitiy4 to abilities of hero.
- -Run CodeAddHero trigger
- -Repeat until satisfied
3. Add your items:
- -Place items used in map into CodeItems region
4. Modify save/load commands, so that you can't have two heroes, or something (this is a test map).

Limits for default code generator:
- Hero level:
- - 511
- Hero types:
- - 8
- Abilities: Two modes:
- - five abilites, max levels are: 15, 15, 15, 15, 15
- Items:
- - 64
- Attributes:
- - 255

Technical:
- 0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ/.-=
- each character = 6 bit.
- Crc 12 bits, key: (12,11,3,2,1,0) = 0xc07 = 3097
- After generating code and applying crc, map encrypts (xors) the code with player-name dependant key, making it impossible to load other players' characters.

Default code structure:
- 3 bits: hero type
- 9 bits: hero level
- 20 bits: levels of abilities
- 3 bits: amount of items carries by hero (technically max 7 items, but..)
- 6 * (amount of items carries by hero) bits: items
- 24 bits: attributes
- 12 bits: checksum

To create your own code structure:
- -Change encryption and code-deneration values.
- - - -http://img245.imageshack.us/img245/9219/0hf0.th.png
- -Find InitCodeGenDefault function.
- - - -http://img109.imageshack.us/img109/149/2eo5.th.png
- - - -it contains definitions for triggers responsible for code generation.
- -Add your own save funcions:
- - - -http://img155.imageshack.us/img155/8453/3kd4.th.png
- - - -on image, you see function saving level. It sets variable Size to 9, meaning max level will be 511 (see below), and sets Value to level of Unit, where Unit is hero being saved.
- -Add your own load funcions:
- - - -http://img155.imageshack.us/img155/1112/4fh5.th.png
- - - -on image, you see function loading agility. It consists of 2 parts. In first part, which is run when firstpass variable is set to true (save trigger sets itto true or false, you don't need to change it), this function sets Size variable to same value as it did for save function. In second part, necessary actions for loading are carried out, like creation of units, or, like on image, setting agility of hero.
- -Enjoy.


- - - - -Size variable:
- - - - - -The more this variable is, the more saved value can be (and code longer, too). For example, if Size = 5, max size of Value is 31
- - - - - - -Size = 0 =====> max value = 0
- - - - - - -Size = 1 =====> max value = 1
- - - - - - -Size = 2 =====> max value = 3
- - - - - - -Size = 3 =====> max value = 7
- - - - - - -Size = 4 =====> max value = 15
- - - - - - -Size = 5 =====> max value = 31
- - - - - - -Size = 6 =====> max value = 63
- - - - - - -Size = 7 =====> max value = 127
- - - - - - -Size = 8 =====> max value = 255
- - - - - - -Size = 9 =====> max value = 511
- - - - - - -Size = 10 =====> max value = 1023
- - - - - - -Size = 11 =====> max value = 2047
- - - - - - -Size = 12 =====> max value = 4095
- - - - - - -
- - - - - - -Size = i =====> max value = 2^i - 1

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

It'd be nice if you somehow informed player that save/load system used in map is made by lowlife and is freely available. Although i'm not requirying that. You may not credit me at all if you want.