Frictional Games Forum (read-only)

Full Version: [Solved]-> Key unlocks door ANOTHER WAY ^.-
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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...!
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.
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.
i added a PickKey but still don't work i will check everything

EDIT:Sanity boost doesn't work two o.O
(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?
Oh my god, I suck.

This should work. Replace SetEntityPlayerInteractCallback with this.

SetEntityCallbackFunc("Key01", "PickKey");
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.
Neelke thanks it works now +reputation Smile for you Smile

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