Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buu342

ACS variables reset upon loading save game

Recommended Posts

Recently I've been making a sewer based level, and in order for the player to get out he has to stop the leak by pressing one of the switches, then go to the next switch and drain the area. This has to be done in this order. So to make that happen, I used a variable checking system in ACS. It works, however if the player dies after pressing the first switch or loads the level, the variable is reset and the second switch cannot be pressed even though the player already pressed the first switch. Help?

#include "zcommon.acs"
int leak = 1;

script 8 (void)
{
ChangeCeiling (9, "VOID");
Ceiling_RaiseByValue(14,200,32);
Ceiling_RaiseByValue(9,200,32);
hudmessage (s:"Ok, I believe I've shut down the pipe system. This should allow me to drain the area now.\n"; HUDMSG_fadeout | HUDMSG_LOG, 20, CR_LIGHTBLUE, 0.5, 0.5, 7.0);
leak = 0;
autosave();
}

script 7 (void)
{
if(leak == 1)
{
hudmessage (s:"I can't drain the pipes until the leak has been stopped.\n"; HUDMSG_fadeout | HUDMSG_LOG, 20, CR_LIGHTBLUE, 0.5, 0.5, 7.0);
}
else if(leak == 0)
{
sector_setdamage(7,0,0);
sector_setdamage(15,0,0);
sector_setdamage(19,0,0);
sector_setdamage(20,0,0);
sector_setdamage(22,0,0);
sector_setdamage(23,0,0);
Floor_lowerByValue(8,200,104);
Floor_lowerByValue(24,200,104);
Floor_lowerByValue(14,200,104);
Floor_lowerByValue(15,200,88);
Floor_lowerByValue(22,200,16);
Floor_lowerByValue(23,200,88);
Ceiling_RaiseByValue(29,200,128);
thing_move(17,18,true);
ChangeFLOOR (7, "BROWNHUG");
ChangeFLOOR (19, "BROWNHUG");
ChangeFLOOR (20, "BROWNHUG");
ChangeFLOOR (22, "BROWNHUG");
ChangeFLOOR (23, "BROWNHUG");
hudmessage (s:"Alright, the whole area is drained. I should be able to enter the machine room now.\n"; HUDMSG_fadeout | HUDMSG_LOG, 20, CR_LIGHTBLUE, 0.5, 0.5, 7.0);
autosave();
}
}

Share this post


Link to post

If the player dies and restarts the level, or if he loads the level to a moment before pressing the first switch, it's the same as if he never pressed the first switch. That's normal and logical - restarting/reloading the game nullifies whatever the player did in his previous playthrough. He will have to replay the map again, press the first switch again, and so on. The logic of your script is OK.

Share this post


Link to post
scifista42 said:

If the player dies and restarts the level, or if he loads the level to a moment before pressing the first switch, it's the same as if he never pressed the first switch. That's normal and logical - restarting/reloading the game nullifies whatever the player did in his previous playthrough. He will have to replay the map again, press the first switch again, and so on. The logic of your script is OK.


I might not have explained it correctly. Lemme explain with something like this.

This is what's happening:

Player presses S#1, sets variable leak from 1 to 0
player saves game
Player dies
Player loads saved game
Player presses S#2, but it fails even though leak was set to 0 before he saved.

However if you press S#2 without dying/loading the game after you press S#1, it works without any problems.

Share this post


Link to post

By "it fails", do you mean that the switch cannot be pressed, or it can be pressed but displays the "I can't drain the pipes" hudmessage?

If the former: If your 2nd switch is *not* marked as "Repeatable", and if the player already pressed this switch before the first switch, the switch will not be possible to trigger again, because well, if it's not Repeatable, it can only be pressed once. This has nothing to do with saving/loading at all, though.

If the latter: It really shouldn't be happening. What port and what version are you using? Consider updating it.

Share this post


Link to post
scifista42 said:

By "it fails", do you mean that the switch cannot be pressed, or it can be pressed but displays the "I can't drain the pipes" hudmessage?

If the former: If your 2nd switch is *not* marked as "Repeatable", and if the player already pressed this switch before the first switch, the switch will not be possible to trigger again, because well, if it's not Repeatable, it can only be pressed once. This has nothing to do with saving/loading at all, though.

If the latter: It really shouldn't be happening. What port and what version are you using? Consider updating it.


By it fails, I mean it displays the "you must stop the leak before draining" message even though I already pressed the stop leak switch.

I'm using the latest version of Skulltag. Perhaps it will work on the newest version of Zandronum. Lemme check.

Share this post


Link to post

My Zandronum doesn't seem to include the Skulltag content along with it. Textures and enemies break as a result. Any solution for that?

Share this post


Link to post

Load your wad together with "skulltag_actors.pk3" and "skulltag_data.pk3" in Zandronum. (if you still get errors, find the newest versions of said pk3's)

Share this post


Link to post
scifista42 said:

Load your wad together with "skulltag_actors.pk3" and "skulltag_data.pk3" in Zandronum. (if you still get errors, find the newest versions of said pk3's)

That's a bit unintuitive. I'd expect the program to load those files directly since they come with the installation, but oh well. Thanks for all the help.

Share this post


Link to post

In Skulltag, these extra resources (textures, monsters, etc) were internal. Not all players desired to have them forcedly loaded, and their presence could break compatibility with some wads made for ZDoom. This is why Zandronum provides them as optional now, and *not loading* them is a default. After all, wads made for Skulltag are less frequent than all other wads together.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×