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

[Trigger] Game Cache problem

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,182
hi, when I try to use game cache in my campaign it crashes.
I got 2 maps, when I go from map 1 to map 2 it does work every unit is transfered.

however when I want to go back (from map 2 to 1) it crashes and brings me back the chapter selection.

  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from CommonCache.w3v
      • Set CommonCache = (Last created game cache)
      • Set LoadingFrom = left from cave <gen>
      • Trigger - Turn off (This trigger)
  • start
    • Events
      • Game - A saved game is loaded
    • Conditions
    • Actions
      • Game - Display to (All players) the text: loads
      • Game Cache - Create a game cache from CommonCache.w3v
      • Set CommonCache = (Last created game cache)
      • Trigger - Run load <gen> (ignoring conditions)
  • go to map 2
    • Events
      • Unit - A unit enters Go To Cave <gen>
    • Conditions
    • Actions
      • Set LeftFromMap = 1
      • Set count = 0
      • Set your_army = (Units owned by Player 1 (Red))
      • Game Cache - Clear all labels of Units in CommonCache
      • Unit Group - Pick every unit in your_army and do (Actions)
        • Loop - Actions
          • Set count = (count + 1)
          • Game Cache - Store (Picked unit) as (String(count)) of Units in CommonCache
          • Unit - Remove (Picked unit) from the game
      • Game Cache - Store Peasant 0025 <gen> as Hero of Units in CommonCache
      • Game Cache - Store count as count of Variables in CommonCache
      • Game Cache - Store LeftFromMap as LeftFromMap of Variables in CommonCache
      • Game Cache - Store Map2NewGame as Map2NewGame of Variables in CommonCache
      • Game Cache - Save CommonCache
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Map2NewGame Equal to True
        • Then - Actions
          • Game - Save game as main.w3z and change level to TotSC3B.w3x (Skip scores)
        • Else - Actions
          • Game - Save game as main.w3z and load cave.w3z (Skip scores)
  • load
    • Events
    • Conditions
    • Actions
      • Game Cache - Reload all game cache data from disk
      • Set LeftFromMap = (Load LeftFromMap of Variables from CommonCache)
      • Set Map2NewGame = (Load Map2NewGame of Variables from CommonCache)
      • Set count = (Load count of Variables from CommonCache)
      • For each (Integer A) from 1 to count, do (Actions)
        • Loop - Actions
          • Game Cache - Restore (String((Integer A))) of Units from CommonCache for Player 1 (Red) at (Center of LoadingFrom) facing 0.00

  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from CommonCache.w3v
      • Set CommonCache = (Last created game cache)
      • Set LoadingFrom = spawn <gen>
      • Set Map2NewGame = False
      • Trigger - Turn off (This trigger)
      • Trigger - Run load <gen> (ignoring conditions)
  • start
    • Events
      • Game - A saved game is loaded
    • Conditions
    • Actions
      • Game - Display to (All players) the text: loads
      • Game Cache - Create a game cache from CommonCache.w3v
      • Set CommonCache = (Last created game cache)
      • Trigger - Run load <gen> (ignoring conditions)
  • go to map 1
    • Events
      • Unit - A unit enters Go To Map 1 <gen>
    • Conditions
    • Actions
      • Set LeftFromMap = 2
      • Set count = 0
      • Set your_army = (Units owned by Player 1 (Red))
      • Game Cache - Clear all labels of Units in CommonCache
      • Unit Group - Pick every unit in your_army and do (Actions)
        • Loop - Actions
          • Set count = (count + 1)
          • Game Cache - Store (Picked unit) as (String(count)) of Units in CommonCache
          • Unit - Remove (Picked unit) from the game
      • Game Cache - Store count as count of Variables in CommonCache
      • Game Cache - Store LeftFromMap as LeftFromMap of Variables in CommonCache
      • Game Cache - Store Map2NewGame as Map2NewGame of Variables in CommonCache
      • Game Cache - Save CommonCache
      • Game - Save game as cave.w3z and load main.w3z (Skip scores)
  • load
    • Events
    • Conditions
    • Actions
      • Game Cache - Reload all game cache data from disk
      • Set LeftFromMap = (Load LeftFromMap of Variables from CommonCache)
      • Set Map2NewGame = (Load Map2NewGame of Variables from CommonCache)
      • Set count = (Load count of Variables from CommonCache)
      • For each (Integer A) from 1 to count, do (Actions)
        • Loop - Actions
          • Game Cache - Restore (String((Integer A))) of Units from CommonCache for Player 1 (Red) at (Center of LoadingFrom) facing 0.00
I know there is many leaks in those triggers no need to point that out. They are not a part of the problem.

edit: it seems like "Game - Save game as cave.w3z and load main.w3z (Skip scores)" in map 2 is the problem. Because if I use change level instead it works. But still no idea how to fix it :-/
edit 2: ok I can confirm that it finds the .w3z it is supposed to load, because if I put something that is invalid it doesnt crash. So when I save in map 1 I somehow save something corrupted that cant be read or what?
edit 3: it does not mater if I disable to load triggers in map 1. Either its wrong at the enter map 1 trigger in map 2 or I have saved something corrupted.
edit 4: can it because of size limit? I know exactly this happens if your map is over 8 mb. However my map is 7.5 mb but the save from map 1 is 1.5 mb which maked 1 mb extend if that count when loading.
edit 5: the save file is not corrupted. I can find the saved file and when I load it manually from the wc3 mainscreen it works.
edit 6: OMFG I SOLVED IT! (!!!!!!!!!!!!!!) it was the path lenght... I didnt think the campaign name would count -.- wow this is stupid
 
Last edited:
Well, yes... though if you need those data into the other maps too, then you're better off saving them into the cache... and reinitializing the map clears any unnecessary data accumulated...

anyway, AFAIK, the save file size shouldn't really matter...

btw

ok I can confirm that it finds the .w3z it is supposed to load, because if I put something that is invalid it doesnt crash. So when I save in map 1 I somehow save something corrupted that cant be read or what?

So putting an invalid .w3z doesn't cause it to crash? what happens if you do that? coz last time I tried that, it sent me straight back to the chapter selection
 
Status
Not open for further replies.
Top