Frictional Games Forum (read-only)
Amnesia custom story problem - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Amnesia custom story problem (/thread-15395.html)

Pages: 1 2


Amnesia custom story problem - KodiakZ - 05-12-2012

So I'm working on a Amnesia custom story but I'm stuck. I've made a key to open a specific door, but it will not work. The key is for a map changing door. My key is called Key_1 and my door is called Door_1. I cannot seem to get it to work. Here's my code:


////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Key_1", "Door_1", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Door_1", false);
PlaySoundAtEntity("", "unlock_door", "Door_1", 0, false);
}

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

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

Any help will be appreciated! Thanks for reading!


RE: Amnesia custom story problem - EXAWOLT - 05-12-2012

I had the same problem bro.
My solution was to create 2 level doors, one fake that's locked
and another un-active unlocked door wich will lead you further.
add useitem callback with the key on the fake door, and call SetEntityActive("fake", false);
and make the real door appear SetEntityActive("real", true);


RE: Amnesia custom story problem - Putmalk - 05-12-2012

Is the door in question a level door (i.e., it's name is level_wood or something like that) or is it a swing door (i.e., it's name is mansion_1 or something like that).

If it's a LevelDoor, then the SetLevelDoorLocked function is working as intended.
If it's a SwingDoor, then you need to use the SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects); function.

Is your key named "Key_1"?
Is your door named "Door_1"?

EXAWOLT Wrote:I had the same problem bro.

My solution was to create 2 level doors, one fake that's locked

and another un-active unlocked door wich will lead you further.

add useitem callback with the key on the fake door, and call SetEntityActive("fake", false);

and make the real door appear SetEntityActive("real", true);
^^ Yeah, sorry no offense but ignore this.

If done correctly you only need the key and the door, nothing else is needed and you're just making life more difficult for yourself.


RE: Amnesia custom story problem - KodiakZ - 05-13-2012

(05-12-2012, 11:26 PM)Putmalk Wrote: Is the door in question a level door (i.e., it's name is level_wood or something like that) or is it a swing door (i.e., it's name is mansion_1 or something like that).

If it's a LevelDoor, then the SetLevelDoorLocked function is working as intended.
If it's a SwingDoor, then you need to use the SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects); function.

Is your key named "Key_1"?
Is your door named "Door_1"?

[quote=] I had the same problem bro.

My solution was to create 2 level doors, one fake that's locked

and another un-active unlocked door wich will lead you further.

add useitem callback with the key on the fake door, and call SetEntityActive("fake", false);

and make the real door appear SetEntityActive("real", true);
^^ Yeah, sorry no offense but ignore this.

If done correctly you only need the key and the door, nothing else is needed and you're just making life more difficult for yourself.

Thanks for responding Big Grin

Yes, my key is called Key_1 and my door is Door_1. I've already tried renaming it a lot of times but with no succes. I've searched on Google for more than a half day, but still no help to be found. I'v etried all of the methods that I've found, but none worked. I really don't know whar I'm doing wrong. It's called mansion_1 but has the same look of a level door. Is that where I'm doing wrong ?


RE: Amnesia custom story problem - pandasFTW - 05-13-2012

you need to ensure that you are using the correct script, that means you can use " setleveldoorlocked" if the door you are using, aint a level door... if it ISNT a level door then use " setswingdoorlocked"!!!:.. Big Grin
secondly, something that, i used to do wrong when i started scripting, and most other people do too...
scripting is CASE-FRIGGIN-SENSITIVE Big Grin if the door is named " Door_1 " in the level editor, but you call it " door_1 " without caps, in the script, it WILL...NOT...WORK Big Grin Big Grin

(05-13-2012, 10:16 AM)KodiakZ Wrote:
(05-12-2012, 11:26 PM)Putmalk Wrote: Is the door in question a level door (i.e., it's name is level_wood or something like that) or is it a swing door (i.e., it's name is mansion_1 or something like that).

If it's a LevelDoor, then the SetLevelDoorLocked function is working as intended.
If it's a SwingDoor, then you need to use the SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects); function.

Is your key named "Key_1"?
Is your door named "Door_1"?

[quote=] I had the same problem bro.

My solution was to create 2 level doors, one fake that's locked

and another un-active unlocked door wich will lead you further.

add useitem callback with the key on the fake door, and call SetEntityActive("fake", false);

and make the real door appear SetEntityActive("real", true);
^^ Yeah, sorry no offense but ignore this.

If done correctly you only need the key and the door, nothing else is needed and you're just making life more difficult for yourself.

Thanks for responding Big Grin

Yes, my key is called Key_1 and my door is Door_1. I've already tried renaming it a lot of times but with no succes. I've searched on Google for more than a half day, but still no help to be found. I'v etried all of the methods that I've found, but none worked. I really don't know whar I'm doing wrong. It's called mansion_1 but has the same look of a level door. Is that where I'm doing wrong ?
if its only called "mansion_1 " then you will have to use the " setswingdoor" script, because every level door has

level_ infront of it


RE: Amnesia custom story problem - KodiakZ - 05-13-2012

Ok, so. I've just made a new door, and it's a level door. (Called Level_Celler_1) So I'm testing to see if it works now. Wow! it worked! Thanks!

Holy **** IT WORKED! Thank you dude! Big Grin


RE: Amnesia custom story problem - FlyingFruitcake - 05-13-2012

I used this code, but I used it in ''Run when entering map''
Code:
///Run when entering map///
void OnEnter() {
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);}
void KeyOnDoor(string &in asItem, string &in asEntity){     
SetSwingDoorLocked("door_1", false, true);     
PlaySoundAtEntity("", "unlock_door", "door_1", 1, false);    
RemoveItem("key_1");
}


Make sure your door and key have the same name as in the code...


RE: Amnesia custom story problem - KodiakZ - 05-13-2012

It already had. I checked for spelling mistaked missing , and stuff. But when i made a new door and didn't rename it just so its called original name it worked. Now my only problem is note text not showing and name of key not showing.


RE: Amnesia custom story problem - pandasFTW - 05-13-2012

(05-13-2012, 11:02 AM)KodiakZ Wrote: Ok, so. I've just made a new door, and it's a level door. (Called Level_Celler_1) So I'm testing to see if it works now. Wow! it worked! Thanks!

Holy **** IT WORKED! Thank you dude! Big Grin
glad to hear it worked out for ya Smile


RE: Amnesia custom story problem - Putmalk - 05-13-2012

I would suggest not renaming doors when level editing (especially if you're new).

LevelDoors:
level_wood
level_celler
level_dungeon
level_hub
level_orb_room_door
level_wood_double
level_cistern

SwingDoors:
mansion
metal
castle
cellar
prison
prison_section
elevator_door
hatch_ceiling
hatch_drainage
hatch_metal01
sewer_arched

Special (use SetMoveObjectState)
castle_portcullis
castlebase_secret_door
hatch_large
safety_large_vert
safety_normal_vert


Hope this helps!