Functions (Tasks) - ShadowBonnieRUS/GMOD-SB_Advanced_Nextbots_Base GitHub Wiki
Here are descriptions for functions used in base in tasks.lua
file.
🔹 NEXTBOT:SetupTaskList
Used to setup bot's list of tasks.
Arguments: 1
- table | List of tasks add new tasks to.
Returns: 0
🔹 NEXTBOT:SetupTasks
Used to start behaviour tasks on spawn. Called from NEXTBOT:BehaveStart.
Arguments: 0
Returns: 0
🔹 NEXTBOT:RunTask
Runs active tasks callbacks with given event.
Arguments: *
- string | Event of hook.
- ⭕ vararg | Arguments to callback. NOTE: In callback, first argument is always bot entity, second argument is always task data, passed arguments from NEXTBOT:RunTask starts at third argument.
Returns: *
- vararg | Callback return.
🔹 NEXTBOT:RunCurrentTask
Runs one given task callback with given event.
Arguments: *
- any | Task name.
- string | Event of hook.
- ⭕ vararg | Arguments to callback. NOTE: In callback, first argument is always bot entity, second argument is always task data, passed arguments from NEXTBOT:RunTask starts at third argument.
Returns: *
- vararg | Callback return.
🔹 NEXTBOT:StartTask
Starts new task with given data and calls 'OnStart' task callback. Does nothing if given task is already started.
Arguments: 2
- any | Task name.
- ⭕ table | Task data.
Returns: 0
🔹 NEXTBOT:TaskComplete
Calls 'OnComplete' and 'OnDelete' task callbacks and deletes task. Does nothing if given task is not started.
Arguments: 1
- any | Task name.
Returns: 0
🔹 NEXTBOT:TaskFail
Calls 'OnFail' and 'OnDelete' task callbacks and deletes task. Does nothing if given task is not started.
Arguments: 1
- any | Task name.
Returns: 0
🔹 NEXTBOT:IsTaskActive
Returns whenever given task is started or not.
Arguments: 1
- any | Task name.
Returns: 1
- bool | Returns true if task is started, false otherwise.