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

[General] A Very Simple Save/Load System

Status
Not open for further replies.
Level 6
Joined
Mar 6, 2010
Messages
116
Hi,I need a very simple save/load system,but I dont know how to put.
Here is what it'll do:My maps type is hero arena,and the thing that will be saved is rank,deaths and kills.Creeps has a chance to drop a rank up item,when you use it it upgrades your rank once and when you save,the rank will be saved.And please mak it save player name,so people won't steal others codes.Can someone help me to make it?
 
Last edited:
Level 9
Joined
Jul 10, 2011
Messages
562
i dont wanna be rude but saving just an integer value make a code that is much to easy and so everybody who knows save load system just a bit will load max level from the beginning without ever reached it....just a tipp..
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I'm not going to make the save/load system for you.

Did you try doing the exercises aarcaa? If you just blaze through it w/o doing the exercises, you'll get lost later on. Make sure you can do the exercises without any problems before moving on.

The exercises give you the correct answers with the steps to get there as well if you get them wrong.

For example, what is a base? What is 93 in base 8 (01234567)? Answer: 135

If you have 2 values of 3 and 7 with maxes of 15 and 12, what would those two values as one value be? Answer: 46.

Given the maximums 3, 4, and 5, what are the numbers that make up 59? Answer: 2, 3, 4
 
Level 6
Joined
Mar 6, 2010
Messages
116
I copied and editeed it a little,but when i try to load the code it always says "Invalid code"

Here Are The Riggers :
  • CG Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ----------------- --------
      • -------- Characters used in the code. --------
      • -------- ----------------- --------
      • Set Alphabet = KvMuhyS1ncY@CP&Odx5jQLeIJt0$XNlpTaBm4rizVo6GE#sAwHD28kUf3FbRq%9Z7gW
      • -------- ----------------- --------
      • -------- Charactor Color Pattern --------
      • -------- ----------------- --------
      • Set UPPER_CASE_COLOR = |c000080C0
      • Set LOWER_CASE_COLOR = |c0000FF00
      • Set OTHER_CHARS_COLOR = |c00FF0000
      • -------- ----------------- --------
      • -------- Save the players name? --------
      • -------- ----------------- --------
      • Set SavePlayerName = True
      • -------- ----------------- --------
      • -------- Heroes that can be saved --------
      • -------- ----------------- --------
      • Set HeroCount = 0
      • -------- ----------------- --------
      • -------- Items that can be saved --------
      • -------- ----------------- --------
      • Set ItemCount = 0
      • -------- ----------------- --------
      • -------- Do not modify below this line. --------
      • -------- ----------------- --------
      • Set LOAD_VALID = False
      • Set Compress = TriggerHappy187
      • Custom script: call CG_Init()
      • Set Base = (Length of Alphabet)
      • Set SAVE_FAIL_REASON = <Empty String>
      • -------- ----------------- --------
      • -------- ----------------- --------
      • -------- ----------------- --------


  • CG Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Players Gold --------
      • -------- ----------------- --------
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • -------- ----------------- --------
      • -------- Compile and Display the code --------
      • -------- ----------------- --------
      • Custom script: call CG_Execute()
      • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code
      • -------- ----------------- --------
      • -------- ----------------- --------


  • CG Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
    • Conditions
    • Actions
      • -------- ----------------- --------
      • -------- Prepare to load --------
      • -------- ----------------- --------
      • Custom script: call CG_Load(SubString(GetEventPlayerChatString(), 6, 999))
      • -------- ----------------- --------
      • -------- Check if load is valid --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LOAD_VALID Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: Your code was inval...
          • Skip remaining actions
        • Else - Actions
      • For each (Integer A) from 1 to Load[LoadCount], do (Actions)
        • Loop - Actions
      • -------- ----------------- --------
      • -------- Players Gold --------
      • -------- ----------------- --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- ----------------- --------
      • -------- ----------------- --------
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
The only difficult part of making a save/load system is the conversion back from character to integer as unless you use hashtables it will have an O(n) complexity.

The idea is prety simple.

Saving does the following...
Parameters (integers) -[base conversion]-> Character Indicies -[character map]-> String

Loading does the following
String -[character map]-> Character Indicies -[base conversion]-> Parameters (integers)

Even Nestharus's one which at times is needlessly complicated follows those principles. Most of his save system is a parameter compression system which translates into a single vectorised integer that is translated in a single opperation to a code with some additional crypteography techniques.

Usually the Character Indicies part is masked through a pipe in the implementation (moved through next step as computed).
 
Level 4
Joined
Aug 26, 2012
Messages
123
Well, if you just want to save/load from the same game you play, I think you can use this
(Just a theory though, I'll test it later)
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Checking which player is saving --------
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (Player((Integer A)))
            • Then - Actions
              • -------- I'm using the built-in Player index to define this. (Never used it, though) --------
              • -------- You can also define set your own Player Index variables --------
              • -------- Set the attribute you want to save to the saving area variables --------
              • Set PlayerGold[(Integer A)] = ((Player((Integer A))) Current gold)
              • Set PlayerRank[(Integer A)] = UnitCurrentRank[(Integer A)]
              • -------- (You can add more...) --------
            • Else - Actions
              • Do nothing
And for loading:
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (Player((Integer A)))
            • Then - Actions
              • Player - Set (Player((Integer A))) Current gold to PlayerGold[(Integer A)]
              • Set UnitCurrentRank[(Integer A)] = PlayerRank[(Integer A)]
              • --------(You can add more...)--------
            • Else - Actions
              • Do Nothing
Please don't mad at me if it doesn't work. Just a theory and concept...
(Forgive me too! And look, there's me on the trigger! And you can remove the Do Nothing action, since it's do nothing...)

As for leave the game and come back, It'll need to make an external file...
 
Level 4
Joined
Aug 26, 2012
Messages
123
Please don't give up! I don't like give ups... Maybe we can solve it together, either publicly or privately...
(yeah, by giving up, you can't go advance! Don't give up to the end....)
 
Status
Not open for further replies.
Top