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 Callback Function Usage?
Verkehr Offline
Member

Posts: 60
Threads: 13
Joined: Oct 2016
Reputation: 1
#3
RE: Callback Function Usage?

(12-13-2017, 09:07 PM)Mudbill Wrote: Using the generic CallbackFunc is basically a single callback for multiple events. It's ran for every event that is listed, like Break, OnPickup, OnIgnite etc, but not all of these apply to all objects.

If you want only OnPickup, just check for it at the start of the function.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityCallbackFunc("entity""MyFunc");
}

void MyFunc(string &in asEntitystring &in asType)
{
    if(
asType == "OnPickup")
    {
        
SetMessage("Messages""NoteMessage"0);
    }


Similarly you can check for other types of events.

Ohhhh, so I have to use ' if(asType == "OnPickup") ' to make that happen! Do I have to use ' SetEntityCallbackFunc("entity", "MyFunc"); ' though, despite that it's already set as the function inside of the map editor?

Thanks eitherway. Smile
(This post was last modified: 12-14-2017, 07:23 PM by Verkehr.)
12-14-2017, 07:23 PM
Find


Messages In This Thread
Callback Function Usage? - by Verkehr - 12-13-2017, 06:36 PM
RE: Callback Function Usage? - by Mudbill - 12-13-2017, 09:07 PM
RE: Callback Function Usage? - by Verkehr - 12-14-2017, 07:23 PM
RE: Callback Function Usage? - by Mudbill - 12-14-2017, 11:14 PM



Users browsing this thread: 1 Guest(s)