|
Re: game_load
[Re: Logitek]
#453194
07/11/15 08:13
07/11/15 08:13
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Have you checked if the savegame is in the folder? With and without levels-option.
Which OS do you use? And in which folder do you write? I mean, is it in the program folder? or anywhere else? Because of rights.
What kind of level has the game? You can try to make a simple level with wed and start it instead of your level and try to save it with your script. I think it will work, because I don't see a problem with the lines you have posted.
Without subtracting SV_LEVELS from SV_ALL, no savegame shows up in the folder. With subtracting SV_LEVELS from SV_ALL, a savegame does show up in the folder. I use Windows 7, 32 bit. I am not specifying which folder to write the save_game to. The savegame file shows up in the same folder as my main script file and other SED files used. What do you mean by "kind of level"? I have multiple WED files associated with this game, to save memory. If the player walks into a door in a particular room for instance (door using EVENT_IMPACT), a new WED file will be loaded to represent the area on the other side of the door.
Last edited by Ruben; 07/11/15 08:13.
|
|
|
Re: game_load
[Re: Ruben]
#453232
07/13/15 07:10
07/13/15 07:10
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
I found a rule in the manual for game_save that "levels, scripts, and objects must not change between game_save and game_load, with exception of level entities. All .._create and .._remove functions, except for creating and removing level entities, must be executed before the first game_save or game_load call. Thus, the number of engine objects like panels or texts must be the same at save and load time. When the script was changed in any way, or when the number of objects is different, game_load will fail." I am trying to have everything execute before the game_save and game_load commands. Basically, when I play a game and save, and then quit and reload the game, and click the LOAD GAME button, I get this pop-up error:
E1513
Script crash in buttonLoadGame:
OK Cancel
My buttonLoadGame() function code looks like this:
...
function buttonLoadGame()
{
reset(introBackgroundImage, SHOW); // SHOWS JPEG AS SCREENSHOT
reset(Arulia_Title, SHOW); // SHOWS TITLE OF GAME
reset(beginGameButtons, SHOW); // SHOWS "NEW GAME" AND "LOAD GAME"
// BUTTONS
snd_stop ( songHandle); // STOPS THE INTRO SONG
beep(); // THIS BEEP DOES SOUND OFF.
if (game_load("test",7) > 0) // TRIES TO LOAD THE GAME
{
beep(); // THIS BEEP DOES NOT SOUND OFF.
}
else
{
//beep(); // THIS BEEP DOES NOT SOUND OFF.
}
beep(); // THIS BEEP DOES NOT SOUND OFF.
change_mouse_mode();
}
...
So, the last beep that sounds off is just before the game_load instruction. This seems to tell me that there is something wrong going on with game_load. Once I click OK on the pop-up error mentioned before, the screen will look black, except the player's health (at the time of the last save) shows up on the screen. I thought I minimized, transferred, or eliminated all the code from taking place between the game_save and game_load instructions or after them, as shown here:
// START OF MAIN SCRIPT FILE
...
#include "end_game.c"
#include "gameStart_buttons.c"
#include "mainProgram.c"
// END OF MAIN SCRIPT FILE
...
// LAST FUNCTION IN endGame.c
function buttonSaveGameQuit()
{
result = game_save("test",7,SV_ALL-SV_LEVEL); // SV_LEVEL GIVES ERROR
if (result <= 0) { error("Save Error!"); }
sys_exit("123");
}
...
// LAST FUNCTION IN gameStart_buttons.c
function buttonLoadGame()
{
reset(introBackgroundImage, SHOW);
reset(Arulia_Title, SHOW);
reset(beginGameButtons, SHOW);
snd_stop ( songHandle);
beep(); // THIS IS BEEPING
if (game_load("test",7) > 0)
{
beep(); // THIS IS NOT BEEPING
}
else
{
beep(); // THIS IS NOT BEEPING
}
beep(); // THIS IS NOT BEEPING
change_mouse_mode();
}
...
function main()
{
...
set(introBackgroundImage, SHOW);
set(Arulia_Title, SHOW);
set(beginGameButtons, SHOW); // DISPLAYS "NEW GAME" AND "LOAD GAME" BUTTONS.
while(1)
{
if ( active_weapon != NULL )
active_weapon->pan += 5*time_step;
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
// if we've enabled the mouse:
if(mouse_mode > 0)
{
// move it's position with a cursor:
vec_set(mouse_pos.x, mouse_cursor.x);
}
wait(1);
}
sys_exit ( NULL );
// END OF ALL MY GAME PROGRAMS AND FILES.
}
Even though I pushed the game_save and game_load functions as far down as I could in the main script file, I am still bugs mentioned above. Anybody have a clue why?
|
|
|
Re: game_load
[Re: Ruben]
#453249
07/14/15 13:01
07/14/15 13:01
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
User
|
User
Joined: Mar 2012
Posts: 927
cyberspace
|
its quite simple , make a complete copy of your project , edit the copied project , remove everything one by one untill your left with the minimalistic size of the project where the bug is stil reproduced , upload your project , give us a download link ..
anything other than that is spitting in the wind.
Compulsive compiler
|
|
|
Re: game_load
[Re: EpsiloN]
#453408
07/25/15 01:26
07/25/15 01:26
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
So, I found out what was causing the pop-up error with game_save(). I had this code in my player_code:
action player_code()
{
...
my.shadow = 1; // THIS CAUSED THE game_save SCRIPT CRASH
...
}
The "my.shadow = 1" code caused the script crash when I used the SV_ALL flag for game_save, as shown below:
game_save("test", 7, SV_ALL);
Now that I commented "my.shadow = 1" code out, I am no longer getting a pop-up error when I game_save using only the SV_ALL flag. Now however, I am getting some new errors, particularly when I have entities in my level that use the ent_movepath() command to travel a preset route. After saving the game (seemingly successfully), restarting the game, and pressing the LOAD GAME button, I get a pop-up error that states:
Malfunction W1508
Can't load test7.SAV
OK Cancel
Once I click OK on this pop-up bug, another pop-up bug comes up saying:
Error E1515
Invalid function arguments in ent_placefloor
OK Cancel
When I press OK on this bug, I get another bug that immediately pops up as shown:
Error E1515
Invalid function arguments in ent_movepath
OK Cancel
When I click OK on this pop-up bug, the first "ent_placefloor" error repeats itself, and these two pop-up bugs (mentioned above) alternatively repeat themselves over and over forever when I keep clicking the OK button. Every time I click OK on these pop-up bugs, everything in the level, like moving entities, move a tiny increment in their movement pattern, in between every bug that I press the OK button on. I only get these two pop-up bugs when an entity is using the ent_movepath() command, in the level that I save the game in. If I comment out the ent_movepath() command from whatever entity in the level is using it, the load seems to work fine. As of now, I have a knight and ogre in my level that use the ent_movepath() command. Here are their code:
action ogre_action()
{
...
if(ogre_dead == 0)
{
ent_movepath(me, "path_003", 2, 1+2); // IF I COMMENT
// THIS OUT, THE game_load LOADS FINE.
}
...
}
action knight_action()
{
...
if(knight_dead == 0)
{
my.STATE = 1;
ent_movepath(me, "path_003", 2, 1+2); // IF I COMMENT
// THIS OUT, THE game_load WORKS FINE.
}
if(knight_dead == 1)
{
my.STATE = 4;
ent_movepath(me, NULL, NULL, NULL); // IF I COMMENT
// THIS OUT, THE game_load WORKS FINE.
}
while (1)
{
knight_loc();
knight_health();
// state 1: wait until player comes close enough //////
if(my.STATE == 1)
{
my.tilt = 0;
my.z = -544;
my.ANIMATION += 3*time_step;
ent_animate(me,"walk",my.ANIMATION,ANM_CYCLE);
// detect all FLAG2 entities within 750
// quants
c_scan(my.x,my.pan,vector(360,0,750),SCAN_ENTS | SCAN_FLAG2 | IGNORE_ME);
if (you) // player detected?
{
my.tilt = 0;
my.z = -544;
ent_movepath(my,NULL,0,0); // IF I COMMENT
// THIS OUT, THE game_load WORKS FINE.
snd_stop ( songHandle );
songHandle = snd_loop ( sndObBtl, 80, 0 );
my.STATE = 2;
enemy = your.CREATOR;
}
}
...
}
}
void temple_ogre()
{
if(ogre_dead == 0)
{
ogre = ent_create ( "ogre.mdl", vector(-693,-36,-567), ogre_action );
...
// CREATES PATH THAT OGRE WALKS ON.
path_create(ogre, 3, 3);
path_setnode(ogre, 1, vector(-692, -36, -567), NULL);
path_setnode(ogre, 2, vector(-269, -140, -567), NULL);
path_setnode(ogre, 3, vector(-773, 739, -567), NULL);
vec_set(ogre.min_x,vector(-9,-9,0)); // set bounding box to individual values
vec_set(ogre.max_x,vector(9,9,75));
}
else if(ogre_dead == 1)
{
ogre = ent_create ( "ogre.mdl", vector(ogre_x_loc,ogre_y_loc,ogre_z_loc), ogre_action );
ogre.scale_x = 0.23; // TEMPLE LEVEL OGRE SCALE
ogre.scale_y = 0.23;
ogre.scale_z = 0.23;
}
}
void temple_knight()
{
if(knight_dead == 0)
{
knight = ent_create ( "a_knight.mdl", vector(-879,-1744,-550), knight_action );
// CREATES PATH THAT KNIGHT WALKS ON.
path_create(knight, 3, 3);
path_setnode(knight, 1, vector(-1061, -1335, -567), NULL);
path_setnode(knight, 2, vector(-1224, -177, -567), NULL);
path_setnode(knight, 3, vector(-1964, -304, -567), NULL);
vec_set(knight.min_x,vector(-9,-9,-25)); // set bounding box to individual values
vec_set(knight.max_x,vector(9,9,35));
}
else if(knight_dead == 1)
{
knight = ent_create ( "a_knight.mdl", vector(knight_x_loc,knight_y_loc,knight_z_loc), knight_action );
}
}
function to_STemple_door_f() // ENTERING THE SOUTH DOOR OF TEMPLE ROOM
{
if(event_type == EVENT_IMPACT) // TOUCHING THE DOOR THAT LEADS INTO
// SOUTH ENTRANCE OF TEMPLE ROOM
// LOADS CODE BELOW.
{
...
temple_knight();
temple_ogre();
...
}
}
Can a game be saved when an entity in the level being saved in uses the ent_movepath() function to travel a certain route?
Last edited by Ruben; 07/25/15 06:56.
|
|
|
Re: game_load
[Re: Ruben]
#453440
07/27/15 01:43
07/27/15 01:43
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Maybe this is a more easily understandable message of my situation: I am able to save my game using game_save(). I can even successfully load the game I saved using game_load. However, if I saved a game while the player was in the same level as an entity that uses ent_movepath() to move along a certain path by default, I get errors when I try to load the game I saved, as shown:
Malfunction W1508
Can't load test7.SAV
OK Cancel
Once I click OK on this pop-up bug, another pop-up bug immediately comes up saying:
Error E1515
Invalid function arguments in ent_placefloor
OK Cancel
When I press OK on this bug, I get another bug that immediately pops up as shown:
Error E1515
Invalid function arguments in ent_movepath
OK Cancel
The two bugs above repeat themselves back and forth infinitely, every time I click their OK buttons. When I comment out the ent_movepath() function calls for the entities in the level, I do not get the above bugs anymore when saving and loading the game in that level. I am able to save and load the game just fine. Has anyone else come across this situation? Can the game be saved in a level containing an entity that uses the ent_movepath() function to move along a certain route by default?
|
|
|
Re: game_load
[Re: Ruben]
#453441
07/27/15 07:22
07/27/15 07:22
|
Joined: Nov 2009
Posts: 201
Logitek
Member
|
Member
Joined: Nov 2009
Posts: 201
|
W1508 means: You load a savegame that has nothing to do with your current script. for example: from other games I think that is not true E1515: I think you have a problem with a null pointer. Maybe you have changed anything between save_game and load_game. Try to save your game. Then kill the current level and load an empty level with level_load(""); And then try to load the game. Normally it should work. Otherwise there is anywhere an error.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|