HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Jass Gurus your thoughts.

01-04-2004, 09:08 PM#1
weaaddar
http://www.wc3campaigns.com/forums/s...threadid=42949



Alright forget about the first two limitations listed. The first one is easy as cake to fix if I cared so much to fix it.
The second one is possible but is very very difficult.

The last one though. I know full well that my main clientel will be Mplayer RPG creators, who can probably deal with out save codes and campaign makers. The Splayer campaign creators can not just ignore caching units between maps.

My idea is to create a function that will save and load cache a 'hero' (I create as close to an object as possible) by just using his heronum . Unfortuantly I have no idea how to use cache but it looks from what I'm poking at is there is no actual way to store arrays. It would be simple if my arrays were terminating at set values but as they can reach the full point and jass seems to hate iterating through many arrays... Any suggestions?
01-04-2004, 09:21 PM#2
Extrarius
Well, what you could do is basically create a 'save code' for the hero and store it as a string (and it can be really long since the player doesn't have to remeber it). You could then store the hero under two keys (one for the unit and one for the data your functions need) and load it simmiarly. Just store the hero unit like normal,
then save a string that has info about the items: the number of slot 1 items it has, an index of which is equipped (0 for none, 1 for first one, etc), and then the ids of the items seperated by spces, then the number of slot 2 items, which is equipped, the ids for them, etc
Then you'd just go through the list of numbers one at a time when loading and fill the arrays your inventory code uses with items of the type id loaded from the string.

You might need to use several triggers to get around the function call limit, but that should be easy. If you use 'integer a' or a global variable, you could really use the same trigger over and over in a loop basically using TriggerExecuteWait.