Hey
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
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