Code: Select all
#Define PuzzleOpener 11
#Define HitSwitch 12
#Define Solution 13
#Define PuzzleExit 14
int Switches[3] = {0, 0, 0};
str SwitchNames[3] = { "A", "B", "C" };
int SwitchColors[3] = { CR_BLUE, CR_RED, CR_YELLOW };
function void ResetSwitches (void) {
for (int i=0; i<3; i++) Switches[i] = 0;
}
Script PuzzleOpener (void) {
Setmusic("D_Evil", 0, 35);
Setfont("bigfont");
hudmessage(s:"Switch Puzzle";HUDMSG_TYPEON, 0, CR_Red, 0.25, 0.50, 6, 0.05, 10.0);
delay(35*10);
SetFont("ConFont");
hudmessage(s: "Hint: Don't cheat, play around with the \n
switches for a bit, and get \n
used to the way the puzzle works. \n
Press the switch on the wall for more \n
hints."; HUDMSG_TYPEON, 0, CR_WHITE, 0.24, 0.52, 6, 0.05, 5.0);
}
Script HitSwitch (int number){
Switches[number] += 1;
If(Switches[number] > 2){
Switches[number] = 0;
}
HudMessage(s:"Switch ", s:SwitchNames[number], s:" now set to ", i:Switches[number]; Hudmsg_Plain | HUDMSG_LOG, number+1, SwitchColors[number], 0.5, 0.02*number, 6, 0.5, 10.0);
ACS_Execute(Solution, 0);
}
script Solution (void) {
If(Switches[0] == 0 && Switches[1] == 2 && Switches[2] == 1){
Ceiling_Raisetonearest(29, 5);
Hudmessage(s:"Gate 1 Unlocked";HUDMSG_Plain, 4, CR_Red, 0.25, 0.50, 6, 0.05, 10.0);
ResetSwitches();
}
If(Switches[0] == 1 && Switches[1] == 0 && Switches[2] == 2) {
Ceiling_Raisetonearest(30, 5);
Hudmessage(s:"Gate 2 Unlocked";HUDMSG_Plain, 5, CR_Red, 0.25, 0.52, 6, 0.05, 10.0);
ResetSwitches();
}
If(Switches[0] == 2 && Switches[1] == 1 && Switches[2] == 0) {
Ceiling_Raisetonearest(31, 5);
Hudmessage(s:"Gate 3 Unlocked";HUDMSG_Plain, 6, CR_Red, 0.25, 0.54, 6, 0.05, 10.0);
ResetSwitches();
}
}
Script PuzzleExit (void)
{
Acs_Terminate(HitSwitch, 0);
Acs_Terminate(Solution, 0);
Acs_Terminate(PuzzleOpener, 0);
HudMessage(s:" "; Hudmsg_Typeon, 1, CR_Blue, 0.5, 0.0, 6, 0.5, 10.0 );
HudMessage(s:" "; Hudmsg_Typeon, 2, CR_Blue, 0.5, 0.02, 6, 0.5, 10.0 );
HudMessage(s:" "; Hudmsg_Typeon, 3, CR_Blue, 0.5, 0.04, 6, 0.5, 10.0 );
Hudmessage(s:" ";HUDMSG_Plain, 4, CR_Red, 0.25, 0.50, 6, 0.05, 10.0);
Hudmessage(s:" ";HUDMSG_Plain, 5, CR_Red, 0.25, 0.52, 6, 0.05, 10.0);
Hudmessage(s:" ";HUDMSG_Plain, 6, CR_Red, 0.25, 0.54, 6, 0.05, 10.0);
Delay(35*3);
Setfont("bigfont");
Hudmessage(s:"Congradulations!";HUDMSG_TYPEON, 0, CR_Red, 0.25, 0.50, 6, 0.05, 10.0);
Delay(35*3);
SetFont("ConFont");
hudmessageBold(s: "Now, take your reward."; HUDMSG_TYPEON, 0, CR_WHITE, 0.24, 0.52, 6, 0.05, 5.0);
SetMusic("D_TheDa2", 0, 35);
}