Garry's Mod Wiki

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.

Methods

Entity NextBot:BecomeRagdoll( CTakeDamageInfo info )
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
Vector NextBot:FindSpot( string type, table options )
Like NextBot:FindSpots but only returns a vector.
table NextBot:FindSpots( table specs )
Returns a table of hiding spots.
number NextBot:GetActivity()
Returns the currently running activity
number NextBot:GetFOV()
Returns the Field of View of the Nextbot NPC, used for its vision functionality, such as NextBot:IsAbleToSee.
number NextBot:GetMaxVisionRange()
Returns the maximum range the nextbot can see other nextbots/players at. See NextBot:IsAbleToSee.
number NextBot:GetRangeSquaredTo( Vector to )
Returns squared distance to an entity or a position. See also NextBot:GetRangeTo.
number NextBot:GetRangeTo( Vector to )
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.
boolean NextBot:IsAbleToSee( Entity ent, number useFOV = true )
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!
string NextBot:MoveToPos( Vector pos, table options )
To be called in the behaviour coroutine only! Will yield until the bot has reached the goal or is stuck
NextBot:PlaySequenceAndWait( string name, number speed = 1 )
To be called in the behaviour coroutine only! Plays an animation sequence and waits for it to end before returning.
NextBot:SetFOV( number fov )
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)

Page Links


Special Pages


Wikis

?

Render Time: 40ms

DB GetPage 6
Generate Html 3
SaveChanges (1) 16
Render Body 0
Render Sidebar 11