HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with your save/load system

01-20-2006, 12:21 AM#1
Das Jank
Hey vexorian, remember me from long ago? Well anyways I started on a save/load code type rpg a long time ago and ive always wanted to finish it but could never figure out how to make a complex code that wouldn't be easy to crack without being crazy long. Anyways I came across your save/load system HERE but I was wondering if there is any easy way to implement experience saving in it instead of only level? My knowledge on triggers is pretty good but my JASS is almost none.... any help would be greatly appreciated, thanks!
01-20-2006, 12:27 AM#2
Vexorian
well it only requires JASS experience for calling the encoding/decoding functions, for storing / reading values you can use GUI to modiffy/ check the array.

And because experience is often a very high number, I think that the best way would be to calculate the experience required for next level (Y). And the experience required for current level (X). Then calculate a percentage (so it will have a fairly low range and take less bit space)

If Current experience is Z The Percentage would be : ((Z-X)/(Y-X))*100

when saving you store that percentage and the level number.

When loading you take the level number and get X and Y for that level again. you already have the percentage so what you want to get is Z

If you use equations:

Z= ((P*(Y-X))/100) + X

The only problem would be calculating X and Y that depends on gameplay constants but you can manually get the ones for your map and keep them in an array or something
01-20-2006, 12:44 AM#3
Das Jank
Hmm it might be a little much for me but ill mess around with it and see what I can do, maybe ill even learn a little JASS in the process. By any chance are you planning on adding an experience part to it in the future version?
01-20-2006, 12:54 AM#4
Vexorian
the problem is that it would either take too much space or depend on the map's gameplay constants
01-20-2006, 04:46 AM#5
Das Jank
Hmm im a bit lost here, I figured out to each level is requires 100 more experience then the last level... sooo....
Code:
Level      Overall Exp      Experience Needed
   1              0                       200
   2              200                    300
   3              500                    400
   4              900                    500
   5              1400                  600
   6              2000                  700
   7              2700                  800

My problem is that your equations dont seem to fit right but im prob just being a moron. Im trying to figure out how to find the current levels exp and next levels exp through an equation also but for some reason it wont come to me. The only way I cant pull out of my head right now is to run a trigger:

Code:
x= current level
z= overall exp

    Actions
        Set x = (Hero level of (Triggering unit))
        For each (Integer A) from 1 to x, do (Actions)
            Loop - Actions
                Set z = (z + (100 x (x + 1)))
                Set x = (x - 1)

err I think thats right.... and then to find the current exp i could just subtract 1 from x before it loops.

Also any tips on how I could implement it into your JASS so that it could somehow run at the same time and maybe tack it onto the end of the code and remove the plain hero level part of it?
01-20-2006, 05:26 PM#6
Ragnarok X
You can use this formula for overall exp: (lvl-1)*(lvl+2)/2*100

Level 7 example:
(7-1)*(7+2)/2*100 = 6*9*50 = 54*50 = 2700

You can use this formula for exp needed: (lvl+1)*100

Level 7 example:
(7+1)*100 = 8*100 = 800

You can use this formula for overall exp + exp needed (next lvl exp): lvl*(lvl+3)/2*100

Level 7 example:
7*(7+3)/2*100 = 7*10*500 = 70*50 = 3500