1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Game Caches

Discussion in 'Trigger (GUI) Editor Tutorials' started by Bob27, Mar 18, 2006.

  1. Bob27

    Bob27

    Joined:
    Jun 14, 2005
    Messages:
    3,028
    Resources:
    12
    Maps:
    6
    Tutorials:
    6
    Resources:
    12
    Introduction
    This tutorial will tell you how to move units and other things from map to map. Remember that Game Caches can not be used on Battle Net, and are almost only ever used for campaigns.

    Creating the Game Cache

    The first thing you want to do is to create a variable for the Game Cache, go into the Variale editor and create a new Game Cache, like in the pictures bellow.

    Click the "X" sign to open the variable editor, and create a new one like so:
    [​IMG]


    Then when the Game Caches variable has been created use this trigger to create the Game Cache.
    You can name your gamecache anything you'd like (it is "TutorialCache.w3v" in this tutorial), but do not put
    any spaces in it.

    • Create Cache
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Game Cache - Create a game cache from TutorialCache.w3v
        • Set TutorialCache = (Last created game cache)
        • Game Cache - Save TutorialCache


    Storing Heros and Other Things

    Now i'll show you how to store things using a Game Cache. The following trigger can be used to store a hero.

    • Store Hero
      • Events
      • Conditions
      • Actions
        • Game Cache - Store Paladin 0032 <gen> as Paladin of Heros in TutorialCache
        • Game Cache - Save TutorialCache
        • Trigger - Run Store Gold <gen> (ignoring conditions)


    Remember that you will have to create all the nesecary variables in order for the triggers to work. This next trigger will show you how to store a players gold or lumber. This will require a variable, unlike storing a hero.

    • Store Gold
      • Events
      • Conditions
      • Actions
        • Set Gold = (Player 1 (Red) Current gold)
        • Game Cache - Store Gold as Gold of Recources in TutorialCache
        • Game Cache - Save TutorialCache
        • Trigger - Run Store Hero Name <gen> (ignoring conditions)


    This next trigger will show you how to store a heros proper name, and one of the ways it can be used in a different map.

    • Store Hero Name
      • Events
      • Conditions
      • Actions
        • Set HeroName = (Proper name of Paladin 0032 <gen>)
        • Game Cache - Store HeroName as HeroName of Heros in TutorialCache
        • Game Cache - Save (Last created game cache)
        • Trigger - Run End Game <gen> (ignoring conditions)


    This will also require a variable.

    Restoring things from the Game Cache

    I am now going to show you how to restore all these things in a different map. The first thing we need to do is the re-create all the variables. It makes it alot easier if the new variables in the new map are the same as in the old map. After all the required variables have been made make this trigger.

    • Load Game Cache
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Game Cache - Create a game cache from TutorialCache.w3v
        • Set TutorialCache = (Last created game cache)


    Now that the Game Cache has been re-created we can restore our heros, gold and hero names. This next trigger is used to restore the hero.

    • Restore Gold
      • Events
        • Time - Elapsed game time is 0.00 seconds
      • Conditions
      • Actions
        • Set Gold = (Load Gold of Recources from TutorialCache)
        • Player - Set Player 1 (Red) Current gold to Gold


    Now that our gold has been restored we can make a text message appear on the screen saying Your heros proper name is the last game was: and have the heros proper name appear. You can do this with almost anything. Heres the trigger for it.

    • Restore Hero Name
      • Events
        • Time - Elapsed game time is 0.00 seconds
      • Conditions
      • Actions
        • Set HeroName = (Load HeroName of Heros from TutorialCache)
        • Game - Display to (All players) for 20.00 seconds the text: (Your heros proper name is the last game was: + (Load HeroName of Heros from TutorialCache))


    Conclusion

    I hope you now find Game Caches alot easier, if you would like to ask me anything just private message me or email me at bob27dav@optusnet.com.au. If you need it you maybe download the demo Here.
     

    Attached Files:

    Last edited by a moderator: Feb 26, 2016
  2. FireWave.

    FireWave.

    Joined:
    Jul 31, 2006
    Messages:
    6
    Resources:
    0
    Resources:
    0
    Does it work in multiplayer?
     
  3. Hemlock

    Hemlock

    Joined:
    Jun 22, 2004
    Messages:
    788
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Fixed the trigger tags, so this tutorial looks good.

    Game cache is made for single player only, multiplayer wise, you will need make a load/save code.
     
  4. Bob27

    Bob27

    Joined:
    Jun 14, 2005
    Messages:
    3,028
    Resources:
    12
    Maps:
    6
    Tutorials:
    6
    Resources:
    12
    Nah Game Caches can be used in b.net, its just when u exit the game or b.net (either one) the Cache is completly useless and will not work.
     
  5. operator

    operator

    Joined:
    Feb 9, 2006
    Messages:
    1,670
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Nice tutorial!
     
  6. Hemlock

    Hemlock

    Joined:
    Jun 22, 2004
    Messages:
    788
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Thats why its not handy to really use in multiplayer made, making a load/save key is way better ^_^.

    but like said above, nice tutorial.
     
  7. EmilWolf4

    EmilWolf4

    Joined:
    Nov 4, 2014
    Messages:
    1
    Resources:
    0
    Resources:
    0
    Below the sentence :Creating the Game Cache

    The first thing you want to do is to create a variable for the Game Cache, go into the Variale editor and create a new Game Cache, like in the pictures bellow. : two photos only show this [​IMG]




    What do?
     
  8. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,855
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    You did the best necro post Ive ever seen.

    "03-18-2006, 03:18 PM " you cant expect the image to be still on their database 8 years after upload
     
  9. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    It is ok to necro in cases like these, but it is better to PM me for concerns like that.

    I recovered one image from a web archive, but the other was gone long before that. I added a description that should serve the same purpose.
     
  10. Oraien

    Oraien

    Joined:
    Feb 10, 2011
    Messages:
    119
    Resources:
    2
    Maps:
    2
    Resources:
    2
    I have a problem, it doesn't work. I did all exactly how it was stated here but my unit just won't load.
     
  11. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Post in Triggers&Scripts with your triggers. People may be able to help you more quickly in that section. :)

    Make sure that you have something that actually runs "Store Hero"/"Store Gold"/"Store Hero Name". In the tutorial, those triggers don't have any events so they should be ran from an external trigger. Otherwise nothing ever gets saved.
     
  12. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,248
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    It's important to know that game cache's name shouldn't contain a space else it won't work.
    InitGameCache("game cache.w3v")
    doesn't work,
    InitGameCache("gamecache.w3v")
    works.

    I wonder tho where (in which directory) are cache files got saved? Is it even visible?
     
  13. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,608
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    The original wc3 directory as far as I know. I am 99% certain I have seen the files there.
     
  14. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Updated.

    I assume it is in "/Save/Profile#/gamecache.w3v". I haven't checked though.
     
  15. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,248
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    No, they aren't there.
    I have auto save system in my map using game caches, named it with "dc_#.w3v", # is version number from one and it has reached 20 by now. Means the older versions contain flaws so they are no longer used. I want to remove them so they won't become trashes somewhere in my disk. But I can't find them even after using the search feature.
     
  16. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Sorry, it is actually within "/Save/Profile#/Campaigns.w3v" as an aggregate.
     
  17. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,248
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    So we can't delete a specific game cache then? Thanks for the info anyway : )
     
  18. Hayate_ayasaki22

    Hayate_ayasaki22

    Joined:
    May 10, 2017
    Messages:
    13
    Resources:
    0
    Resources:
    0
    Can i know where to find
    Set Gold = (Player 1 (Red) Current gold)
    I'm new and confused
     
    Last edited: Nov 8, 2017
  19. Hayate_ayasaki22

    Hayate_ayasaki22

    Joined:
    May 10, 2017
    Messages:
    13
    Resources:
    0
    Resources:
    0
    Can someone explain how to do this game cache things...Please..
     
  20. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    2,469
    Resources:
    1
    Maps:
    1
    Resources:
    1
    "Gold" is also a variable (Integer)
    Which part you don't understand?