Frictional Games Forum (read-only)

Full Version: Interaction callback
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need the script to activate a function when the Player picks up a note. I've tried adding an interaction callback but I just can't get it to work. probably some dumb mistake that I can't find yet, but i'm just wiping it clean and starting anew on this function. any help is appreciated.
SetEntityPlayerInteractCallback(string& asEntityName, string& asCallback, bool abRemoveOnInteraction);

source

Something like this:

PHP Code:
OnStart () {
SetEntityPlayerInteractCallback "MyNote""NotePickedupFunction"True ); }

void NotePickedupFunction string &in asEntity )
GruntDance"MyGrunt" ); } 
I'm quite sure interaction callbacks don't work with notes, and you have to use itemcallbacks.

PHP Code:
void OnStart()
{
   
SetEntityCallbackFunc("note""pickup");
}

void pickup(string &in entstring &in t)
{
    if(
== "OnPickup")
    {
        
//Stuff
    
}

That's Incorrect also, what works for me is:


PHP Code:
    SetEntityPlayerInteractCallback("EWK""GotEWK"true);
    

        
void GotEWK(string &in asEntity)
    {
        
SetEntityActive("ScriptArea_2"true);
        
SetEntityActive("ScriptArea_4"true);
                
//Do whatever you please here
    


I used this when the player picks up a Key. You can set it to absolutely any item. I used it to call a function which in turn activated a monster, and so forth. You just make the Note not open up in the Journal.
(06-29-2013, 08:06 PM)ClayPigeon Wrote: [ -> ]I'm quite sure interaction callbacks don't work with notes, and you have to use itemcallbacks.
True, kinda weird.
But somehow it works if you declare the function in the editor (PlayerInteractCallback) instead of the script file.
You can use both. But I always use SetEntityCallbackFunc.
thank you. i used the SetEntityCallbackFunction and it worked.