• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Game Cache Problems

Status
Not open for further replies.
Level 3
Joined
Jun 9, 2013
Messages
51
I am about to make a complex RPG game, where you have only one character who can use several "classes" (the boring mage, paladin etc.). This means you don't have more heroes to command at a time, but you can switch between Mage Mike and Assassin Mike at certain places (this has a system).
However, when I want to store my hero at the Game Cache, It seems that the cache is created well and it is loaded (gold and lumber transprt works) but my unit won't be created in the new map. Is there something about this? Perhaps I did something what I shouldn't?

Map1 (From):
[Create game cache, set variable Cache as "last created game cache", store gold, lumber, this works, okay.]
Game Cache - Store Hero_type(string variable) as Hero_type_str of Classes in Cache
Game Cache - Store (Entering unit) as Hero_type(string variable, same as above) of Classes in Cache
Unit - Remove (Entering unit) from the game
Game - Set the next level to Stratholme.w3x
Game - Save game as Game.w3z and change level to Stratholme.w3x (Skip scores)

In the second step (store Entering unit as HT) I use the variable because if I currently use villager, then Hero_Type variable contains "villager" and my hero will be saved as "villager". And this variable gets stored (Hero_type_str) and loaded into the other map to make Wc3 know which character I was using.

Map2 (to):

[create cache, set variable Cache as last created game cache, load gold and lumber]
Set STR_Hero_type = (Load Hero_type_str of Classes from Cache)
Game Cache - Restore STR_Hero_type of Classes from Cache for Player 2 (Blue) at (Center of MapSwap country FROM <gen>) facing 270.00
Set UNIT_Hero_selected = (Last restored unit)
Game Cache - Save CACHE_Cache

The seccond trigger runs 0.10 seconds after map initialization (perhaps I should change this, I saw a "map loaded" function).

Both "villager" units are exactly the same, I have copied it from the other map.

Btw still don't know how to upload triggers here, so if somebody could tell me the way I'd be thankful.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
JASS:
[TRIGGER][/TRIGGER]
This is how you put triggers. Go trigger editor and when you see this:
  • THIS ICON
    • Events
    • Conditions
    • Actions
you right click on it and then click copy, then to post triggers here just type this
JASS:
[TRIGGER][/TRIGGER]
and then paste between the ] and [.
Make sure that the heroes from your second map has the same ID as the first one else it won't work. you can see ID by pressing ctrl + d. it appears h001 h002 h003 and etc.
 
Level 3
Joined
Jun 9, 2013
Messages
51
In Object editor, I have selected them and I have seen that in the first map, my thief (the hero) is H000 and on the second it's H006. How can I change the second map's thief's raw data value?

Btw just to try the script:
  • from Country
    • Events
    • Conditions
    • Actions
      • Game Cache - Create a game cache from Game.w3v
      • Set CACHE_Cache = (Last created game cache)
      • Player - Set Player 2 (Blue) Current gold to (Load Gold of Property from CACHE_Cache)
      • Player - Set Player 2 (Blue) Current lumber to (Load Silver of Property from CACHE_Cache)
      • Set STR_Hero_type = (Load Hero_type_str of Classes from CACHE_Cache)
      • Game Cache - Restore STR_Hero_type of Classes from CACHE_Cache for Player 2 (Blue) at (Center of MapSwap country FROM <gen>) facing 270.00
      • Set UNIT_Hero_selected = (Last restored unit)
      • Game Cache - Save CACHE_Cache
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
uh you need to copy all those units h000 h001 2 3 4 5 6 to a map, delete those on your real map and then replace (copy) the h006 from your other map which has the units and paste on your map.
It would be much better if you used a name of the hero:
  • Game Cache - Restore [NameOfHero]
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I have experienced that could not work in some cases, for instance in school our antivirus takes like 80% of CPU because the antivirus loops itself somehow, and when you terminate it from task manager he turns himself on again :D
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
I have experienced that could not work in some cases, for instance in school our antivirus takes like 80% of CPU because the antivirus loops itself somehow, and when you terminate it from task manager he turns himself on again :D

thats because ur turning off the exe file when u need to turn off the other file first. this makes it hard to see but easiest way to check is dont have anything else running on pc. then turn off exe file. look for any other file that jumps to a higher processing number. do it a few times to make sure u have the right file then end that one first then end the exe file.
 
Status
Not open for further replies.
Top