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

my save/load system doesnt work :(

Status
Not open for further replies.
Level 6
Joined
Sep 28, 2009
Messages
222
hi guys

i got some big problem. i just finished an early version of my save load system, but it doesnt work. when i save the hero and then load it directly after the saving, so without restarting the map, all works fine. but if i save the hero, then restart the game and then load it, it says he couldnt find the entry. but i thought bank files are exactly made for this case? it seems like the bank file gets deleted after map restart? oO

save trigger:

  • save hero
    • Events
      • Dialog - Any Dialog Item is Clicked by Player Any Player
    • Local Variables
      • player = (Triggering player) <Integer>
    • Conditions
      • (Used dialog item) == herosavedialogbutton
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • hero[player] != No Unit
        • Then
          • Bank - Open bank "World of Starcraft SAVEFILE" for player player
          • Bank - Store unit hero[player] as "hero" of section "heroes" in bank (Last opened bank)
          • Bank - Save bank (Last opened bank)
          • UI - Display a Message custom dialog with Title "Success" and Text "Your hero was saved." for (Player group(player)) (Unpause game)
        • Else
          • UI - Display a Message custom dialog with Title "Warning" and Text "WARNING: YOUR HERO COULD NOT BE FOU..." for (Player group(player)) (Unpause game)
load trigger:

  • load hero
    • Events
      • Dialog - Any Dialog Item is Clicked by Player Any Player
    • Local Variables
      • player = (Triggering player) <Integer>
    • Conditions
      • (Used dialog item) == loadhero
    • Actions
      • Bank - Open bank "World of Starcraft SAVEFILE" for player player
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Bank (Last opened bank) has "hero" in section "heroes") == true
        • Then
          • Bank - Restore "hero" of section "heroes" from bank (Last opened bank) for player player at (Center of Cosmozang) facing 0.0
          • UI - Display a Message custom dialog with Title "Success" and Text "Your hero was loaded!" for (Player group(player)) (Unpause game)
        • Else
          • UI - Display a Message custom dialog with Title "Error" and Text "Error: No saved hero was found. If ..." for (Player group(player)) (Unpause game)

so again: it works all fine without restarting the map, but if i restard he cant find the entry.
so whats wrong with this? :(

Edit: i think i got it to work. you must preload the bank file on map init, otherwise it doesnt work

  • preload heros
    • Events
      • Game - Map initialization
    • Local Variables
    • Conditions
    • Actions
      • Bank - Preload and synchronize bank "bank" for player 0
      • Bank - Preload and synchronize bank "bank" for player 1
      • Bank - Preload and synchronize bank "bank" for player 2
      • Bank - Preload and synchronize bank "bank" for player 3
      • Bank - Preload and synchronize bank "bank" for player 4
      • Bank - Preload and synchronize bank "bank" for player 5
      • Bank - Preload and synchronize bank "bank" for player 6
      • Bank - Preload and synchronize bank "bank" for player 7
      • Bank - Preload and synchronize bank "bank" for player 8
      • Bank - Preload and synchronize bank "bank" for player 9
      • Bank - Preload and synchronize bank "bank" for player 10
      • Bank - Preload and synchronize bank "bank" for player 11
      • Bank - Preload and synchronize bank "bank" for player 13
      • Bank - Preload and synchronize bank "bank" for player 14
      • Bank - Preload and synchronize bank "bank" for player 15
the strange thing now: if i do this in a loop, it wont work:

  • preload heros
    • Events
      • Game - Map initialization
    • Local Variables
    • Conditions
    • Actions
      • Player Group - Pick each player in (All players) and do (Actions)
        • Actions
          • Bank - Preload and synchronize bank "bank" for player (Picked player)
i also tried it with a normal loop and with "active players", no difference. dont ask me why but you must do it like in the first example oO
 
Last edited:
Level 6
Joined
Sep 28, 2009
Messages
222
i might try it later, but i still dont get it. wtf is the difference between this 3 methods?

1)

  • sync bank
    • Events
      • Game - Map initialization
    • Local Variables
    • Conditions
    • Actions
      • Bank - Preload and synchronize bank "bank" for player 0
      • Bank - Preload and synchronize bank "bank" for player 1
      • Bank - Preload and synchronize bank "bank" for player 2
      • Bank - Preload and synchronize bank "bank" for player 3
      • Bank - Preload and synchronize bank "bank" for player 4
      • Bank - Preload and synchronize bank "bank" for player 5
      • Bank - Preload and synchronize bank "bank" for player 6
      • Bank - Preload and synchronize bank "bank" for player 7
      • Bank - Preload and synchronize bank "bank" for player 8
      • Bank - Preload and synchronize bank "bank" for player 9
      • Bank - Preload and synchronize bank "bank" for player 10
      • Bank - Preload and synchronize bank "bank" for player 11
      • Bank - Preload and synchronize bank "bank" for player 13
      • Bank - Preload and synchronize bank "bank" for player 14
      • Bank - Preload and synchronize bank "bank" for player 15
2)
  • sync bank 2
    • Events
      • Game - Map initialization
    • Local Variables
      • playerid = 0 <Integer>
    • Conditions
    • Actions
      • General - For each integer playerid from 0 to 15 with increment 1, do (Actions)
        • Actions
          • Bank - Preload and synchronize bank "bank" for player playerid
3)

  • sync bank 3
    • Events
      • Game - Map initialization
    • Local Variables
    • Conditions
    • Actions
      • Player Group - Pick each player in (All players) and do (Actions)
        • Actions
          • Bank - Preload and synchronize bank "bank" for player (Picked player)
i mean in theory all methods are EXACTLY the same.

PS: does anyone know a bit more about the bank feature? the editor tells me that its an xml file. were is this file saved exactly? i couldnt find any .xml file in the sc2 folder. would be good to know a bit more about this to avoid hero copying^^
 
Level 4
Joined
Jul 2, 2007
Messages
53
i might try it later, but i still dont get it. wtf is the difference between this 3 methods?

um the problem is, that some loops will not work correctly inside Map Initialization trigger!

u need to get them out in another trigger,and launch that trigger via run trigger action

Also use only one trigger with map initialization event , to avoid problems.
 
Level 6
Joined
Sep 28, 2009
Messages
222
In the loop is the "bank" in bank"bank" supposed to be the players number in an array? If so you might be causing 1 bank to be synchronized to every character

um? sry i dont get it.

@CEMEH_CEMEHbl4

hm ok, have you any proof for this?
just because i got quite alot different triggers on map init, mostly for initalizing dialogs and stuff, all works well. addicionally it didnt work on time elapsed = 0 either.
 
Level 9
Joined
Jun 7, 2007
Messages
195
Strange that you can't get it to work. I tested Banks as the very first things when I got my hands on the editor and it worked at first attempt.

I simply saved couple of strings into bank, then loaded the strings and outputted whatever I managed to load using 'Text Message to All Players...'

And as it worked for that type of data there should be no problems with anything else, unless it's a bug. I will test again using units and tell you how it went...
 
Level 4
Joined
Jul 2, 2007
Messages
53
just because i got quite alot different triggers on map init, mostly for initalizing dialogs and stuff, all works well. addicionally it didnt work on time elapsed = 0 either.
lol, are you seriously put Event-Map Init on every trigger?
how editor should detect which map init to run first?

yes it detect,but sometimes it fail especially if 1 or 2 map init still in memory

---------------
yes, i experienced problems by putting a loop, on map init
 
Level 6
Joined
Sep 28, 2009
Messages
222
@Wezthal

it works fine, but only if i preload the bank for all players without a loop xD

btw: did you restart the map after saving values to your bank? because if i dont restart the map i can also load values from the bank without preloading it first.

@CEMEH_CEMEHbl4

yes, why not?
the editor exectues the triggers like they are in the editor, so the trigger that stands at top will be executed first and so on. the only problems on map init that i personally knew were in the wc3 editor if you wanted to init dialogs etc at map init, that wasnt possible but was also told in the editor itself.
 
Level 9
Joined
Jun 7, 2007
Messages
195

Attachments

  • n1.JPG
    n1.JPG
    7.7 KB · Views: 125
  • n2.JPG
    n2.JPG
    39.7 KB · Views: 165
  • n3.JPG
    n3.JPG
    81.2 KB · Views: 154
Level 9
Joined
Jun 7, 2007
Messages
195
English ain't my native language either, but it's an understandable reason. However, most pieces of text are there for a reason and if there's something you don't understand you should check it right away, especially when it's about technical stuff, as in this case it does make a difference, hehe.
 
Level 2
Joined
May 15, 2008
Messages
22
PS: does anyone know a bit more about the bank feature? the editor tells me that its an xml file. were is this file saved exactly? i couldnt find any .xml file in the sc2 folder. would be good to know a bit more about this to avoid hero copying^^
I think that hasn't been answered yet:
Banks are saving in your Documents-folder (same folder where replays, screenshots, etc are saved). However, it only appears if you run the action "Save Bank".
If you run that action a *.SC2Bank file will appear in your SCII folder, which is basically nothing else than a renamed XML file.
If you don't save the bank, then it'll be temporarily stored somewhere.


hehe yeah i read it, but im german so i didnt understand what "literal" meant xD

however, its the final explanation for the strange problem, thx. (even if it quite sucks^^)
Das in einem online Wörterbuch nachzuschlagen ist nun wirklich nicht schwer :p
 
Last edited:
Level 6
Joined
Sep 28, 2009
Messages
222
I think that hasn't been answered yet:
Banks are saving in your Documents-folder (same folder where replays, screenshots, etc are saved). However, it only appears if you run the action "Save Bank".
If you run that action a *.SC2Bank file will appear in your SCII folder, which is basically nothing else than a renamed XML file.
If you don't save the bank, then it'll be temporarily stored somewhere.

ok this really sucks. i just found my bank for my map, and i could simply open it with editor and edit EVERYTHING like i wanted to. its not even encoded... blizzard should fix this, otherwise every idiot can edit his heroes like he wants oO
 

Attachments

  • bank opened.JPG
    bank opened.JPG
    87.3 KB · Views: 242
Level 12
Joined
Apr 15, 2008
Messages
1,063
If it was encoded, there would already have been a program that allowed anyone to decode and edit it. (Such program would be created within a week after release of the editor). This way, everyone will be forced to create custom encoding methods, and cheaters will have to break the algorithms over and over.
Also, creating an encoding script is really not that hard.
 
Status
Not open for further replies.
Top