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

Please help, GAME CACHE issue.

Status
Not open for further replies.
Level 11
Joined
Feb 23, 2009
Messages
577
So I am making a campaign where it saves your whole army (every unit is a hero).

Here is my issue:

-When I have a lot of Heroes, and they start dying, it doesn't save all of them into the cache! It saves live or dead heroes and reloads them every mission but it seems that it is having a hard time saving all the dead heroes, as it doesn't load all of them... However it works perfectly when they are alive...

Does anyone know what I am not doing right?

2h3c47p.jpg
 
Last edited by a moderator:
Level 16
Joined
Mar 3, 2006
Messages
1,564
Instead of attaching a picture you could post your trigger in [TRIGGER][/TRIGGER] tags.

Right Click the name of the trigger in the right panel in the trigger editor then select 'Copy As Text' from the dropdown menu then CTRL+V between [TRIGGER][/TRIGGER] tags.

As for your issue,
You can't save the dead heroes just revive them and save them but add another variable to indicate that they are dead.
 
Level 11
Joined
Feb 23, 2009
Messages
577
  • Save
    • Events
    • Conditions
    • Actions
      • -------- Units --------
      • Set Group_A = (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True))
      • Set Integer_A = (Number of units in Group_A)
      • Game Cache - Store Integer_A as ForceSize of 1 in GameCache_Save
      • Set Integer_A = 1
      • Unit Group - Pick every unit in Group_A and do (Actions)
        • Loop - Actions
          • Game Cache - Store (Picked unit) as (String(Integer_A)) of 1 in GameCache_Save
          • Set Integer_A = (Integer_A + 1)
      • Custom script: call DestroyGroup(udg_Group_A)
      • -------- Construction Yard --------
      • Set Group_A = (Units owned by Player 1 (Red) matching (((Matching unit) is A town-hall-type unit) Equal to True))
      • Unit Group - Pick every unit in Group_A and do (Actions)
        • Loop - Actions
          • Game Cache - Store (Picked unit) as CY of 1 in GameCache_Save
      • Custom script: call DestroyGroup(udg_Group_A)
      • -------- Resources --------
      • Set Integer_A = (Player 1 (Red) Current gold)
      • Game Cache - Store Integer_A as GOLD of 1 in GameCache_Save
      • Set Integer_A = (Player 1 (Red) Current lumber)
      • Game Cache - Store Integer_A as LUMBER of 1 in GameCache_Save
      • -------- Researches --------
      • Trigger - Run Save Researches <gen> (checking conditions)
      • -------- Upgrades --------
      • Trigger - Run Save Upgrades <gen> (checking conditions)
      • -------- --- --------
      • -------- --- --------
      • -------- SAVE --------
      • Game Cache - Save GameCache_Save




  • Load
    • Events
    • Conditions
    • Actions
      • -------- Construction Yard --------
      • Set Point_A = (Position of Construction Yard - [|cffffcc00Level 1|r] 0020 <gen>)
      • Unit - Remove Construction Yard - [|cffffcc00Level 1|r] 0020 <gen> from the game
      • Game Cache - Restore CY of 1 from GameCache_Save for Player 1 (Red) at Point_A facing 270.00
      • Custom script: call RemoveLocation(udg_Point_A)
      • -------- Resources --------
      • Set Integer_A = (Load GOLD of 1 from GameCache_Save)
      • Player - Set Player 1 (Red) Current gold to Integer_A
      • Set Integer_A = (Load LUMBER of 1 from GameCache_Save)
      • Player - Set Player 1 (Red) Current lumber to Integer_A
      • -------- Researches --------
      • Trigger - Run Load Researches <gen> (checking conditions)
      • -------- Upgrades --------
      • Trigger - Run Load Upgrades <gen> (checking conditions)
      • -------- Units --------
      • Set Integer_A = 1
      • Trigger - Run Load Units <gen> (checking conditions)





  • Load Units
    • Events
    • Conditions
    • Actions
      • Set Point_A = (Center of Unit Spawn <gen>)
      • Game Cache - Restore (String(Integer_A)) of 1 from GameCache_Save for Player 1 (Red) at Point_A facing 270.00
      • Custom script: call RemoveLocation(udg_Point_A)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Last restored unit)) Equal to Special Weapon Gunboat
              • (Unit-type of (Last restored unit)) Equal to Special Weapon Airstrike
              • (Unit-type of (Last restored unit)) Equal to Special Weapon Ion Cannon
              • (Unit-type of (Last restored unit)) Equal to Special Weapon Nuclear Strike
        • Then - Actions
          • Set Point_A = (Player 1 (Red) start location)
          • Unit - Move (Last restored unit) instantly to Point_A
          • Custom script: call RemoveLocation(udg_Point_A)
        • Else - Actions
      • Unit - Set level of Upgrade 1 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 2 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 3 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 4 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 5 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 6 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 7 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 8 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 9 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 10 for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 7 - Tiberium for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 8 - Tiberium for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 9 - Tiberium for (Last restored unit) to (Hero level of (Last restored unit))
      • Unit - Set level of Upgrade 10 - Tiberium for (Last restored unit) to (Hero level of (Last restored unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Last restored unit) in slot 1) Not equal to No item
        • Then - Actions
          • Unit - Remove Add-Ons (APC) from (Last restored unit)
          • Unit - Remove Add-Ons (Apache) from (Last restored unit)
          • Unit - Remove Add-Ons (Artillery) from (Last restored unit)
          • Unit - Remove Add-Ons (Buggy) from (Last restored unit)
          • Unit - Remove Add-Ons (Chem Warrior) from (Last restored unit)
          • Unit - Remove Add-Ons (Commando) from (Last restored unit)
          • Unit - Remove Add-Ons (Engineer) from (Last restored unit)
          • Unit - Remove Add-Ons (Flame Tank) from (Last restored unit)
          • Unit - Remove Add-Ons (Flamethrower) from (Last restored unit)
          • Unit - Remove Add-Ons (Grenadier) from (Last restored unit)
          • Unit - Remove Add-Ons (Light Tank) from (Last restored unit)
          • Unit - Remove Add-Ons (MRLS) from (Last restored unit)
          • Unit - Remove Add-Ons (Mammoth) from (Last restored unit)
          • Unit - Remove Add-Ons (Medium Tank) from (Last restored unit)
          • Unit - Remove Add-Ons (Minigunner) from (Last restored unit)
          • Unit - Remove Add-Ons (Orca) from (Last restored unit)
          • Unit - Remove Add-Ons (Recon Bike) from (Last restored unit)
          • Unit - Remove Add-Ons (Rocket Soldier) from (Last restored unit)
          • Unit - Remove Add-Ons (SSML) from (Last restored unit)
          • Unit - Remove Add-Ons (Stealth Tank) from (Last restored unit)
          • Unit - Remove Add-Ons (Chinook) from (Last restored unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_A Less than Integer_B
        • Then - Actions
          • Set Integer_A = (Integer_A + 1)
          • Trigger - Run (This trigger) (checking conditions)
        • Else - Actions
 
Level 11
Joined
Feb 23, 2009
Messages
577
In my campaign I am making, you are able to research different techs (units, upgrades, etc). I don't want people to be able to purchase a tech, then test it out, then reload. Once they purchase a tech they have it for good on their "account".

I can do it at a lower frequency but I still want it to be a quick periodical.

(I am open to suggestions just want this to work)
 
Level 11
Joined
Feb 23, 2009
Messages
577
I am just storing the units into the cache (rest works fine), and it does work on dead heroes but for some reason not "100%" lol, making it very useless ://... All this is very experimental to me. Works 100% with live units though... Which is bugging me...
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
What's happening is that you save dead heroes and when you load from cache you found them revived ain't this the problem ?

<<< EDIT >>>

If this is your problem, then you must know that game cache save the hero's level, attributes and items but life and mana are not saved you have to store them by yourself.

Here is what you should do with your saved heroes.


The last 2 triggers contains what you need

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MapCentre = (Center of (Playable map area))
      • Unit - Create 1 Paladin for Player 1 (Red) at MapCentre facing Default building facing degrees
      • Set Hero[1] = (Last created unit)
      • Unit - Create 1 Archmage for Player 1 (Red) at MapCentre facing Default building facing degrees
      • Set Hero[2] = (Last created unit)
      • Unit - Create 1 Mountain King for Player 1 (Red) at MapCentre facing Default building facing degrees
      • Set Hero[3] = (Last created unit)
      • Unit - Create 1 Blood Mage for Player 1 (Red) at MapCentre facing Default building facing degrees
      • Set Hero[4] = (Last created unit)
      • -------- -------- -------- -------- -------- -------- -------- -------- -------- --------
      • Game Cache - Create a game cache from AC.w3v
  • Kill Unit
    • Events
      • Player - Player 1 (Red) types a chat message containing kill as A substring
    • Conditions
    • Actions
      • Set SelectedGroup = (Units currently selected by Player 1 (Red))
      • Set SelectedUnit = (Random unit from SelectedGroup)
      • Unit - Kill SelectedUnit
  • Save
    • Events
      • Player - Player 1 (Red) types a chat message containing save as A substring
    • Conditions
    • Actions
      • Game Cache - Clear all labels of test in (Last created game cache)
      • -------- -------- -------- -------- -------- -------- -------- -------- -------- --------
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Game Cache - Store Hero[(Integer A)] as (Hero + (String((Integer A)))) of Test in (Last created game cache)
          • Game Cache - Store (Life of Hero[(Integer A)]) as (HeroLife + (String((Integer A)))) of Test in (Last created game cache)
          • Game Cache - Store (Mana of Hero[(Integer A)]) as (HeroMana + (String((Integer A)))) of Test in (Last created game cache)
          • Unit - Remove Hero[(Integer A)] from the game
      • -------- -------- -------- -------- -------- -------- -------- -------- -------- --------
      • Game Cache - Save (Last created game cache)
  • Load
    • Events
      • Player - Player 1 (Red) types a chat message containing load as A substring
    • Conditions
    • Actions
      • Game Cache - Reload all game cache data from disk
      • -------- -------- -------- -------- -------- -------- -------- -------- -------- --------
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Game Cache - Restore (Hero + (String((Integer A)))) of Test from (Last created game cache) for Player 1 (Red) at MapCentre facing 0.00
          • Unit - Set life of (Last restored unit) to (Load (HeroLife + (String((Integer A)))) of Test from (Last created game cache))
          • Unit - Set mana of (Last restored unit) to (Load (HeroMana + (String((Integer A)))) of Test from (Last created game cache))
          • Set Hero[(Integer A)] = (Last restored unit)
 
Last edited:
Status
Not open for further replies.
Top