Frictional Games Forum (read-only)
[SCRIPT] Interaction callback - 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] Interaction callback (/thread-21972.html)



Interaction callback - VillainousPotato - 06-29-2013

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.


RE: Interaction callback - Daemian - 06-29-2013

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" ); } 



RE: Interaction callback - ClayPigeon - 06-29-2013

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
    
}




RE: Interaction callback - Pshyched - 06-29-2013

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.


RE: Interaction callback - Daemian - 06-30-2013

(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.


RE: Interaction callback - PutraenusAlivius - 06-30-2013

You can use both. But I always use SetEntityCallbackFunc.


RE: Interaction callback - VillainousPotato - 07-01-2013

thank you. i used the SetEntityCallbackFunction and it worked.