• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Game Cache Problems

Status
Not open for further replies.
Level 3
Joined
Jun 9, 2013
Messages
51
I am working on a campaign but the first problem I couldn't solve is Game Cache. I want to create separate classes, each with separate EXP, health and Mana, but with the same Stats (str, Agi, Int).
This is why I'm asking you: what does a "Game Cache - STore Unit" function stores? Only the unit's basic information (what you set in the Unit Editor)? The Experience of the Heroes? Skills and skill levels? inventory?
I also stored gold and lumber (second currency, lumber will be changed to silver). Is this enough: "store Int (Current gold of Player 1) as Gold" and at the second map (the system will be like Rexxar's campaign) the trigger is "Set Player 1's Gold to (Game Cache - Load Gold)"?
And, for third: how can I do that I want to have 3 heroes (ok, there will be more) bit you can only play with one, because they will be classes, and if you enter a submap using Mage and want to return with Bandit, then can I simply move and replace the Mage on the main map by a bandit and set its inventory the same? Or do I have to remove the mage from the game before map switching starts, and then place a new bandit in the arrival area if I load the map again?
And for fourth, I want the other, currently unused classes (i mean if you are using the Bandit, then the unused classes are Mage and Warrior) stored somewhere, but they must be removed from the game (they must not exist as units, but only data that can be placed as an unit, like in Game Cache) but in specific regions I want them to be replaced by anither class (or let's just say I want to switch a class), then what do I have to do? Save the unit's inventory, store it into Game Cache, and restore the other unit to a set position?

Thanks for your help.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) It stores experience, attributes, max HP and mana, items and abilities picked.
2) Yep, should work.
3) Store each hero with as Label the hero name, and as category "Heroes" (e.g.: Store YourHero in Mage of Heroes in GameCache).
You can reload/remove those heroes at any point in the game you like.
4) Not really sure what you mean here. Is it just the class that switches while everything else remains the same?
If so: reload both heroes (the current class and the class you're going to switch into) and set all data for the class you're switching into the the current classes data.
Basically: set attributes to the same thing, give the same items and all that.
After that, remove the current class and use the newly switched class to continue (and save into the game cache).
 
Level 3
Joined
Jun 9, 2013
Messages
51
I meant that I want to remove the original unit and place the new unit in its position, but with Game Cache.
Well, to do what you've said, I have to detect the class of the Hero, but I can't use Unit Comparison. So I created a string (Hero_type) and if I switch class the it switches to the class's name (so if I switch to Mage then it sets the variavle to "mage"). Then, I create 3 or more if-s and if the "Hero_type" variable is equal to "Mage" then it saves it as Mage, if it's Warrior then it saves it into Warrior and so on.
This way the trigger will know which hero am I using currently. Is this a good method?

So if I want to save my hero I have to do this (I have created the Game Cache in a previous trigger, named as Cache; [these are my comments]):

If ((Entering unit) Equal to Hero_selected [This is an unit stored into a variable, every time when I change my class then it will store the new unit into this variable and it replaces the previous one]) then do (Do nothing) else do (Skip remaining actions) [if the triggering unit is the hero, then the trigger starts working, if not, then it stops]
Game Cache - Store Hero_selected as Hero_type [the string] of Classes in Cache
Game Cache - Store Hero_type as Hero_type of Mike in Cache [this stores the string that will allow me to recall the unit needed without knowing what class is it].

Or a picture:



Is this good for storing the hero?
If so the placing will be quite easy. If what I think is right. And it exactly is:
I remove a hero from the game, after storing it into a Game Cache and place this hero again by using the data in the Game Cache. Will this method cause anything wrong? Bec. if not then my job is only to remove the hero from the game after storing it into the game cache but before loading the map and placing it again. My main problem is: will the dead hero icon (or the normal) stay in the top left of the screen, and will it be shown on the score screen? Or it just disappears like it never existed?

Anyway, thank you for your help. +rep
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
I agree with Almia. Better use Multiple ITE. Because as far as I know even if the ITE's If is met or not, it will still do the Storing of Game Caches because itis not under the ITE even.

So as what Almia said and what I have agreed to, use Multiple ITE.
 
Level 3
Joined
Jun 9, 2013
Messages
51
It took some time to understand that ITE means If-Then-Else. So, you say that instead of isung a simple if, create an ITE with multiple functions and put the game cache in the Then section?
 
Level 25
Joined
Sep 26, 2009
Messages
2,387
You can use ITEs in real life situations too :D
If sky is clear, then it will be a nice day, else it will rain :>

If
- sky is clear
Then
- nice day
Else
- rainy day

------------------------
If the weather is nice today, I will ride bicycle, else I will stay home

If
- nice weather
Then
- riding bicycle
Else
- stays home
 
Status
Not open for further replies.
Top