Frictional Games Forum (read-only)
Key! WHY YOU NO WORK! - 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: Key! WHY YOU NO WORK! (/thread-9887.html)



Key! WHY YOU NO WORK! - JetlinerX - 08-21-2011

Keys are the one of the most easy things I know how to script, but why the hell is it saying "Cannot Use Item This Way!" Here is my code, and I hawk-eyed it, saw nothing wrong, and someone else looked at it and ALSO saw nothing wrong! The key/door names are all correct, and the key has a subitemtext.

Code:
        AddUseItemCallback("", "key_firstfloor", "firstfloordoor", "UsedKeyOnDoor", true);

---------------------------
void UsedKeyOnDoor(string &in asParent , string &in asChild , int alState)
{
        SetLevelDoorLocked("firstfloordoor", false);
        SetLevelDoorLockedSound("firstfloordoor", "door_level_wood_locked.snt");
        RemoveItem("key_firstfloor");
}



RE: Key! WHY YOU NO WORK! - Elven - 08-21-2011

SetSwingDoorLocked("DOORNAME", false, true);


RE: Key! WHY YOU NO WORK! - Obliviator27 - 08-21-2011

(08-21-2011, 01:12 AM)JetlinerX Wrote: Keys are the one of the most easy things I know how to script, but why the hell is it saying "Cannot Use Item This Way!" Here is my code, and I hawk-eyed it, saw nothing wrong, and someone else looked at it and ALSO saw nothing wrong! The key/door names are all correct, and the key has a subitemtext.

Code:
        AddUseItemCallback("", "key_firstfloor", "firstfloordoor", "UsedKeyOnDoor", true);

---------------------------
void UsedKeyOnDoor(string &in asParent , string &in asChild , int alState)
{
        SetLevelDoorLocked("firstfloordoor", false);
        SetLevelDoorLockedSound("firstfloordoor", "door_level_wood_locked.snt");
        RemoveItem("key_firstfloor");
}

Improper Syntax. (string &in asItem, string &in asEntity) is what you want to use.


RE: Key! WHY YOU NO WORK! - Elven - 08-21-2011

Yeah that was second thing what I was about to say Smile


RE: Key! WHY YOU NO WORK! - JenniferOrange - 08-21-2011

(08-21-2011, 01:45 AM)Obliviator27 Wrote: Improper Syntax. (string &in asItem, string &in asEntity) is what you want to use.

HE IS RIGHT! I can't believe I never caught that x_x



RE: Key! WHY YOU NO WORK! - Obliviator27 - 08-21-2011


[/quote]

HE IS RIGHT! I can't believe I never caught that x_x

[/quote]

It's scripting. Missing things happens, as I've found out very often. I've yet to type up a script that works without a Fatal Error. Smile


RE: Key! WHY YOU NO WORK! - JetlinerX - 08-21-2011

Yep, thats why this community is so great Jennifer, if we dont spot it, you can be sure as hell someone else is willing to get it for you! Thanks all!


RE: Key! WHY YOU NO WORK! - Juby - 08-21-2011

(08-21-2011, 04:17 AM)JetlinerX Wrote: Yep, thats why this community is so great Jennifer, if we dont spot it, you can be sure as hell someone else is willing to get it for you! Thanks all!

Attractive Wink

Wink