me again ^^ im trying to get a key to appear after pulling six levers but it appears only after pulling the sixth lever
so im wondering what i have to put into my script if anyone could help. ive looked around and im too dimwitted to understand a lot of the script. heres my script if anyone could help me find whats wrong
////////////////////////////
// Run when entering map
/////////////////////
//BEGIN LEVER SCRIPT
/////////////////////
void PullLever1(string &in asEntity, int alState)
{
if(alState == 1){
AddDebugMessage("Lever 1 is in the right position", false);
SetLocalVarInt("Lever1", 1);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}else if(alState == 0){
SetLocalVarInt("Lever1", 0);
AddDebugMessage("Lever 1 is in the wrong position", false);
}else if(alState == -1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 1 is in the wrong position", false);
SetLocalVarInt("Lever1", 0);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
}
void PullLever2(string &in asEntity, int alState)
{
if(alState == -1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 2 is in the right position", false);
SetLocalVarInt("Lever2", 1);
}else if(alState == 0){
AddDebugMessage("Lever 2 is in the wrong position", false);
SetLocalVarInt("Lever2", 0);
}else if(alState == 1){
SetLocalVarInt("Lever2", 0);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
}
void PullLever3(string &in asEntity, int alState)
{
if(alState == -1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 3 is in the right position", false);
SetLocalVarInt("Lever3", 1);
}else if(alState == 0){
AddDebugMessage("Lever 3 is in the wrong position", false);
SetLocalVarInt("Lever3", 0);
}else if(alState == 1){
SetLocalVarInt("Lever3", 0);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
}
void PullLever4(string &in asEntity, int alState)
{
if(alState == 1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 4 is in the right position", false);
SetLocalVarInt("Lever4", 1);
}else if(alState == 0){
AddDebugMessage("Lever 4 is in the wrong position", false);
SetLocalVarInt("Lever4", 0);
}else if(alState == -1){
SetLocalVarInt("Lever4", 0);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
}
void PullLever5(string &in asEntity, int alState)
{
if(alState == 1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 5 is in the right position", false);
SetLocalVarInt("Lever5", 1);
}else if(alState == 0){
AddDebugMessage("Lever 5 is in the wrong position", false);
SetLocalVarInt("Lever5", 0);
}else if(alState == -1){
SetLocalVarInt("Lever5", 0);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
}
void PullLever6(string &in asEntity, int alState)
{
if(alState == -1){
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
AddDebugMessage("Lever 6 is in the right position", false);
SetLocalVarInt("Lever6", 1);
}else if(alState == 0){
AddDebugMessage("Lever 6 is in the wrong position", false);
SetLocalVarInt("Lever6", 0);
}else if(alState == 1){
SetLocalVarInt("Lever6", 0);
PlaySoundAtEntity("", "lever_mech_min_max", asEntity, 0.0f, false);
}
if(GetLocalVarInt("Lever1") == 1 && GetLocalVarInt("Lever2") == 1 && GetLocalVarInt("Lever3") == 1 && GetLocalVarInt("Lever4") == 1 && GetLocalVarInt("Lever5") == 1 && GetLocalVarInt("Lever6") == 1){
}
SetEntityActive("key_3", true);
{
}
}
/////////////////////
//END LEVER SCRIPT
/////////////////////
void OnEnter()
{
AddEntityCollideCallback("Player", "tng_area_1", "Scare_1", true, 1);
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor2", true);
AddUseItemCallback("", "wood_box02_breakable_11_item", "mansion_3", "KeyOnDoor3", true);
SetEntityPlayerInteractCallback("key_1", "ActivateArea", true);
SetEntityConnectionStateChangeCallback("L1", "PullLever1");
SetEntityConnectionStateChangeCallback("L2", "PullLever2");
SetEntityConnectionStateChangeCallback("L3", "PullLever3");
SetEntityConnectionStateChangeCallback("L4", "PullLever4");
SetEntityConnectionStateChangeCallback("L5", "PullLever5");
SetEntityConnectionStateChangeCallback("L6", "PullLever6");
SetLocalVarInt("Lever1", 0);
SetLocalVarInt("Lever2", 0);
SetLocalVarInt("Lever3", 0);
SetLocalVarInt("Lever4", 0);
SetLocalVarInt("Lever5", 0);
SetLocalVarInt("Lever6", 0);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("key_2");
}
void KeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("wood_box02_breakable_11_item");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}