• 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 Caches ?

Status
Not open for further replies.
Level 19
Joined
Jun 16, 2007
Messages
1,574
Is it Possible to do this ? In this sort of contents and how would i go about doing it ?


Just Wondering how to store, and recongize the last map the Hero/Unit has came from.

And Whcih Region. So if the unit wishes to go back to that map, and that point it can retrace, and point it to that spot.

So Lets Say i left "West City from the North" i wish to move my unit to "Earth.w3x" and to point it to the "North Exit of West City Region within Earth"

How would the trigger look like ? for both maps ?
 
Level 19
Joined
Jun 16, 2007
Messages
1,574
Ok Well this is what i've done:

  • SaveGameCache1
    • Events
      • Unit - A unit enters GoToNorth <gen>
    • Conditions
      • (Triggering unit) Equal to (Random unit from (Units owned by Player 1 (Red)))
    • Actions
      • Game Cache - Create a game cache from Middle.w3v
      • Game Cache - Save GameCache
      • Game Cache - Store (Triggering unit) as Hero of Heros in (Last created game cache)
      • Game Cache - Store (Hero level of (Triggering unit)) as Hero_Level of Heros in (Last created game cache)
      • Game Cache - Store (Hero experience of (Triggering unit)) as Hero_Experience of Heros in (Last created game cache)
      • Game Cache - Store Gold as Gold of Resources in (Last created game cache)
      • Game Cache - Store Lumber as Lumber of Resources in (Last created game cache)
      • Game Cache - Store Lumber as Lumber of Resources in (Last created game cache)
      • Game Cache - Store Middle as Region of RegionName in (Last created game cache)
      • Game Cache - Save (Last created game cache)
      • Game - Save game as Middle.w3z and change level to North.w3x (Skip scores)

  • LoadGameCache1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from North.w3v
      • Game Cache - Reload all game cache data from disk
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Middle.w3z Equal to (Saved-game filename)
        • Then - Actions
          • Game Cache - Restore Hero of Heros from (Last created game cache) for Player 1 (Red) at (Center of ComeFromMiddle <gen>) facing 0.00
          • Game Cache - Reload all game cache data from disk
          • Set HeroName = (Proper name of (Last restored unit))
          • Hero - Set (Last restored unit) Hero-level to (Load Hero_Level of Heros from (Last created game cache)), Hide level-up graphics
          • Hero - Set (Last restored unit) experience to (Load Hero_Experience of Heros from (Last created game cache)), Hide level-up graphics
          • Player - Set Player 1 (Red) Current gold to (Load Gold of Resources from (Last created game cache))
          • Player - Set Player 1 (Red) Current lumber to (Load Lumber of Resources from (Last created game cache))
        • Else - Actions
          • Do nothing

Edit:// Great even this Game Cache doesn't work -_-"
 
Level 3
Joined
Jun 24, 2004
Messages
42
I'm a little rusty on this, but there's a few things I see wrong in the Load section (if I'm understanding how you are trying to do this right).

I'm a little confused as to why you did it the way you did. Maybe try something like this?

  • SaveGameCache1
    • Events
      • Unit - A unit enters GoToNorth <gen>
    • Conditions
      • (Triggering unit) Equal to (Random unit from (Units owned by Player 1 (Red)))
    • Actions
      • Game Cache - Create a game cache from DBZ.w3v
      • Game Cache - Store (Triggering unit) as Hero of Heros in (Last created game cache)
      • Game Cache - Store (Hero level of (Triggering unit)) as Hero_Level of Heros in (Last created game cache)
      • Game Cache - Store (Hero experience of (Triggering unit)) as Hero_Experience of Heros in (Last created game cache)
      • Game Cache - Store ((Owner of (Triggering unit)) Current gold) as Gold of Resources in (Last created game cache)
      • Game Cache - Store ((Owner of (Triggering unit)) Current lumber) as Lumber of Resources in (Last created game cache)
      • Game Cache - Store Middle as Region of RegionName in (Last created game cache)
      • Game Cache - Save (Last created game cache)
      • Game - Save game as Middle.w3z and change level to North.w3x (Skip scores)
Only use ONE gamecache for all of this, you won't need more than one. You can set the region name you just came from as a string in that main cache, you'll just have to remember to change that value in the game cache every time you move to a different map. Using more than one cache isn't the best idea, and for all I know its not even possible. Also, I removed the Save GameCache you had at the beginning. Not sure what exactly it referenced to, whether it was a variable or just a name you replaced for our sake, but it shouldn't be there either way, especially if you are only using one game cache from now on. I replaced your 'placeholders' with real values so it doesn't look like they are all strings.

And for load..

  • LoadGameCache1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Reload all game cache data from disk
      • Game Cache - Create a game cache from DBZw3v
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load Region of RegionName from (Last created game cache)) Equal to Middle
        • Then - Actions
          • Game Cache - Restore Hero of Heros from (Last created game cache) for Player 1 (Red) at (Center of ComeFromMiddle <gen>) facing 0.00
        • Else - Actions
          • Game Cache - Restore Hero of Heros from (Last created game cache) for Player 1 (Red) at (Center of ComeFromWest <gen>) facing 0.00
      • Set HeroName = (Proper name of (Last restored unit))
      • Hero - Set (Last restored unit) Hero-level to (Load Hero_Level of Heros from (Last created game cache)), Hide level-up graphics
      • Hero - Set (Last restored unit) experience to (Load Hero_Experience of Heros from (Last created game cache)), Hide level-up graphics
      • Player - Set Player 1 (Red) Current gold to (Load Gold of Resources from (Last created game cache))
      • Player - Set Player 1 (Red) Current lumber to (Load Lumber of Resources from (Last created game cache))
Here where you were a little wrong. You want to restore all game cache data from disk before you create a game cache, you had it visa versa, and then about halfway through the trigger you re-loaded all game cache data. No need for that. To detect the region you just came from, use an If/Then/Else to detect the string that was set in the cache by using the Label and Category you defined before. Of course this is a string condition.

Make these changes, test it out, and if it doesn't work repost your new trigger (after the changes) and I'll let you know whats wrong.

I tested this personally before posting it, and if need-be I'll post a test campaign.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
This tutorial describes a specialized use of the 'Save Game and Load Game' and 'Save Game and Change Level' triggers that were originally demonstrated by Blizzard in the Orc Expansion Campaign that came with the Frozen Throne WCIII expansion, and later were released for public mapping in WCIII Patch 1.13.

Unless you've never played the Rexxar campaign (shame on you), all you had to do is read the first line of that tutorial to know the answer...
 
Level 3
Joined
Jun 24, 2004
Messages
42
Thank you for your help. I'm going to test it out now.

Edit:/ I've made the changes and yet it still doesn't restore the "Unit" Or "Gold" and "Lumber"

It more than likely has to do with the condition I set for restoring the unit based on where he came from. If the strings don't match it won't restore him at all.

Try changing it so that it restores him from the cache at a certain location, and then moves him based on the region string. That way if the condition is false or incorrectly configured, at least you'll be able to see whether or not the hero is being created and you can rule out that problem.

Also, make sure you've got the syntax correct on those caches. You were putting stuff in like Restore 'Hero', set Gold to Gold of Resources. Not sure if you are trying to use strings in all of those or you just deleted what was there and replaced it with strings, but you cannot use strings for that type of action.
 
Level 19
Joined
Jun 16, 2007
Messages
1,574
Because those save/load systems wont work for what i want. I want to be able to change to the next map without typing in a code. I want it to be automatic. Saves messing about getting your code ready for the next map. Might as well use Game caches. Since its all for my Dragonball Z Campaign.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
This is a strange problem, as the triggers look exactly as those in the tutorial(and other tutorials as well). Maybe it has to do with 1.22 :p
 
Status
Not open for further replies.
Top