Save/Load Code, Yet Another

Cool tut :p Looks simpler than most of 'em.
Anyway - you still didn't answer that final question. All I see there are some dots... :p
 
> the initialization Inside ... random level / gold. that's the one I ment.

Oh.
Yeah, that one's definitely not needed.


> a code to save str / agil / int or learned abilities.

Learned abilities are a complete pain to save. Or load.
Though there is an example...

Players should be happy already to get a Hero back with the same level! :p


Set Save[1] = the Hero
Set Save[2] = Experience of <Hero>
Set Save[3] = Strength of <Hero>, ignoring bonuses
Set Save[4] = Agility of <Hero>, ignoring bonuses
Set Save[5] = Intelligence of <Hero>, ignoring bonuses
Set SaveCount = 5


Once it's loaded back:
Create a unit from Save[1],
set its experience to Save[2],
set its strength permanently to Save[3],
...


> that final question.

Did I miss one? Which one?
 
You can save the learned abilities of the hero much like you would save an item in inventory that has charges.

Just search for a match in a pregenerated array of abilities, or you dont even need the array if the ability is preassigned to the hero (IE, ability 1 is always a Heal for Paladin Hero). Just takes more character slots to save (Even though there are tricks to make it take less space up, such as number compression). After the ability is matched, add an extra number at the end of the code for the level #. This will make code alot longer unless you compress it somehow.

Loading is a bit more fun and with the flexibility of Aceharts code it could get complicated to say the least.


Well very good work Acehart. Its definitly your usual great standard.
 
> it could get complicated to say the least.

Well, like I said, I provided an example that saves abilities and their level.

Then again, this is a save / load code... which is definitely not just "copy and use"...
 
Lol, Aceheart, A funny way to introduce something as always :)
 
Wait, so what you did here is made it so you stroe information in one game and you can open it in another? If so, I didn;t understand how you opened it in the other map, thus how did you transfer the integers between 2 different maps??
 
Ever used or seen some "save / load" code?

Somewhen in game, you type "-save".
On screen, you'll get some weird bunch of letters, like A123-BC45-DEF6.

Next time you start that same map, you type "-load A123-BC45-DEF6".
And, whatever information was stored in that code is recreated.
 
Yup, that's what I thought you did, thanks, but what I don't understand is how can you transfer information in one game to a whole other game, even if they are the same type.
 
Cread a base where all the information is stored. Let's say you have 10 heroes on your map.

Store those heroes use an array, let's call it Hero Array.

So we store all 10. Now when the person types save, we pick their heroes, go thru a for loop for all of the heroes we have stored and set tempinteger to forloop when the stored hero equals the picked hero.

After this, code's begin to vary. Acehart's code uses JASS to convert this unit to an integer. From there, he encodes it uses the encoder function so that people don't see the actual code and so people can't crack it very easily, then he displays it.

Many people do it differently. The code display is also based on an alphabet. The greater the alphabet, the smaller the code. Most codes generally have an alphabet of 36 characters, this way the code uses a base of 36. This means one digit in the code can hold 36 possibilities. 2 Digits can hold 36*36 possibilities.

= )

When the player is in another game and loads up the code, it takes in the code, decrypts it using the decryptor. From there, it just takes out all the information. It looks at the tempinteger we set earlier and goes to heroarray[tempinteger] and creates a hero of that type

Get it now? : )
 
So, if I wanted to store a couple of integers (scores; wins and losses), and placed them in a multiboard when loaded, I don't understand how I could make that happen.
How, after loaded, would I derive the two integers from the code? How would I place them into the mutliboard?
 
> after loading, would I derive the two integers from the code?

No, of course not.

If you start with, for example
Set Save[1] = 17
Set Save[2] = 25
Set Save[3] = 42

And get a code from this, then "-load" of that code will
set Save[1] to 17, Save[2] to 25 and Save[3] to 42.
 
> after loading, would I derive the two integers from the code?

No, of course not.

If you start with, for example
Set Save[1] = 17
Set Save[2] = 25
Set Save[3] = 42

And get a code from this, then "-load" of that code will
set Save[1] to 17, Save[2] to 25 and Save[3] to 42.

So, the "-load ##LLetc" sets those variables, right?
What happens when two people set it at the same time? Or is it not MPI?
 
Well, the "-load" trigger takes the code you typed, and restores the "Save" array from that.
Once the decoder function got back (have a look at the sample triggers), you're supposed to do something with the values you got in that "Save" array.

And, if a second player uses it?
Well, given "Save" is a global array, the second load will overwrite the values of the first.

But, given you already used the values of the first, that's no problem.

Just don't ever add any "wait" actions in the load trigger.

Triggers always run in the order their events happened.
And they also always finish their actions before a second trigger (or the same one one more time) starts to run.
Unless there is a wait action. A which point the current trigger will stop and all others that are currently waiting for some execution time will run.


You have no need to wait anyway, call the decoder, put the values you get back into your usual arrays, update the multiboard, done... nothing to worry there.
 
Hi, i am trying to make a save load code based on yours. However, i cannot get a few custom scripts to work.
for eg.
Code:
function Trig_SaveLoad_Save_All_Func010A takes nothing returns nothing
    // Save the Hero
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_TempUnit = GetEnumUnit()
    [B]set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )[/B]
    // Hero Experience
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = GetHeroXP(GetEnumUnit())
    // Hero Position X
    set udg_SaveCount = ( udg_SaveCount + 1 )
    set udg_Save[udg_SaveCount] = R2I(GetLocationX(GetUnitLoc(GetEnumUnit())))
    // Hero Position Y
when i tried to enable the trigger, the bold part will be said to be 'expected a name'.

I have tried to fix it to the best of my knowledge but to no avail. Any help would be appreciated.

P.S. Your save/load code rocks!
 
yes i did. I even tried changing it a bit. Still does not work. for this
Code:
SaveLoad_Unit2Integer
, is that a variable?
 
> is that a variable?

No, that's one of the functions in the custom script section (what you get when clicking on your map's name at the very top of the trigger list).

Other than that, that line expects three existing global variables:
Save, an array of type integer,
SaveCount, an integer,
TempUnit, of type unit.
 
its there already. it still gives a 'expected a name' error.
 
Wow thanks so much

Thank you for writing the code. I am now going to make an rpg using it. :p so yha thanks. I haven't found anything wrong with it yet.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
  • The Helper The Helper:
    It will only be on internal network

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top