Lock opened with armor puzzle
Hey!
So, my problem is that i've been making a puzzle, where you need to find 2 armor heads and place them to 2 helmetless armors, to unlock the door. My problem is at the point that there should be the both armor heads placed to unlock the door, but the door will unlock even if there is one helmet only placed, and as i said, it shouldn't unlock until both have been placed.
The reason why i placed "else"s at the point it checks for the other armor, is because i thought that would work since it didn't work without it.
SCRIPT:
void OnStart()
{
AddEntityCollideCallback("upstairs_doorhead_2", "upstairs_doorarea_2", "upstairsdoor2", true, 1);
AddEntityCollideCallback("upstairs_doorhead_1", "upstairs_doorarea_1", "upstairsdoor1", true, 1);
}
void upstairsdoor1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("upstairs_doorhead_1", false);
SetEntityActive("upstairs_doorheadless_1", false);
SetEntityActive("upstairs_doorarmor_1", true);
if(GetEntityExists("upstairs_doorheadless_2") == true)
{
SetSwingDoorLocked("upstairs_door", false, false);
}
else
{
SetSwingDoorLocked("upstairs_door", false, true);
}
}
void upstairsdoor2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("upstairs_doorhead_2", false);
SetEntityActive("upstairs_doorheadless_2", false);
SetEntityActive("upstairs_doorarmor_2", true);
if(GetEntityExists("upstairs_doorheadless_1") == true)
{
SetSwingDoorLocked("upstairs_door", false, false);
}
else
{
SetSwingDoorLocked("upstairs_door", false, true);
}
}
Thanks for your help, Ermu.
(This post was last modified: 02-16-2012, 05:05 PM by Ermu.)
|