gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfxgfx
 
Members, please note that our guidelines are located here.
 
gfx gfx
gfx
484586 Posts in 28410 Topics by 2464 Members - Latest Member: austinrobert July 11, 2020, 07:59:31 PM
*
gfx* Home | Help | Calendar | Login | Register | gfx
gfx
The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  [Theory]Custom Save Menu
gfx
gfxgfx
 

Author Topic: [Theory]Custom Save Menu  (Read 1896 times)

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
[Theory]Custom Save Menu
« on: August 19, 2009, 06:05:54 PM »
In the past ffomega wanted to create a custom save menu to show off the different items that were collected for each save file. Well I may have found a way to do it, as long as your willing to only use three of the save files to choose from.

When testing saving and loading during game play, I noticed that counters do not reset(hopefully that is it). So I used this to my advantage to get some data from the different save files.

Code: [Select]
#include <entity>
#include <general>
#include <counter>
#include <core>

main()
{
if(ZKey())
{
SetCounterValue("rupees",random(200));
SetGlobal(0,GetCounterValue("rupees"));
}

if(WKey())
{
for(new n; n < 2; n++)
{
SetCounterValue("SaveFile",n);
LoadGame(n);
new c = GetCounterValue("SaveFile");
if(c == 0)
SetCounterValue("Rupee1",GetGlobal(0));
else
SetCounterValue("Rupee2",GetGlobal(0));
}
}

new string[16];
ToString(GetCounterValue("Rupee1"), string);
DrawText(string, 120, 200, 255,255,255,255);
ToString(GetCounterValue("Rupee2"), string);
DrawText(string, 120, 220, 255,255,255,255);
}

In this script when you press the ZKey you get a random amount of rupees. When you press the WKey it loads game0, and game1. I then used the counters Rupee1, and Rupee2 to get the Global Value of 0(Globals are saved after all). I was then able to get the rupee amounts for each of the saved files.

So this little trick just may come in handy for anyone who wanted to go custom.
To prevent a freezeup, save in the fourth slot. However you will need to set a method up to ignore this file, because if there are no other save files this one will read as your first slot.


I plan on using this theory for my current quest in the future, to see how it works out.
I call this a theory because I'm not sure what bugs will occur. Also wonder if a larger quest will cause a huge delay or not.


edit:
starting to test my theory a little further by adding it to my quest.

Code: [Select]
#include <enhanced>
#include <float>

new check;
new count;

new Msg[100] = "Initilzing Data...";

main()
{
AdvanceText(Msg,320 - (8 * strlen(Msg)),110,2);

if(FirstRun())
{
SetGlobal(0,1);//File Exists
SaveGame(3);
return;
}

if(check == false)
CheckFiles();
else if(count < 4)
HandleSaves();
else
SetPosition("player1",500,120);
}

CheckFiles()
{
for(new n; n < 4; n++)
{
LoadGame(n);
if(GetGlobal(0) == 0)
count++;
}
check = true;
}

HandleSaves()
{
SetGlobal(0,1);//File Exists
for(new n; n < 3; n++)
SaveGame(n);
count = 4;
}

I've used this script in the very first screen that I see (0,0). First it Saves a default file, which is the last slot. Without it, OZ would freeze up. Next it checks to see if there are four default slots in total, I used a Global to help confirm it. After everything is completed it warps the player to his default coordinates.

For my Alien Invasion it took about 10 sec to loop through this data (first time was quicker).
I disabled the main script in my quest for quicker loading for now.

« Last Edit: September 26, 2009, 10:53:58 AM by KingOfHumans »

Offline Luke

  • Regimental
  • ****
  • Posts: 1,823
    • View Profile
[Theory]Custom Save Menu
« Reply #1 on: August 20, 2009, 01:22:07 AM »
Sounds like a good workaround, nice job.
Thankfully I don't have to come up with stuff like that anymore since moving to the Lux Engine aka Hyrulean Adventures.

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #2 on: September 26, 2009, 09:26:05 AM »
Well did some further testing and this may have to be handled in a screen/group script for it to work properly. I used this script below.

Code: [Select]
LoadData()
{
for(new n; n < 4; n++)
{
SetCounterValue("SaveFile",n);
LoadGame(n);
new c = GetCounterValue("SaveFile",n);
//if(GetGlobal(0) == 0)
//{
// SaveGame(n);
// continue;
//}
if(c == 0)
{
// SetCounterValue("Rupee1",GetValue("this",1));
}
else if(c == 1)
{
//SetCounterValue("Rupee2",GetValue("this",1));
}
else if(c == 2)
{
//SetCounterValue("Rupee2",GetValue("this",1));
}
}
}

Now when I used LoadData() as part of a screen script, it worked fine. Now when I made it "public LoadData" and handled it as  CallFunction it crashed. I didn't even use "Init" so nothing should of resetted, unless if all entities files stop running during game loading.


edit: Did some further testing and got it to start working for my AI quest. During my modifying it crashed but not 100% sure why. It might have to do with the main script (I disabled this later), might have to do with lag, or maybe there's another reason.
« Last Edit: September 26, 2009, 10:55:57 AM by KingOfHumans »

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #3 on: January 18, 2010, 09:56:58 PM »
In my AlienInvasion this loading saved files crashed until I disabled my player.
Also I made sure to not load anything in the mainscript until after everything is done loading from each saved file.

So far this theory is working quite well except for the waiting time.

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #4 on: August 31, 2010, 10:53:51 PM »
Screw that system, I might of found a better one.
Loading all those files takes a lot of time to load. I don't notice any lag when doing it this new way.

I'm now having it save twice.
One for the current game file (0, 1, or 2) and slot 3.
Slot 3 will only be used to draw the menu data.
I'm using SetValue to save data for each menu.

So far this set up is working as my custom menu is drawing the Names, and health so far. For anyone that wants to experiment this is my current set up.

Code: [Select]
public OwlSave()
{
new save = GetCounterValue("SaveFile");
new PName[20];
GetPlayerName(PName);
SetString("this",save,PName);
SetValue("this",30 + save, 1);//save file exists
SetValue("this",33 + save, GetCounterValue("rupees"));//for the save menu
SetValue("this",36 + save, GetMaxHealth("player1"));
SaveGame(3);
SaveGame(save);
}

Offline Luke

  • Regimental
  • ****
  • Posts: 1,823
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #5 on: September 02, 2010, 08:58:05 PM »
Sorry why not just modified the Open Zelda source, and allow GetPlayerName* function to access the name in other saves? (you can store non-zero value before the name)
I use a similar system in open legends and that works exactly what your trying to do.

* by modify GetPlayerName, instead of creating a new function allow old versions to run it as well.

Offline Aliem

  • Ț̼͍̩̹̥̞̩̖͝ ̺̰̟͝s̸҉̜̜̘̥̥̤̬͓͔̰͔̩ͅ ̴̡̭̪͍͇̕c̦̀̀͡ͅ&
  • Advisor
  • Messiah
  • *
  • Posts: 13,311
  • Oh hai Mark
    • View Profile
[Theory]Custom Save Menu
« Reply #6 on: September 02, 2010, 09:17:18 PM »
That would be an ideal solution, if the source to 6.5 was available.  6.4 is way too bug infested.  Though maybe 6.3 could be worked on.

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #7 on: September 02, 2010, 10:07:15 PM »
I see no point in modifying the source anymore when it comes to new functions. Anything we add will have to be undone for the next version. Now when it comes to little things like proper light/darkness(bug), or smoothing out scrolling(another bug), and similar bugs I'm fine with it.

Besides this method (if works) isn't hard to do and should work great.

Offline Luke

  • Regimental
  • ****
  • Posts: 1,823
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #8 on: September 02, 2010, 11:38:27 PM »
That would be an ideal solution, if the source to 6.5 was available.  6.4 is way too bug infested.  Though maybe 6.3 could be worked on.
it kind of reason why I posted the Open Zelda Community version, I thought that you guys could get the hang of it, you might be able to see your own OZ7 by this decade :)

Quick look at source says that getting GetPlayerName to read the name of the save file isn't that hard, you would just have to call g_pGame->GetSaveLoad()->FillSaveGameInfo() and the info should be in g_pGame->GetSaveLoad()->m_sSlots[] array.

I see no point in modifying the source anymore when it comes to new functions. Anything we add will have to be undone for the next version.
by your logic, anything you're doing now (aka making a game), could be undone in the next version.
« Last Edit: September 03, 2010, 12:25:16 AM by Luke »

Offline Aliem

  • Ț̼͍̩̹̥̞̩̖͝ ̺̰̟͝s̸҉̜̜̘̥̥̤̬͓͔̰͔̩ͅ ̴̡̭̪͍͇̕c̦̀̀͡ͅ&
  • Advisor
  • Messiah
  • *
  • Posts: 13,311
  • Oh hai Mark
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #9 on: September 03, 2010, 01:01:09 AM »
lol, that's a good point.  I haven't yet even looked at the source, I know I haven't got the time or drive to code an engine myself.  I've tried in the past, a couple times, and just didn't have the passion.  Eh, maybe I'll give it a look eventually.  =p

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #10 on: September 03, 2010, 08:00:04 AM »
So your saving I should just use one string for storing saved data?
Well that would be 15 extra characters stored for the string. Could work.

Offline Luke

  • Regimental
  • ****
  • Posts: 1,823
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #11 on: September 04, 2010, 10:12:06 PM »
So your saving I should just use one string for storing saved data?
Well that would be 15 extra characters stored for the string. Could work.
I'm saying if you modify GetPlayerName function you could use the player name string to store the data. It's not the ideal way* of storing the data, but seem dead simple to implement and doesn't seem to a have a flaw in it like you theory does.

* See https://sourceforge.net/apps/trac/mokoi/wiki/Scripting%3BPawn#SaveFunctions for my ideal way.

Offline Aliem

  • Ț̼͍̩̹̥̞̩̖͝ ̺̰̟͝s̸҉̜̜̘̥̥̤̬͓͔̰͔̩ͅ ̴̡̭̪͍͇̕c̦̀̀͡ͅ&
  • Advisor
  • Messiah
  • *
  • Posts: 13,311
  • Oh hai Mark
    • View Profile
Re: [Theory]Custom Save Menu
« Reply #12 on: September 05, 2010, 01:34:31 AM »
Those save functions are exactly what I needed back when I was attempting my .hack style quests.  I like it.

The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  [Theory]Custom Save Menu
 

gfxgfx
gfx
SMF 2.0.17 | SMF © 2019, Simple Machines Page created in 0.18 seconds with 21 queries.
Helios Multi © Bloc
gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!