Restoring, And Storing Hero in game Cache not working

Slayerxx

You can change this now in User CP.
Reaction score
3
So i have two heros, Both the same but one is a stronger tank and the other is a weaker striker. What i want to do is when the Tank decides that her would like to hit faster, Use's an Attack Stance ability, it removes the tank and changes the hero to weaker striker. I have this setup in game Caches so it retains the other learned abilities and such. here are the triggers here.

This Trigger Sets up the Original Game cache and stores the Tank and Striker Unit into its own game Cache.
Trigger:
  • Create GameCache
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Trained unit)) Equal to Arthas - Slow Strong
        • Then - Actions
          • Game Cache - Create a game cache from Full Hero.w3v
          • Set GameCache[1] = (Last created game cache)
          • Set USlow_Strong_Hero = (Trained unit)
          • Game Cache - Store (Trained unit) as Strong Hero of StanceHeros in GameCache[1]
          • Game Cache - Save GameCache[1]
          • Unit - Create 1 Arthas - Fast Weak for (Owner of (Trained unit)) at ((Position of (Trained unit)) offset by (100.00, 100.00)) facing Default building facing degrees
          • Set UFast_Weak_Hero = (Last created unit)
          • Game Cache - Create a game cache from Full Hero.w3v
          • Set GameCache[0] = (Last created game cache)
          • Game Cache - Store (Last created unit) as Weak Hero of StanceHeros in GameCache[0]
          • Game Cache - Save GameCache[0]
          • Unit - Remove (Last created unit) from the game
          • Game - Display to (All players) the text: (Name of UFast_Weak_Hero)
          • Game - Display to (All players) the text: (Name of USlow_Strong_Hero)
        • Else - Actions


This Then Updates Each Hero in there Game Cache when they learn a Skill.
Trigger:
  • Update GameCache
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learning Hero) Equal to UFast_Weak_Hero
        • Then - Actions
          • Game Cache - Clear GameCache[0]
          • Game Cache - Create a game cache from Full Hero.w3v
          • Set GameCache[0] = (Last created game cache)
          • Game Cache - Store (Learning Hero) as Weak Hero of StanceHeros in GameCache[0]
          • Set UFast_Weak_Hero = (Learning Hero)
          • Game Cache - Save GameCache[0]
          • Game - Display to (All players) the text: (Name of UFast_Weak_Hero)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learning Hero) Equal to USlow_Strong_Hero
        • Then - Actions
          • Game Cache - Clear GameCache[1]
          • Game Cache - Create a game cache from Full Hero.w3v
          • Set GameCache[1] = (Last created game cache)
          • Game Cache - Store (Learning Hero) as Strong Hero of StanceHeros in GameCache[1]
          • Set USlow_Strong_Hero = (Learning Hero)
          • Game Cache - Save GameCache[1]
          • Game - Display to (All players) the text: (Name of USlow_Strong_Hero)
        • Else - Actions


Finally This Changes the hero Between the 2 hero's.
Trigger:
  • Change Stance
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack Stance Change
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Casting unit) Equal to UFast_Weak_Hero
        • Then - Actions
          • Game Cache - Restore Strong Hero of StanceHeros from GameCache[1] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Facing of (Casting unit))
          • Unit - Remove (Casting unit) from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Casting unit) Equal to USlow_Strong_Hero
        • Then - Actions
          • Game Cache - Restore Weak Hero of StanceHeros from GameCache[0] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Facing of (Casting unit))
          • Unit - Remove (Casting unit) from the game
        • Else - Actions


So the Problem is that when you go to Cast the Attach Stance ability the Tank is Removed (as he is the Default hero) and Then the Weak Hero is not Created. Help.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Why not use the trueform ability? The bear from the night elves uses that to change into a bear and back to it's original easily. However you can only morph a hero into a unit, and back to hero if I remember correctly.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
im pretty sure the way the trueform ability works is it adds the 2nd form's stats on top of the original and keeps it a hero, ie: if your "True Form" has 100 health in the object editor, it would stack that on the top of the original units stats. That is completely based on heresay and not tested by me.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Well I tried it myself, and it doesn't work properly. The cooldowns and skills don't transfer very well, if I remember correctly.
 

Slayerxx

You can change this now in User CP.
Reaction score
3
Thanks For the tip, but i managed to get it a diffrent way but thankyou XD
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top