NextBot
NextBots are a new system to create NPCs in the Source Engine, utilizing the more powerful navmesh system for navigation over the old node based system.
This page lists all possible functions usable with NextBots.
See NextBot NPC Creation for more information on how to create NextBot NPCs.
Inherits methods from Entity.
Methods
Become a ragdoll and remove the entity.
NextBot:BodyMoveXY()
Should only be called in NEXTBOT:BodyUpdate. This sets the move_x and move_y pose parameters of the bot to fit how they're currently moving, sets the animation speed (Entity:GetPlaybackRate) to suit the ground speed, and calls Entity:FrameAdvance.
This function might cause crashes with some activities. Issue Tracker: 3420
NextBot:ClearLastKnownArea()
Clears this bot's last known area. See NextBot:GetLastKnownArea.
Like NextBot:FindSpots but only returns a vector.
number NextBot:GetActivity()
Returns the currently running activity
Returns the Field of View of the Nextbot NPC, used for its vision functionality, such as NextBot:IsAbleToSee.
CNavArea NextBot:GetLastKnownArea()
Returns this bots last known area. See also NextBot:ClearLastKnownArea.
number NextBot:GetMaxVisionRange()
Returns the maximum range the nextbot can see other nextbots/players at. See NextBot:IsAbleToSee.
Returns squared distance to an entity or a position.
See also NextBot:GetRangeTo.
Returns the distance to an entity or position.
See also NextBot:GetRangeSquaredTo.
number NextBot:GetSolidMask()
Returns the solid mask for given NextBot.
NextBot:HandleStuck()
Called from Lua when the NPC is stuck. This should only be called from the behaviour coroutine - so if you want to override this function and do something special that yields - then go for it.
You should always call self. loco:ClearStuck() in this function to reset the stuck status - so it knows it's unstuck. See CLuaLocomotion:ClearStuck.
Returns if the Nextbot NPC can see the give entity or not.
Using this function creates the nextbot vision interface which will cause a significant performance hit!
To be called in the behaviour coroutine only! Will yield until the bot has reached the goal or is stuck
To be called in the behaviour coroutine only! Plays an animation sequence and waits for it to end before returning.
Sets the Field of View for the Nextbot NPC, used for its vision functionality, such as NextBot:IsAbleToSee.
NextBot:SetMaxVisionRange( number range )
Sets the maximum range the nextbot can see other nextbots/players at. See NextBot:IsAbleToSee.
NextBot:SetSolidMask( number mask )
Sets the solid mask for given NextBot.
The default solid mask of a NextBot is MASK_NPCSOLID.
NextBot:StartActivity( number activity )
Start doing an activity (animation)