Hiya Everyone...
I've been searching and searching and have also not been able to find a specific answer to this question in the documentation. So, I'm hoping that someone can give me some insight and save me a few days of complicated testing and experimenting to figure it all out.
BACKGROUND
I'm working on a fairly complicated game that will have a series of "Episodes" or "Missions" that will be released over a period of time. There will be one "BASE GAME" (Game.exe) that controls everything, and then each "Mission" will have it's own Mission000.exe. Since I would like to have the events of one mission affect another, I need to carry over a lot of variables.
My problem is that I'm not exactly sure just WHAT carries over when I run the game. The documentation doesn't seem to include some of the changes made in the "Game Variables (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25193.0)" thread. And the docs also have the cryptic "and so forth" which doesn't really explain what is shared all that well.
THE SITUATION
I've got, for example, 5 characters with a Trait called "Resistance". It's in an array as CHRResistance[X] where X is the ID of that character. I've made a Module for this that has all of these array variables available throughout the game. This module is included in each of the mission games, as well as the base game.
So now, in Mission 1, Character 2 gets their resistance lowered to 20 (from the original 50). If I now run "Mission2.exe, 1, 0" (The 1 keeps the "GlobalInt" values according to the docs) - will the CHRResistance[2] variable be 20? or would it not be initialized at all and be "null" - or exactly what would happen?
If it doesn't carry over, then I suppose it's possible to dump all my arrays into a file and then read that file in the new mission game - but it seems like a lot of work and makes it difficult to adapt and add to the concept as things go on.
I have some other workaround ideas, but they vary depending upon the answers I get here, so I will hold off on them until I get a response - and then we can look deeper, if necessary.
Thanks in advance for any help you may be able to offer.
Doc
Hi Doc,
If you set the RunAGSGame() mode parameter to a value of 1 then global ints are preserved from game to game. Your module would have to use the SetGlobalInt() and GetGlobalInt() functions to read and write to global ints.
You may want to look into my MiniGame module. It features an additional data passing mechanism and a Call/Return mechanism that restores the calling games's state when the called game returns.
I am in the process of releasing an updated version, It should be up sometime to day. In the meantime you can find a discussion and a link to the older version here:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24879.0
I'll let you know when the new version is available.
Cheers
Great. Thanks for that! I was afraid it was only the "Global Ints" that carried over, but being able to get back to a previous state when switching back from a different game would surely be helpful - then I only need to track the variables that change rather than EVERYTHING in the game.
Thanks again and I'll check out your module tomorrow when I get back to coding.
Doc
One more question (for you or anyone else who wanders in here...) are GlobalStrings carried over as well as GlobalInts?
Doc
Hi Doc,
The answer to your last question is No., I do not believe global strings are carried over from one game to the next. However the MiniGame module does pass strings and int from game to game. I just released a new version and you can get it here:
MiniGame Module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24879.0)
I have also released a new version of DemoQuest and its mini games. You can get them here:
DemoQuest Examples (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23083.0)
If you need any other help just shout. Cheers
Thanks for this! Just got back from a holiday trip and it was nice to find a present here under the tree. :)
I've done a bit more exploration since I started this discussion and, despite my frustration that I give things names but can't access those things via those names at runtime, I think I've managed to get a handle on how I need to work it all out. Your module will definitely save me a lot of coding time since I can pass along a lot of variables without needing to write to files. Then it's just a matter of a "translation table" so that I can tell the game "object[0]" in Game 01 is equal to "object[10]" in game 02.
Cheers and happy holidays!