Frictional Games Forum (read-only)
Locked door script problems. (SOLVED) - 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: Locked door script problems. (SOLVED) (/thread-7070.html)



Locked door script problems. (SOLVED) - evertuy - 03-27-2011

(Sorry about the second thread)

So I recently have been studying and watching tutorials about scripting and have gotten a lot better at it. I have my extra_english.lang set up for my key so when I pick it up it says "Iron Key", and the description in my inventory shows up.

So I have a locked door leading to another area so I started scripting to make the key unlock the locked door. I double checked the script and all but it still doesn't work for some reason, it looks right to me. Can someone point out an error?

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
    AddUseItemCallback("", "ironkey_1", "studydoor_1", "KeyUsedOnDoor", true);
}

void KeyUsedOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("studydoor_1", false, true);
    PlaySoundAtEntity("", "unlock_door", "studydoor_1", 0, false);
    RemoveItem("ironkey_1");
}

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

}

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

}
[/code]


RE: Locked door script problems. - Pandemoneus - 03-27-2011

You wrote KeyUsedOnDoor in your callback, but your function is called KeyUsedOndoor.
In the future, add DebugMessages to your script so you can check whether your functions/different parts are called/reached and to pinpoint errors.


RE: Locked door script problems. - evertuy - 03-27-2011

Well I fixed that on my .hps but when I use the Iron key on the door I still get, "Cannot use item that way"


RE: Locked door script problems. - Pandemoneus - 03-27-2011

Weird. Mind uploading the map and the script file?


RE: Locked door script problems. - evertuy - 03-27-2011

(03-27-2011, 10:14 AM)Pandemoneus Wrote: Weird. Mind uploading the map and the script file?

Alright, here you go,

http://www.mediafire.com/?67qu3528h9pivo9

That's the custom story and all.


RE: Locked door script problems. - Pandemoneus - 03-27-2011

Ah, easily found your mistake.
Your script file is named DoorScript.hps.hps
Got "show extensions" activated?


RE: Locked door script problems. - evertuy - 03-27-2011

Are you fucking kidding me!
LOL
Well no wonder I haven't gotten ANYTHING TO WORK.

So I'll just get rid of the extra .hps.

I report back what happens.

IT WORKEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD