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

[Solved] Game Cache Issue

Status
Not open for further replies.
Level 2
Joined
Jan 4, 2020
Messages
3
Hello!

Let me just begin by saying that I literally have no prior experience with triggers whatsoever. I'm primarily self-taught and harvested much of my knowledge regarding these from the Hive itself, custom campaign structures, or other YouTube videos.

Recently, I've been encouraged to make my own campaign—I've finished the first chapter successfully, although I am having some issues regarding storing and restoring heroes through game caches.

I have created a couple of triggers since the campaign features two heroes, I have scoured whatever resource related to the topic at hand that I can, but I never seem to be able to do it properly.

Here are the triggers:

MAP 1:

Initialization:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Game Cache - Create a game cache from MainCache.w3v
    • Set MainCache = (Last created game cache)
    • Game Cache - Save MainCache
Save HERO 1:
  • Events
  • Conditions
  • Actions
    • Game Cache - Store Vereesa 0125 <gen> as Vereesa of FirstMap in MainCache
    • Game Cache - Store (Level of Vereesa 0125 <gen>) as VereesaLevel of FirstMap in MainCache
    • Game Cache - Store (Hero experience of Vereesa 0125 <gen>) as VereesaEXP of FirstMap in MainCache
    • Game Cache - Store (Level of Arcane Shot for Vereesa 0125 <gen>) as VereesaQ of FirstMap in MainCache
    • Game Cache - Store (Level of Arcane Arrows for Vereesa 0125 <gen>) as VereesaW of FirstMap in MainCache
    • Game Cache - Store (Level of General's Aura for Vereesa 0125 <gen>) as VereesaE of FirstMap in MainCache
    • Game Cache - Store (Level of Rain of Arrows for Vereesa 0125 <gen>) as VereesaR of FirstMap in MainCache
    • Game Cache - Save MainCache
Save HERO 2:
  • Events
  • Conditions
  • Actions
    • Game Cache - Store Daerith 0132 <gen> as Daerith of FirstMap in MainCache
    • Game Cache - Store (Level of Daerith 0132 <gen>) as DaerithLevel of FirstMap in MainCache
    • Game Cache - Store (Hero experience of Daerith 0132 <gen>) as DaerithEXP of FirstMap in MainCache
    • Game Cache - Store (Level of Arcane Rain for Daerith 0132 <gen>) as DaerithQ of FirstMap in MainCache
    • Game Cache - Store (Level of Summon Great Water Elemental for Daerith 0132 <gen>) as DaerithW of FirstMap in MainCache
    • Game Cache - Store (Level of Brilliance Aura for Daerith 0132 <gen>) as DaerithE of FirstMap in MainCache
    • Game Cache - Store (Level of Arcane Barrage for Daerith 0132 <gen>) as DaerithR of FirstMap in MainCache
    • Game Cache - Save MainCache
Map 1 Ends:
  • Events
  • Conditions
  • Actions
    • Trigger - Run Save HERO 1 <gen> (checking conditions)
    • Trigger - Run Save HERO 2 <gen> (checking conditions)


MAP 2:

Initialization:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Game Cache - Create a game cache from MainCache.w3v
    • Set Main Cache = (Last created game cache)
    • Trigger - Run Reload HERO 1 <gen> (checking conditions)
    • Trigger - Run Reload HERO 2 <gen> (checking conditions)

Load HERO 1:
  • Events
  • Conditions
  • Actions
    • Game Cache - Restore Vereesa of FirstMap from MainCache for Player 3 (Teal) at (Center of Region 007 <gen>) facing 270.00
    • Set Vereesa = (Last restored unit)
    • Set VereesaLevel = (Load VereesaLevel of FirstMap from MainCache)
    • Set VereesaEXP = (Load VereesaEXP of FirstMap from MainCache)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Vereesa Equal to No unit
      • Then - Actions
        • Set Vereesa = Vereesa 0318 <gen>
        • Trigger - Run Vereesa Level <gen> (ignoring conditions)
      • Else - Actions
        • Unit - Remove Vereesa 0318 <gen> from the game
Load HERO 2:
  • Events
  • Conditions
  • Actions
    • Game Cache - Restore Daerith of FirstMap from MainCache for Player 3 (Teal) at (Center of Region 008 <gen>) facing 270.00
    • Set Daerith = (Last restored unit)
    • Set DaerithLevel = (Load DaerithLevel of FirstMap from MainCache)
    • Set DaerithEXP = (Load DaerithEXP of FirstMap from MainCache)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Daerith Equal to No unit
      • Then - Actions
        • Set Daerith = Daerith 0317 <gen>
        • Trigger - Run Daerith Level <gen> (ignoring conditions)
      • Else - Actions
        • Unit - Remove Daerith 0317 <gen> from the game
Note that Trigger - Run Vereesa Level <gen> (ignoring conditions) and the other variation for the second hero is only a mere trigger that levels up the hero to 3 and learns all of the three obtainable skills.

Thank you for your time!
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
Game Caches cannot be created during map initialization, they should be created AFTER the map ends and saved after storing the heroes.
Also, there is no need to save the Hero Level/Exp/Ability Levels, those are automatically saved when you create the game cache.
 
Level 2
Joined
Jan 4, 2020
Messages
3
What exactly is the problem you’re having? Have you tried displaying text messages of the stored/loaded data to see which parts are happening correctly?

The heroes don't load as they should from the first map. :goblin_cry: From all of my trials, only the If/Then/Else action is triggered. I've also made sure already to set the next level accordingly.

Game Caches cannot be created during map initialization, they should be created AFTER the map ends and saved after storing the heroes.
Also, there is no need to save the Hero Level/Exp/Ability Levels, those are automatically saved when you create the game cache.

Um, so, what I should do is create a Trigger with Actions, containing the game cache creation, and Triggers that would save and store each of the two heroes?

How about the triggers for the second map, are they fine?
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
For the first map :
  • Save Heroes
    • Events
    • Conditions
    • Actions
      • -------- Create Game Cache --------
      • Game Cache - Create a game cache from MainCache.w3v
      • -------- Save Heroes --------
      • Game Cache - Store Vereesa as Vereesa of FirstMap in (Last created game cache)
      • Game Cache - Store Daerith as Daerith of FirstMap in (Last created game cache)
      • -------- Save Game Cache --------
      • Game Cache - Save (Last created game cache)
For the second map :
  • Load Heroes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Create Game Cache --------
      • Game Cache - Create a game cache from MainCache.w3v
      • -------- Load Each Hero --------
      • Trigger - Run Load Vereesa <gen> (checking conditions)
      • Trigger - Run Load Daerith <gen> (checking conditions)
  • Load Vereesa
    • Events
    • Conditions
    • Actions
      • Game Cache - Restore Vereesa of FirstMap from (Last created game cache) for Player 1 (Red) at (Center of LoadVereesa <gen>) facing 0.00
      • Set Vereesa = (Last restored unit)
      • -------- Create Default Hero --------
      • If (Vereesa Not equal to No unit) then do (Skip remaining actions) else do (Do nothing)
      • Unit - Create 1 Vereesa for Player 1 (Red) at (Center of LoadVereesa <gen>) facing 0.00 degrees
      • Set Vereesa = (Last created unit)
  • Load Daerith
    • Events
    • Conditions
    • Actions
      • Game Cache - Restore Daerith of FirstMap from (Last created game cache) for Player 1 (Red) at (Center of LoadDaerith <gen>) facing 0.00
      • Set Daerith = (Last restored unit)
      • -------- Create Default Hero --------
      • If (Daerith Not equal to No unit) then do (Skip remaining actions) else do (Do nothing)
      • Unit - Create 1 Daerith for Player 1 (Red) at (Center of LoadDaerith <gen>) facing 0.00 degrees
      • Set Daerith = (Last created unit)
 
Status
Not open for further replies.
Top