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

Game Cache help needed

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
Hi, I need some help to make a game cache for my campaign. It needs to save an unit with his items and unit abilities to load him in the next level. I already check the tutorial about Game Caches on this website but I still can't work it out. If you help me I'll give +rep ofcourse.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
As you know, Game Cache's save info to be transferable to other maps within the same campaign. To save info, you need to use the 'Game Cache - Store ...' command. To store a unit (including items and abilities), you only need to use 'Game Cache - Store Unit'. Set the unit you want to store to a unit variable, like Unit1 and place it in the Store Unit command, giving you
  • Game Cache - Store Unit1 as Label of Category in (Last created game cache)
Give it a Label of which you can recognise what kind of info it is, like Hero. Now you have a command like:
  • Game Cache - Store Unit1 as Hero of Category in (Last created game cache)
Give it a category to separate stuff within the Game Cache's, like HeroCategory, and you have a trigger like

  • Game Cache - Store Unit1 as Hero of HeroCategory in (Last created game cache)
Now make a Game Cache variable where all data will be loaded from, like GameCache1, giving you a full command that allows you to save the unit's inventory, EXP, level, abilities and stuff like that. Your command will look like
  • Game Cache - Store Unit1 as Hero of HeroCategory in GameCache1
Now save GameCache1 and remove the unit you saved (unless you're not going to leave the map after saving the Game Cache, but that would be useless).


In the new map, you use the command 'Game Cache - Reload all game cache data from disk' and 'Game Cache - Restore Hero of HeroCategory from GameCache1 for <YOUR PLAYER> at <YOUR REGION> facing <YOUR DIRECTION>)'

Tadah! Your info has been stored and got loaded into your new map.
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
current game cache triggers

I can't get it to work.
current game cache triggers:

Variable: "type=Game Cache" "array not marked"

Frist Trigger

  • Events: Map initialization
  • Actions:
  • Game Cache - Create a game cache from variable.w3v
  • Set variable = (last created game cache)
  • Game Cache - Save variable
Second Trigger

  • Events: Player1 types done as an exact message
  • Actions:
  • Game Cache - Store Pilot1 0000 as Avatar of unitCatergory in variable
  • Game Cache - Store (level of Laser Turret for Pilot1 0000 as Avatar of UnitCategory in variable.
  • Game Cache - Save variable
Third Trigger (in map2)

  • Events: Map initialization
  • Actions:
  • Game Cache - Create a game cache from variable.w3v
  • Set variable = (last created game cache)
  • Game Cache - Reload all game cache data from disk.
  • Game Cache - Restore Avatar of UnitCatergory from variable for Player1 at (Player 1 (Red) start location)...
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Here's the multiple map switch campaign I used to try out a tutorial here (which I unfortunately can't find anymore). It's exactly what the tutorial said, just no explanation. It might help you find your upcoming Game Cache problems.
 

Attachments

  • Map Switch.w3n
    109.9 KB · Views: 38
Status
Not open for further replies.
Top