[SCRIPT] Callback Function Usage? - 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] Callback Function Usage? (/thread-53980.html) |
Callback Function Usage? - Verkehr - 12-13-2017 I don't understand how to use the Callback Func that you can set for an entity inside of the level editor. Exactly the "CallbackFunc". How do I make it be "OnPickup"? I want it to show a message (SetMessage) for the player if he picks up a note, and I want to use this CallbackFunc, but I don't know how it works! RE: Callback Function Usage? - Mudbill - 12-13-2017 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: void OnStart() Similarly you can check for other types of events. RE: Callback Function Usage? - Verkehr - 12-14-2017 (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. 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. RE: Callback Function Usage? - Mudbill - 12-14-2017 Nah, if you've set it in the level editor, you don't need that bit in OnStart. Both have the same effect. |