Save & Load system?- HELP
by Alias Leung · in Technical Issues · 05/27/2008 (2:13 am) · 4 replies
HI! i get some problem when i develop my rpg game in Save & Load system.
When i use the new ScriptObject method to save my character attribute such as life
/*
new ScriptObject(PlayerData)
{
Health = $life;
};
/*
And then i attach the following code in my save and load button
function MainMenuGui::save( %this )
{
PlayData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
function MainMenuGui::load( %this )
{
exec("AdventureKit/gameScripts/File.cs");
echo("loadgame");
echo($life);
}
/*
When i running the game there is no error, but i still can't load the file data. WHY?
When i use the new ScriptObject method to save my character attribute such as life
/*
new ScriptObject(PlayerData)
{
Health = $life;
};
/*
And then i attach the following code in my save and load button
function MainMenuGui::save( %this )
{
PlayData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
function MainMenuGui::load( %this )
{
exec("AdventureKit/gameScripts/File.cs");
echo("loadgame");
echo($life);
}
/*
When i running the game there is no error, but i still can't load the file data. WHY?
#2
i try the code that you have provide
function MainMenuGui::load( %this )
{
exec("AdventureKit/gameScripts/File.cs");
echo("loadgame");
echo(PlayerData.Health);
}
i can see the life is same of the health by checking the[ echo(PlayerData.Health); ]
but how to apply the life value to my character while my character life is load by [ $life=%this.life; ]
05/27/2008 (9:33 pm)
Thank for you answering!i try the code that you have provide
function MainMenuGui::load( %this )
{
exec("AdventureKit/gameScripts/File.cs");
echo("loadgame");
echo(PlayerData.Health);
}
i can see the life is same of the health by checking the[ echo(PlayerData.Health); ]
but how to apply the life value to my character while my character life is load by [ $life=%this.life; ]
#3
05/27/2008 (10:57 pm)
Try yourPlayerObject.setEnergyLevel(PlayerData.Health).
#4
function MainMenuGui::save( %this )
{
PlayData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
shouldn't it be:
function MainMenuGui::save( %this )
{
PlayerData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
05/28/2008 (5:10 pm)
I noticed that in your save function you havefunction MainMenuGui::save( %this )
{
PlayData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
shouldn't it be:
function MainMenuGui::save( %this )
{
PlayerData.save("AdventureKit/gameScripts/File.txt");
echo("savegame");
}
Torque Owner Shaderman
Oh and try something like that to print the data:
function MainMenuGui::load( %this ) { exec("AdventureKit/gameScripts/File.cs"); echo("loadgame"); echo([b]PlayerData.Health[/b]); }