Frictional Games Forum (read-only)

Full Version: Key! WHY YOU NO WORK!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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");
}
SetSwingDoorLocked("DOORNAME", false, true);
(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.
Yeah that was second thing what I was about to say Smile
(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

[/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
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!
(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