Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Interaction callback
VillainousPotato Offline
Member

Posts: 50
Threads: 13
Joined: Mar 2013
Reputation: 1
#1
Interaction callback

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.

06-29-2013, 05:51 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#2
RE: Interaction callback

SetEntityPlayerInteractCallback(string& asEntityName, string& asCallback, bool abRemoveOnInteraction);

source

Something like this:

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

void NotePickedupFunction string &in asEntity )
GruntDance"MyGrunt" ); } 

(This post was last modified: 06-29-2013, 08:02 PM by Daemian.)
06-29-2013, 07:58 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#3
RE: Interaction callback

I'm quite sure interaction callbacks don't work with notes, and you have to use itemcallbacks.

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

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

(This post was last modified: 06-29-2013, 08:09 PM by ClayPigeon.)
06-29-2013, 08:06 PM
Find
Pshyched Offline
Member

Posts: 130
Threads: 21
Joined: Nov 2012
Reputation: 5
#4
RE: Interaction callback

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


PHP Code: (Select All)
    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.
(This post was last modified: 06-29-2013, 08:18 PM by Pshyched.)
06-29-2013, 08:16 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#5
RE: Interaction callback

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

06-30-2013, 05:27 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Interaction callback

You can use both. But I always use SetEntityCallbackFunc.

"Veni, vidi, vici."
"I came, I saw, I conquered."
06-30-2013, 05:59 AM
Find
VillainousPotato Offline
Member

Posts: 50
Threads: 13
Joined: Mar 2013
Reputation: 1
#7
RE: Interaction callback

thank you. i used the SetEntityCallbackFunction and it worked.

07-01-2013, 12:31 AM
Find




Users browsing this thread: 2 Guest(s)