Events for task callbacks - ShadowBonnieRUS/GMOD-SB_Advanced_Nextbots_Base GitHub Wiki
Descriptions of events of task callbacks, that called from base.
NOTE: In task callbacks, first argument always bot entity, second argument is always task data, NEXTBOT:RunTask arguments starts at third argument.
🔹 - callback called from server side.
🔸 - callback called from client side.
🔹 PlayerControlUpdate
Called from NEXTBOT:BehaveUpdate
to control bot when player controls it.
Arguments: 2
- number | Behaviour interval.
- Player | Player who controls bot.
Returns: 0
🔹 BehaveUpdate
Called from NEXTBOT:BehaveUpdate
to control bot's behaviour.
Arguments: 1
- number | Behaviour interval.
Returns: 0
🔹 DisableBehaviour
Called from NEXTBOT:DisableBehaviour
to determine should behaviour be disabled. Called only when other checks returns false
.
Arguments: 0
Returns: 1
- bool | Should disable or not.
🔸 Draw
Called from NEXTBOT:Draw
.
Arguments: 0
Returns: 0
🔸 ModifyPlayerControlHUD
Called from NEXTBOT:ModifyPlayerControlHUD
.
Arguments: 6
- number | X HUD coordinate.
- number | Y HUD coordinate.
- number | Width of health bar.
- number | Height of health bar.
- number | X HUD coordinate of crosshair.
- number | Y HUD coordinate of crosshair.
Returns: 1
- bool | Return true to prevent drawing default HUD.
🔹🔸 ModifyControlPlayerButtons
Called from NEXTBOT:ModifyControlPlayerButton
.
Arguments: 1
- number | Buttons from MoveData.
Returns: 1
- any | Return modified buttons (number) or nil to not change.
🔹 PreventBecomeRagdollOnKilled
Called from NEXTBOT:OnKilled
. Used to prevent becoming a ragdoll if you use custom death behaviour.
Arguments: 1
- CTakeDamageInfo |
NEXTBOT:OnKilled
Damage info.
Returns: 1
- bool | Return true to prevent becoming a ragdoll.
🔹 OnKilled
Called from NEXTBOT:OnKilled
after PreventBecomeRagdollOnKilled
.
Arguments: 1
- CTakeDamageInfo |
NEXTBOT:OnKilled
Damage info.
Returns: 0
🔹 OnInjured
Called from NEXTBOT:OnInjured
.
Arguments: 1
- CTakeDamageInfo |
NEXTBOT:OnInjured
Damage info.
Returns: 0
🔹 ModifyMovementSpeed
Called from NEXTBOT:SetupSpeed
to modfiy calculated movement speed.
Arguments: 1
- number | Calculated speed.
Returns: 1
- any | New speed. Return nothing/nil/false to not change.
🔹 TranslateActivity
Called from NEXTBOT:TranslateActivity
to use custom translation of activity.
Arguments: 1
- number | Activity to translate.
Returns: 1
- any | New activity. Return nothing/nil/false to use default translation.
🔹 GetDesiredActivity
Called from NEXTBOT:SetupActivity
to use custom activity.
Arguments: 0
Returns: 1
- any | Activity. Return nothing/nil/false to use default activity.
🔹 BodyUpdate
Called from NEXTBOT:BodyUpdate
.
Arguments: 0
Returns: 0
🔹 ShouldRun
Called from NEXTBOT:ShouldRun
when bot is not under player control.
Arguments: 0
Returns: 1
- bool | Should run or not.
🔹 ShouldWalk
Called from NEXTBOT:ShouldWalk
when bot is not under player control.
Arguments: 0
Returns: 1
- bool | Should walk or not.
🔹 ShouldCrouch
Called from NEXTBOT:ShouldCrouch
when bot is not under player control.
Arguments: 0
Returns: 1
- bool | Should crouch or not.
🔹 OnJump
Called from NEXTBOT:Jump
.
Arguments: 0
Returns: 0
🔹 OnLandOnGround
Called from NEXTBOT:OnLandOnGround
.
Arguments: 1
- Entity | The entity the bot has landed on.
Returns: 0
🔹 OnFootstep
Called from NEXTBOT:OnFootstep
.
Arguments: 5
- Vector | Footstep sound position.
- bool | false - left foot, true - right foot.
- string | Path to default sound to play.
- number | Volume of footstep.
- CRecipientFilter | Decides who can hear footstep.
Returns: 1
- bool | Should we prevent default sound
🔹 OnStuck
Called from NEXTBOT:OnStuck
.
Arguments: 0
Returns: 0
🔹 OnUnStuck
Called from NEXTBOT:OnUnStuck
.
Arguments: 0
Returns: 0
🔹 StuckCheckShouldIgnoreEntity
Called from NEXTBOT:StuckCheckShouldIgnoreEntity
.
Arguments: 1
- Entity | Entity to check.
Returns: 1
- bool | Return true to skip entity.
🔹 StartControlByPlayer
Called from NEXTBOT:StartControlByPlayer
.
Arguments: 1
- Player | Who will control bot.
Returns: 0
🔹 StopControlByPlayer
Called from NEXTBOT:StopControlByPlayer
.
Arguments: 1
- Player | Who controlled bot.
Returns: 0
🔹🔸 Think
Called from NEXTBOT:Think
.
Arguments: 0
Returns: 0
🔹 OnWeaponEquip
Called from NEXTBOT:OnWeaponEquip
.
Arguments: 1
- Equiped weapon. It will be not lua analog.
Returns: 0
🔹 OnWeaponDrop
Called from NEXTBOT:OnWeaponDrop
.
Arguments: 1
- Dropped weapon. It will be not lua analog.
Returns: 0
🔹 OnStart
Called from NEXTBOT:StartTask
for started task only.
Arguments: 0
Returns: 0
🔹 OnComplete
Called from NEXTBOT:TaskComplete
for completed task only.
Arguments: 0
Returns: 0
🔹 OnFail
Called from NEXTBOT:TaskFail
for failed task only.
Arguments: 0
Returns: 0
🔹 OnDelete
Called from NEXTBOT:TaskComplete
and NEXTBOT:TaskFail
for deleted task only.
Arguments: 0
Returns: 0