• 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.

[Trigger] Game Cache Saving?

Status
Not open for further replies.
Level 7
Joined
Feb 1, 2008
Messages
296
i think i screwed up on it a little. plz show me the triggers :p i think i got a leak

  • Save
Event
Player X types a message containing -save as an exact match
Action
Store Hero[Player Number Of Triggering Player] in Name of Triggering Player
of Hero
Store Points[Player Number Of Triggering Player] in Name of Triggering Player of Point

  • Load
Event
Player X types a message containing -load as an exact match
Action
Remove Hero[Player Number of Triggering Player]
Load the above two game caches

and whenever i quit and replay the map, i get nothing :(
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
That's because Game Cache's only store for 1 'session'. Switching campaigns or quitting will not support Game Cache's. To save Game Cache's throughout different games with the same save/load system, you need to make a save/load code system.

It's basically: You save the hero and everything else you need to save (like resources and stuff). For each piece of data you store in a Game Cache, you add a little part of a code. So all heroes of type Mountain King can be given the code AA as first 2 characters. With the load code, you check if the first 2 characters are AA, and if so: You load the Mountain King!


PS: If you use a TRIGGER command in the forum, place the [/TRIGGER] at the very end of your trigger (after the last Action) :wink:
 
Level 10
Joined
Jun 26, 2005
Messages
236
Game Cache in fact does allow you to transfer stuff to another campaign level (to the person above).

At map Initializtion, run this trigger:

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyMap.w3v
      • Game Cache - Restore someUnit of someCategory from (Last created game cache) for somePlayer at someLocation facing someReal
      • If (someUnit Not equal to No unit) then do (Skip remaining actions) else do (Do nothing)
      • Unit - Create 1 someUnit for somePlayer at someLocation facing someReal
When the game is ending, run this trigger:


  • Store
    • Events
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyMap.w3v
      • Game Cache - Store someUnit as someUnit of someCategory in (Last created game cache)
      • Game Cache - Save (Last created game cache)
The first trigger loads the hero from the other map. If the map hasn't been played before (no hero from a previous play) it creates it. When the game ends, it saves the unit for the next play. Make sure the Categories and Unit names are all case-perfect, as Game Cache is case sensitive.
 
Level 6
Joined
Sep 4, 2007
Messages
157
you can not use game cache in multiplayer games only campaign games. The only way a game cache will work in multiplayer games is if you save things and use it during that game. To save a hero you must use a save load system.
 
Status
Not open for further replies.
Top