Frictional Games Forum (read-only)
[SCRIPT] [Solved]-> Key unlocks door ANOTHER WAY ^.- - 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: [SCRIPT] [Solved]-> Key unlocks door ANOTHER WAY ^.- (/thread-25320.html)



[Solved]-> Key unlocks door ANOTHER WAY ^.- - Straxedix - 05-18-2014

Hi

Spoiler below!
NO IT'S NOT PROBLEM LIKE:HEY I NEED A HELP HOW TO MAKE KEY UNLOCKS DOOR I'M SO STUPID...NO! something else :)

i need a when PLAYER pick up KEY doors unlocks,without using key on any doors

i have a some script here

Spoiler below!


void OnStart()
{
SetEntityPlayerInteractCallback("Key01", "PickKey", true);
}

void PickKey(string &in asEntity, string &in asType)
{
GiveSanityBoostSmall(); //Just a nice little sanity boost
SetSwingDoorLocked("Door01", false, true);
}

so to don't use key just pick it up ok ?

Spoiler below!
Problem:Script doesn't work no errors just don't work...!



RE: Key unlocks door ANOTHER WAY ^.- - Skyy - 05-18-2014

Make sure everything is named correctly in the Level Editor. I can't see any error.

Edit: If you click the key in the Level Editor and go to the second tab there should be an option called "PlayerInteractCallback", if you type in "PickKey" it should work.


RE: Key unlocks door ANOTHER WAY ^.- - Neelke - 05-18-2014

Still stuck at this, huh? And as Skyy said, I can't find any error (as before). Follow Skyy's advice.

EDIT: Not PlayerInteractCallback, CallbackFunc.


RE: Key unlocks door ANOTHER WAY ^.- - Straxedix - 05-18-2014

i added a PickKey but still don't work i will check everything

EDIT:Sanity boost doesn't work two o.O


RE: Key unlocks door ANOTHER WAY ^.- - Skyy - 05-18-2014

(05-18-2014, 08:40 PM)Neelke Wrote: EDIT: Not PlayerInteractCallback, CallbackFunc.

It's called "PlayerInteractCallback" in the Editor.

Maybe you are talking about something else?


RE: Key unlocks door ANOTHER WAY ^.- - Neelke - 05-18-2014

Oh my god, I suck.

This should work. Replace SetEntityPlayerInteractCallback with this.

SetEntityCallbackFunc("Key01", "PickKey");


RE: Key unlocks door ANOTHER WAY ^.- - Mudbill - 05-18-2014

Interaction callbacks are for grabbing and moving and clicking, not specifically picking up items. Use the CallbackFunc as Neelke said. That one has a type called OnPickup, which is what you want.


RE: Key unlocks door ANOTHER WAY ^.- - Straxedix - 05-18-2014

Neelke thanks it works now +reputation Smile for you Smile

Mudbil +reputation for you two you helped me a lot Smile