I'm trying to make a lever puzzle where after three levers are pulled in a certain order, a painting slides, and a key falls. I've made a fair amount of progress on my script so far as a whole, but I'd definitely still say I'm a noob. XP I'm having issues getting the levers to work and therefore, for the puzzle to work at all.
Basically, what I want to happen is:
1. Read a note that has a riddle on it, levers are made active.
2. Pull lever1, lever2, then lever3 in order.
3. The painting slides over, key is made active, it falls, puzzle solved.
I don't know how to make it so the levers lock after use, that way you know you pulled it in the right direction and it worked. And if I can figure out or get help how to do this, how can I reset it if they do it wrong?
Here's my script (just the puzzle related info):
////////////////////////////
// Run first time starting map
void OnEnter()
{
SetEntityCallbackFunc("puzzlenote", "OnRead");
SetEntityConnectionStateChangeCallback("lever1", "LeverStateChange");
SetEntityConnectionStateChangeCallback("lever2", "LeverStateChange");
SetEntityConnectionStateChangeCallback("lever3", "LeverStateChange");
}
void OnRead(string &in asEntity, string &in type)
{
AddQuest("puzzle", "puzzle");
SetEntityActive("lever1", true);
SetEntityActive("lever2", true);
SetEntityActive("lever3", true);
}
void LeverStateChange(string &in asEntity, int alState)
{
if((GetLeverState("lever1") == 1) && (GetLeverState("lever2") == 1) && (GetLeverState("lever3") == 1))
{
PlaySoundAtEntity("","level_wood_min_max01.snt", "lever3", 0, false);
AddPropForce("themaiden", 200, 0, 0, "mylordscurse_1");
AddTimer("", 2, "PaintingMove");
SetEntityInteractionDisabled("lever1", true);
SetEntityInteractionDisabled("lever2", true);
SetEntityInteractionDisabled("lever3", true);
}
}
void PaintingMove(string &in asTimer)
{
SetEntityActive("chapter2key", true);
SetPlayerSanity(90);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
}
Any help would be greatly appreciated! Thank you!