Frictional Games Forum (read-only)
Unlock level door? - 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: Unlock level door? (/thread-25155.html)

Pages: 1 2


Unlock level door? - Gladoshatesyou - 04-25-2014

I can use scripts to unlock a normal door, easy. But when I try with a level door, it never works. Maybe some thing in effect is the fact that the level door is always like the 2nd locked door in the level so maybe its just a matter of combining scripts, but here you go. Here is my script- (castle_1 is the level door.)

void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_tomb", "castle_1", "UseKeyOnDoor2", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "Script_Scare", "Scare", true, 1);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("character_infected_1", true);
SetEntityActive("deformed_man_7", true);
SetEntityActive("deformed_man_8", true);
SetEntityActive("deformed_man_9", true);
SetEntityActive("deformed_man_10", true);
SetEntityActive("deformed_man_11", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 4, "");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_door_1", 0, false);
RemoveItem(asItem);
}
void UseKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem(asItem);
}
void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_12", true);
SetEntityActive("deformed_man_13", true);
SetEntityActive("deformed_man_14", true);
SetEntityActive("deformed_man_15", true);
}
void MoveShelf(string &in asEntity, int alState)
{
if (GetLocalVarInt("Check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);

PlaySoundAtEntity("", "quest_completed.snt", "Shelf", 0, false);

SetLocalVarInt("Check", 1);

return;
}
}
}


RE: Unlock level door? - Mudbill - 04-25-2014

When unlocking level doors, you must use the SetLevelDoorLocked script function rather than the SetSwingDoorLocked.

You can change the name of the block to UnlockLevelDoor if you wish, then use that script within. It takes the same parameters as swing doors except for the last boolean (effects). Basically:

SetLevelDoorLocked("castle_1", false);


RE: Unlock level door? - Gladoshatesyou - 04-25-2014

(04-25-2014, 08:23 AM)Mudbill Wrote: When unlocking level doors, you must use the SetLevelDoorLocked script function rather than the SetSwingDoorLocked.

You can change the name of the block to UnlockLevelDoor if you wish, then use that script within. It takes the same parameters as swing doors except for the last boolean (effects). Basically:

SetLevelDoorLocked("castle_1", false);

Its still not working... Am I doing something wrong?

void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_tomb", "castle_1", "UnlockLevelDoor", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "Script_Scare", "Scare", true, 1);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("character_infected_1", true);
SetEntityActive("deformed_man_7", true);
SetEntityActive("deformed_man_8", true);
SetEntityActive("deformed_man_9", true);
SetEntityActive("deformed_man_10", true);
SetEntityActive("deformed_man_11", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 4, "");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_door_1", 0, false);
RemoveItem(asItem);
}
void UnlockLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("castle_1", false);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem(asItem);
}
void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_12", true);
SetEntityActive("deformed_man_13", true);
SetEntityActive("deformed_man_14", true);
SetEntityActive("deformed_man_15", true);
}
void MoveShelf(string &in asEntity, int alState)
{
if (GetLocalVarInt("Check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);

PlaySoundAtEntity("", "quest_completed.snt", "Shelf", 0, false);

SetLocalVarInt("Check", 1);

return;
}
}
}


RE: Unlock level door? - DnALANGE - 04-25-2014

Ok, do you here the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
NEXT time do this : here is an example;
INSERT FORMATTED CODE + SPOILER = if you have a HUGH script in the SPOILER is way more easy to read. Just a hint to you.

Spoiler below!

PHP Code:
ONSTART
{
bla bla
}

void scriptstart.
{



You can make a spoiler like this [spooiler] TEXT [/spooiler] BOTH with 1 o (spoiler) I can not do it with 1 o (spoiler) now or you will see the spoiler Tongue hehee


RE: Unlock level door? - Gladoshatesyou - 04-25-2014

(04-25-2014, 01:26 PM)DnALANGE Wrote: Ok, do you here the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
NEXT time do this : here is an example;
INSERT FORMATTED CODE + SPOILER = if you have a HUGH script in the SPOILER is way more easy to read. Just a hint to you.

Spoiler below!

PHP Code:
ONSTART
{
bla bla
}

void scriptstart.
{



You can make a spoiler like this [spooiler] TEXT [/spooiler] BOTH with 1 o (spoiler) I can not do it with 1 o (spoiler) now or you will see the spoiler Tongue hehee
I think I see what you are saying, but it doesnt really help...


RE: Unlock level door? - DnALANGE - 04-25-2014

It was just a HINT.
Now read my post again please ;
---
Ok, do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.


RE: Unlock level door? - Gladoshatesyou - 04-25-2014

(04-25-2014, 01:35 PM)DnALANGE Wrote: It was just a HINT.
Now read my post again please ;
---
Ok, do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.

I dont know if you understand Tongue I suck a scripting. Big Grin I dont know shit. I just copy and paste and look up tutorials, so...


RE: Unlock level door? - DnALANGE - 04-25-2014

hmm...
With all the respect Glado*
you NEED to know what you are doing.
at least a little bit.
Everyone here started as you, knowing very less to none at all.
What you should do is open someone elses custom story. ( or the main game )
and open their maps \ and scripts.
See how they added the scriptarea's \ named doors \ how they added the scripts in the .hps etc etc..
---
You should check that and learn by some people their maps.
Also see some tutorials here on the forum or on youtube.
if you dont know what you are doing we arent really here to help is we just give you the scripts.
we arent here 24\7 { well.. sorta but we cant help every minute }
-
Just try to understand what what does and make mistakes, like all of us!

IF you tried hard we are here to help you offcourse!

Just try to learn and check \ double check things like : Names \ scriptfunction.

Give that a shot and let us know if we need to help more.


RE: Unlock level door? - Gladoshatesyou - 04-25-2014

(04-25-2014, 01:47 PM)DnALANGE Wrote: hmm...
With all the respect Glado*
you NEED to know what you are doing.
at least a little bit.
Everyone here started as you, knowing very less to none at all.
What you should do is open someone elses custom story. ( or the main game )
and open their maps \ and scripts.
See how they added the scriptarea's \ named doors \ how they added the scripts in the .hps etc etc..
---
You should check that and learn by some people their maps.
Also see some tutorials here on the forum or on youtube.
if you dont know what you are doing we arent really here to help is we just give you the scripts.
we arent here 24\7 { well.. sorta but we cant help every minute }
-
Just try to understand what what does and make mistakes, like all of us!

IF you tried hard we are here to help you offcourse!

Just try to learn and check \ double check things like : Names \ scriptfunction.

Give that a shot and let us know if we need to help more.

Well I mean I know how to have like multiple scripts, or like do notes and stuff but is someone sat me down and said like "Do this" I woudnt know what to do. I look up tutorials all the time on YouTube also! Smile


RE: Unlock level door? - DnALANGE - 04-25-2014

thats how we all do\did.
We look and search and try and try!
if i \ we \ you cant fix it, we can ask the "more knowledged" guys here on the forum.

So i ask you again.
When you insert the key on the LEVELDOOR ;
Do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.