Frictional Games Forum (read-only)
I Need A Help Regarding The Lock Doors - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: I Need A Help Regarding The Lock Doors (/thread-8327.html)

Pages: 1 2


I Need A Help Regarding The Lock Doors - Jayvee17 - 05-29-2011

When I Try My Custom Story, I Get My 1st Key That Can Unlock The 1st Door.. There Are Many Locked Doors Especially In The 2nd Floor...But When I Unlock The 1st Door... I Go To The 2nd Floor And All The Locked Doors Are Unlocked Too... Please Help Me...This Is My Custom Story's .hps...

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Door_1_Key", "Door_1", "UsedKeyOnDoor", true);

AddUseItemCallback("", "Door_3_Key", "Door_3", "UsedKeyOnDoor", true);

AddUseItemCallback("", "Door_4_Key", "Door_4", "UsedKeyOnDoor", true);

AddUseItemCallback("", "Crowbar_1", "Door_5", "UsedKeyOnDoor", true);

AddUseItemCallback("", "Door_6_Key", "Door_6", "UsedKeyOnDoor", true);

}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_1", 0, false);
RemoveItem("Door_1_Key");

SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_3", 0, false);
RemoveItem("Door_3_Key");

SetSwingDoorLocked("Door_4", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_4", 0, false);
RemoveItem("Door_4_Key");

SetSwingDoorLocked("Door_5", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_5", 0, false);
RemoveItem("Crowbar_1");

SetSwingDoorLocked("Door_6", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_6", 0, false);
RemoveItem("Door_6_Key");

}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


RE: I Need A Help Regarding The Lock Doors - laser50 - 05-29-2011

I have no idea, but i think you gotta seperate them.


RE: I Need A Help Regarding The Lock Doors - iVicio - 05-29-2011

// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Door_1_Key", "Door_1", "UsedKeyOnDoor_01", true);

AddUseItemCallback("", "Door_3_Key", "Door_3", "UsedKeyOnDoor_02", true);

AddUseItemCallback("", "Door_4_Key", "Door_4", "UsedKeyOnDoor_03", true);

AddUseItemCallback("", "Crowbar_1", "Door_5", "UsedKeyOnDoor_04", true);

AddUseItemCallback("", "Door_6_Key", "Door_6", "UsedKeyOnDoor_05", true);

}
void UsedKeyOnDoor_01(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_1", 0, false);
RemoveItem("Door_1_Key");

void UsedKeyOnDoor_02(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_3", 0, false);
RemoveItem("Door_3_Key");
}

void UsedKeyOnDoor_03(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_4", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_4", 0, false);
RemoveItem("Door_4_Key");
}
void UsedKeyOnDoor_04(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_5", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_5", 0, false);
RemoveItem("Crowbar_1");
{

void UsedKeyOnDoor_05(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_6", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_6", 0, false);
RemoveItem("Door_6_Key");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Wink


RE: I Need A Help Regarding The Lock Doors - Jayvee17 - 05-30-2011

It's Not Working...


RE: I Need A Help Regarding The Lock Doors - laser50 - 05-30-2011

Are the Door_1 and Key1_Door1 Or something Exactly the same as the ones you wanna open?


RE: I Need A Help Regarding The Lock Doors - Jayvee17 - 05-30-2011

(05-30-2011, 12:05 PM)laser50 Wrote: Are the Door_1 and Key1_Door1 Or something Exactly the same as the ones you wanna open?
Yes It Is...



RE: I Need A Help Regarding The Lock Doors - Kyle - 05-30-2011

Still got problems with that script?

Try this:

Code:
void OnStart()
{
     AddUseItemCallback("", "Door_1_Key", "Door_1", "UsedKeyOnDoor", true);
     AddUseItemCallback("", "Door_3_Key", "Door_3", "UsedKeyOnDoor", true);
     AddUseItemCallback("", "Door_4_Key", "Door_4", "UsedKeyOnDoor", true);
     AddUseItemCallback("", "Crowbar_1", "Door_5", "UsedKeyOnDoor", true);
     AddUseItemCallback("", "Door_6_Key", "Door_6", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
     RemoveItem(asItem);
}

It makes it much more simplified and easier to read. Smile


RE: I Need A Help Regarding The Lock Doors - DannieWest - 05-30-2011

(05-29-2011, 06:14 PM)iVicio Wrote: void UsedKeyOnDoor_01(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_1", 0, false);
RemoveItem("Door_1_Key");

void UsedKeyOnDoor_02(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_3", 0, false);
RemoveItem("Door_3_Key");
}

The problem with this script here is 1. you forgot to put a } after RemoveItem("Door_1_Key); and 2. under UsedKeyOnDoor_02 there should be a {, instead of } Smile
If it dun work after that, then I don't know :o And I agree with Kyle, if you make it his way you see more clearly what belongs to which and so =)


RE: I Need A Help Regarding The Lock Doors - Jayvee17 - 05-30-2011

Ok Thanks For The Help... I Deleted My Custom Story XDD...


RE: I Need A Help Regarding The Lock Doors - Kyle - 05-30-2011

(05-30-2011, 03:08 PM)Jayvee17 Wrote: Ok Thanks For The Help... I Deleted My Custom Story XDD...

That wasn't a good idea... unless you plan to make a better one. Tongue

Perhaps you should keep getting good scripting methods and practice more and then make a new one.