Garry's Mod Wiki

Garry's Mod Wiki

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
Clears this bot's last known area. See NextBot:GetLastKnownArea.
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.
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.
Returns this bots last known area. See also NextBot:ClearLastKnownArea.
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.
number NextBot:GetRangeTo( Vector to )
Returns the distance to an entity or position. See also NextBot:GetRangeSquaredTo.
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)

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...