• 🏆 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!

Save load code question

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
have something what convert the numbers to string or everybody use a long string and use replace methode?

(i mean example my hero lv 96 and i got a 20 character long string, then i divide the 96 with 20 and result is 4 so 4th character from string the 1st letter, then the 96 mod 20 result is 16 and 2nd character from code the 16th character, output 4th+16th string character)

or its work different way? (yes have alot save load system but all in jass what isnt my language :D)

another question have a limit how much integer could i save?

example i can save 15 number like:
10 gears (integer 50-1200)
hero lv (1-100)
misc1 (0-99)
misc2 (0-99)
gold
lumber

or what is the limit?
 
Level 8
Joined
Sep 23, 2007
Messages
357
Just make a system where, when a character is saved, a code is given to the player containing all the information of his hero

I.E. if the hero is the 4th hero type and he is level 32, he has 3200 gold, 87 strength, 92 intellect, 56 agility, and an Item that you decide its ID is 24 in slot 1 of his inventory and Item ID 12 in his inventory slot 2
The player will recieve a code like:

4-32-3200-879256-24-1-12-2

This contains all the information on the player's hero. Then in the load trigger just create the hero and give him everything in the information that the player had typed in when typing in his -load code. You would also be able to optimize this system so the code is shorter and there are less dashes in it.

Now all you have to do is encrypt the code so that players cant mess with it and you have a functional system.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Just make a system where, when a character is saved, a code is given to the player containing all the information of his hero

I.E. if the hero is the 4th hero type and he is level 32, he has 3200 gold, 87 strength, 92 intellect, 56 agility, and an Item that you decide its ID is 24 in slot 1 of his inventory and Item ID 12 in his inventory slot 2
The player will recieve a code like:

4-32-3200-879256-24-1-12-2

This contains all the information on the player's hero. Then in the load trigger just create the hero and give him everything in the information that the player had typed in when typing in his -load code. You would also be able to optimize this system so the code is shorter and there are less dashes in it.

Now all you have to do is encrypt the code so that players cant mess with it and you have a functional system.

maybe u dont understanded what i tryed ask....
since all information must be coded (else somebody easily could cheat with load codes) must have a limit, this effected also from how much data i want code/decode.

example:
string="1234567890abcdef"
herolv=50
herogold=100000
----code the hero level to save code function------
=>herolvcode=32
=>herogoldcode=0186a0
outputcode=herocode+"-"+herogoldcode
-----output: 32-0186a0
this is only with 2 number, but if i want save many thing then save code longer and longer and i think have a limit when i type in chat also question have a easier methode how could be better the code coz still this load code not too safe (i thinked to make more string and save the string id what i use in 1st place in savecode but then also its longer)
 
Level 8
Joined
Sep 23, 2007
Messages
357
maybe u dont understanded what i tryed ask....
since all information must be coded (else somebody easily could cheat with load codes) must have a limit, this effected also from how much data i want code/decode.

example:

this is only with 2 number, but if i want save many thing then save code longer and longer and i think have a limit when i type in chat also question have a easier methode how could be better the code coz still this load code not too safe (i thinked to make more string and save the string id what i use in 1st place in savecode but then also its longer)

If you dont want the code to be too long, then further optimize your code (encrypt it) and make sure the encryption is smaller. I.E. use more numbers converted to letters or other characters
 
Status
Not open for further replies.
Top