Frictional Games Forum (read-only)
amnesia level editor key for locked door 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 level editor key for locked door problem (/thread-20403.html)



amnesia level editor key for locked door problem - carlos111897 - 02-19-2013

Hey guys i just wanted to ask for some help for my custom story. i need help with a key to unlock a specific door. ive written everything on the script but it doesnt seem to work it just says "unable to use on this object" or something like that.
i also wanted to know how to load into different maps such as when entering a door and a loading screen comes up.
So if you know please tell me and thank you in advance.

So heres my script:

////////////////////////////
// Run when entering map
void OnEnter()
{
void AddUseItemCallback("","monsterdoorkey_1", "bedroommansiondoor ", "UsedKeyOnDoor", true);
}

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




And my lang file(i dont know if i need to change it or the directory its ment to be placed in):

</LANGUAGE>


<CATEGORY Name ="Inventory">
<Entry Name="ItemName_monsterdoorkey_1">YourKeyName</Entry>
<Entry Name="ItemDesc_monsterdoorkey_1">"YourKeyDescription"</Entry>
</CATEGORY>

</LANGUAGE>



Thanks guy in advance.


RE: amnesia level editor key for locked door problem - OriginalUsername - 02-19-2013

You shouldn't use void OnEnter(). Use void OnStart instead. I think that's the problem.
And you have to use level doors to change to other maps. Just click on the level door, click the entity tab, go to StartPos (Enter the name of your playerstart area in the other map). Click the '...' next to MapFile and select the map you want it to bring you to.
You could also use the ChangeMap command but using level doors makes more sense.
If you need help with commands, I'd recommend this site.

EDIT: And you used </LANGUAGE> in the beginning of your .lang file. Change it to <LANGUAGE>. And perhaps doing this: RemoveItem("monsterdoorkey_1"); could do something


RE: amnesia level editor key for locked door problem - NaxEla - 02-19-2013

(02-19-2013, 03:47 PM)Smoke Wrote: You shouldn't use void OnEnter(). Use void OnStart instead. I think that's the problem.
And you have to use level doors to change to other maps. Just click on the level door, click the entity tab, go to StartPos (Enter the name of your playerstart area in the other map). Click the '...' next to MapFile and select the map you want it to bring you to.
You could also use the ChangeMap command but using level doors makes more sense.
If you need help with commands, I'd recommend this site.

EDIT: And you used </LANGUAGE> in the beginning of your .lang file. Change it to <LANGUAGE>. And perhaps doing this: RemoveItem("monsterdoorkey_1"); could do something

The OnStart function will execute only the first time the player loads the map. OnEnter will execute everytime the player loads the map. So, it doesn't actually matter where carlos111897 has the callback.

Double check that the names for the key/door are the same in your script as they are in the level editor.


RE: amnesia level editor key for locked door problem - The chaser - 02-19-2013

Check for .map_cache and check names-for the loading screen thing, put this in your void OnLeave():

void OnLeave()
{
SetupLoadScreen("TextCategory", "TextEntry", 1, "urimage.jpg");

}


RE: amnesia level editor key for locked door problem - NaxEla - 02-20-2013

Oh geez, how could I have missed this...

PHP Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
void AddUseItemCallback("","monsterdoorkey_1""bedroommansiondoor ""UsedKeyOnDoor"true);
// a couple problems in the line above
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("bedroommansiondoor"falsetrue);
PlaySoundAtEntity("""unlock_door""bedroommansiondoor"0false);
RemoveItem(monsterdoorkey_1); // problem here too


In the line:
Code:
void AddUseItemCallback("","monsterdoorkey_1", "bedroommansiondoor ", "UsedKeyOnDoor", true);
Take out the void at the beginning of the line. Also, you had a space after bedroommansiondoor.

Also, you should change RemoveItem(monsterdoorkey_1) to RemoveItem("monsterdoorkey_1"). You needed to add quotations ("") around monsterdoorkey_1.


RE: amnesia level editor key for locked door problem - carlos111897 - 02-20-2013

(02-20-2013, 08:47 AM)NaxEla Wrote: Oh geez, how could I have missed this...

PHP Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
void AddUseItemCallback("","monsterdoorkey_1""bedroommansiondoor ""UsedKeyOnDoor"true);
// a couple problems in the line above
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("bedroommansiondoor"falsetrue);
PlaySoundAtEntity("""unlock_door""bedroommansiondoor"0false);
RemoveItem(monsterdoorkey_1); // problem here too


In the line:
Code:
void AddUseItemCallback("","monsterdoorkey_1", "bedroommansiondoor ", "UsedKeyOnDoor", true);
Take out the void at the beginning of the line. Also, you had a space after bedroommansiondoor.

Also, you should change RemoveItem(monsterdoorkey_1) to RemoveItem("monsterdoorkey_1"). You needed to add quotations ("") around monsterdoorkey_1.

Thank for your help but it still doesnt work Sad keeps on saying "unable to use item"


RE: amnesia level editor key for locked door problem - The chaser - 02-20-2013

Unable to use item means names are wrong. Check both the name of the key and the door. Wink