Frictional Games Forum (read-only)
[SCRIPT] Puzzle Script Won't Reset - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Puzzle Script Won't Reset (/thread-23918.html)



Puzzle Script Won't Reset - D3AD UPR1S1NG - 11-21-2013

Hey Smile I was just wandering if for the sake of a puzzle in my custom story whether it would be possible to reset the puzzle should the player fail it as I have attempted to reset the variables however it refuses to work a second time. The puzzle involves the player having to ignite torches in a specific order and if they get it wrong the torches will be unlit and the player will have to attempt it again.

I don't know if it's going to be of much use but here's the puzzle script Tongue
Code:
          void Equality(string &in asEntity, string &in type)
          {
          if(GetLocalVarInt("PuzzleLightCount") > 1 || GetLocalVarInt("PuzzleLightCount") == 1)
          {
          AddLocalVarInt("PuzzleLightCount", 1);
          }
          
          if(GetLocalVarInt("PicturePuzzle") == 1)
          {
          AddLocalVarInt("PicturePuzzle", 1);
          }
          
          if(GetLocalVarInt("PuzzleLightCount") == 5 && GetLocalVarInt("PicturePuzzle") < 5)
          {
          AddTimer("", 0, "PuzzleFail");
          }
        }
          
          void Congregation(string &in asEntity, string &in type)
          {
          if(GetLocalVarInt("PuzzleLightCount") > 1 || GetLocalVarInt("PuzzleLightCount") == 1)
          {
          AddLocalVarInt("PuzzleLightCount", 1);
          }
          
          if(GetLocalVarInt("PicturePuzzle") == 2)
          {
          AddLocalVarInt("PicturePuzzle", 1);
          }
          
          if(GetLocalVarInt("PuzzleLightCount") == 5 && GetLocalVarInt("PicturePuzzle") < 5)
          {
          AddTimer("", 0, "PuzzleFail");
          }
        }

          void Unity(string &in asEntity, string &in type)    
          {
          if(GetLocalVarInt("PuzzleLightCount") > 1 || GetLocalVarInt("PuzzleLightCount") == 1)
          {
          AddLocalVarInt("PuzzleLightCount", 1);
          }
          
          if(GetLocalVarInt("PicturePuzzle") == 3)
          {
          AddLocalVarInt("PicturePuzzle", 1);
          }
          
          if(GetLocalVarInt("PuzzleLightCount") == 5 && GetLocalVarInt("PicturePuzzle") < 5)
          {
          AddTimer("", 0, "PuzzleFail");
          }
         }

          void Execution(string &in asEntity, string &in type)
          {
          if(GetLocalVarInt("PuzzleLightCount") > 1 || GetLocalVarInt("PuzzleLightCount") == 1)
          {
          AddLocalVarInt("PuzzleLightCount", 1);
          }
          
          if(GetLocalVarInt("PicturePuzzle") == 4)
          {
          StopMusic(0.0, 1);
          PlayMusic("02_puzzle", false, 100, 0, 1, true);
          GiveSanityBoost();
          }
          
          if(GetLocalVarInt("PuzzleLightCount") == 5 && GetLocalVarInt("PicturePuzzle") < 5)
          {
          AddTimer("", 0, "PuzzleFail");
          }
         }
        
          void PuzzleFail(string &in asTimer)
          {
           StopMusic(0.3, 1);
           PlayGuiSound("CustomScare02", 0.3);
           SetMessage("Messages", "PuzzleOneFail", 1);
           SetLocalVarInt("PuzzleLightCount", 1);
           SetLocalVarInt("PicturePuzzle", 1);
           AddTimer("", 1, "PuzzleReset");
          }
          
          void PuzzleReset(string &in asTimer)
          {
           SetLampLit("PuzzleCandle01", false, true);
           SetLampLit("PuzzleCandle02", false, true);
           SetLampLit("PuzzleCandle03", false, true);
           SetLampLit("PuzzleCandle04", false, true);
          }

Thanks in advance Big Grin


RE: Puzzle Script Won't Reset - DnALANGE - 11-21-2013

As far as i can see your arent CHECKING if stuff is gonne happen.
here is an example from my mod. :
}
void ReSpawnRunners ()
{
if ( GetLocalVarInt( "SpawnMonsterCheckRunners") == 1)
{
AutoSave();
}
}
ReSpawnRunners();
The ReSpawnRunners(); Put that in PuzzleFail(string &in asTimer){}
IF i am correct, didnt take real close look.


RE: Puzzle Script Won't Reset - D3AD UPR1S1NG - 11-21-2013

(11-21-2013, 02:50 PM)DnALANGE Wrote: As far as i can see your arent CHECKING if stuff is gonne happen.
here is an example from my mod. :
}
void ReSpawnRunners ()
{
if ( GetLocalVarInt( "SpawnMonsterCheckRunners") == 1)
{
AutoSave();
}
}
ReSpawnRunners();
The ReSpawnRunners(); Put that in PuzzleFail(string &in asTimer){}
IF i am correct, didnt take real close look.

Thanks for the help Smile but I managed to fix it by redoing the entire script, thanks again Smile


RE: Puzzle Script Won't Reset - DnALANGE - 11-22-2013

Ok that is good, you found the problem.
You can tell the people here what you did so we can all learn from things.
And please add this SOLVED in your treath status.