• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to transfer Gold and Lumber resources from one mission to another?

Level 3
Joined
May 27, 2023
Messages
18
As the title says, does anyone know a simple and straighforward way to achieve this? I'm still new to variable usage and cache saves and i couldn't find a thread about it. Please and thank you :)
 
Level 30
Joined
Aug 29, 2012
Messages
1,385
Here are two basic triggers, you store data in the first and use the second to load it in the next map

  • Save
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyCache.w3v
      • Set VariableSet MyCache = (Last created game cache)
      • -------- --------------- --------
      • Set VariableSet MyGold = (Player 1 (Red) Current gold)
      • Set VariableSet MyLumber = (Player 1 (Red) Current lumber)
      • -------- --------------- --------
      • Game Cache - Store MyGold as Gold of Resources in MyCache
      • Game Cache - Store MyLumber as Lumber of Resources in MyCache
      • -------- --------------- --------
      • Game Cache - Save MyCache.
  • Load
    • Events
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyCache.w3v
      • Set VariableSet MyCache = (Last created game cache)
      • -------- --------------- --------
      • Set VariableSet MyGold = (Load Gold of Resources from MyCache)
      • Set VariableSet MyLumber = (Load Lumber of Resources from MyCache)
      • -------- --------------- --------
      • Player - Set Player 1 (Red).Current gold to MyGold
      • Player - Set Player 1 (Red).Current lumber to MyLumber
The thing about actions like these

1727190594476.png


Is that the "as" and "of" parameters can be anything you want, but they need to be consistent throughout your campaign. Think of it as an sub-item (Gold) you place in a category (Resources) stored in your cache. Then you access it by fetching those items

1727190749258.png


Again, if I tell the trigger to load "Gold1" or "MyResources", it will return nothing because that's not the proper name I used in the previous map, so you gotta stay organized with your categories
 
Top