Garry's Mod Wiki

Garry's Mod Wiki

This class is essentially what controls a NextBot NPC. You can access it in a NextBot NPC by using self.loco variable.

Methods

CLuaLocomotion:Approach( Vector goal, number goalweight )
Sets the location we want to get to. Each call of Approach moves the NextBot 1 unit towards the specified goal. The size of this unit is determined by SetDesiredSpeed; the default is 0 (each call of Approach moves the NextBot 0). To achieve smooth movement with Approach, it should be called in a hook like Think, as shown in the example.
CLuaLocomotion:ClearStuck()
Removes the stuck status from the bot
CLuaLocomotion:FaceTowards( Vector goal )
Sets the direction we want to face
number CLuaLocomotion:GetAcceleration()
Returns the acceleration speed
boolean CLuaLocomotion:GetAvoidAllowed()
Returns whether the Nextbot is allowed to avoid obstacles or not.
boolean CLuaLocomotion:GetClimbAllowed()
Returns whether the Nextbot is allowed to climb or not.
Returns the current acceleration as a vector
number CLuaLocomotion:GetDeathDropHeight()
Gets the height the bot is scared to fall from
number CLuaLocomotion:GetDeceleration()
Gets the deceleration speed
number CLuaLocomotion:GetDesiredSpeed()
Returns the desired movement speed set by CLuaLocomotion:SetDesiredSpeed
number CLuaLocomotion:GetGravity()
Returns the locomotion's gravity.
Vector CLuaLocomotion:GetGroundMotionVector()
Return unit vector in XY plane describing our direction of motion - even if we are currently not moving
Vector CLuaLocomotion:GetGroundNormal()
Returns the current ground normal.
boolean CLuaLocomotion:GetJumpGapsAllowed()
Returns whether the Nextbot is allowed to jump gaps or not.
number CLuaLocomotion:GetJumpHeight()
Gets the height of the bot's jump
number CLuaLocomotion:GetMaxJumpHeight()
Returns maximum jump height of this CLuaLocomotion.
number CLuaLocomotion:GetMaxYawRate()
Returns the max rate at which the NextBot can visually rotate.
NextBot CLuaLocomotion:GetNextBot()
Returns the NextBot this locomotion is associated with.
number CLuaLocomotion:GetStepHeight()
Gets the max height the bot can step up
Vector CLuaLocomotion:GetVelocity()
Returns the current movement velocity as a vector
boolean CLuaLocomotion:IsAreaTraversable( CNavArea area )
Returns whether this CLuaLocomotion can reach and/or traverse/move in given CNavArea.
boolean CLuaLocomotion:IsAttemptingToMove()
Returns true if we're trying to move.
boolean CLuaLocomotion:IsClimbingOrJumping()
Returns true of the locomotion engine is jumping or climbing
boolean CLuaLocomotion:IsOnGround()
Returns whether the nextbot this locomotion is attached to is on ground or not.
boolean CLuaLocomotion:IsStuck()
Returns true if we're stuck
boolean CLuaLocomotion:IsUsingLadder()
Returns whether or not the target in question is on a ladder or not.
CLuaLocomotion:Jump( number act = ACT_JUMP )
Makes the bot jump. It must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
CLuaLocomotion:JumpAcrossGap( Vector landingGoal, Vector landingForward )
Makes the bot jump across a gap. The bot must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
CLuaLocomotion:SetAcceleration( number speed )
Sets the acceleration speed
CLuaLocomotion:SetAvoidAllowed( boolean allowed )
Sets whether the Nextbot is allowed try to to avoid obstacles or not. This is used during path generation. Works similarly to nb_allow_avoiding convar. By default bots are allowed to try to avoid obstacles.
CLuaLocomotion:SetClimbAllowed( boolean allowed )
Sets whether the Nextbot is allowed to climb or not. This is used during path generation. Works similarly to nb_allow_climbing convar. By default bots are allowed to climb.
CLuaLocomotion:SetDeathDropHeight( number height )
Sets the height the bot is scared to fall from.
CLuaLocomotion:SetDeceleration( number deceleration )
Sets the deceleration speed.
CLuaLocomotion:SetDesiredSpeed( number speed )
Sets movement speed.
CLuaLocomotion:SetGravity( number gravity )
Sets the locomotion's gravity. With values 0 or below, or even lower positive values, the nextbot will start to drift sideways, use CLuaLocomotion:SetVelocity to counteract this.
CLuaLocomotion:SetJumpGapsAllowed( boolean allowed )
Sets whether the Nextbot is allowed to jump gaps or not. This is used during path generation. Works similarly to nb_allow_gap_jumping convar. By default bots are allowed to jump gaps.
CLuaLocomotion:SetJumpHeight( number height )
Sets the height of the bot's jump
CLuaLocomotion:SetMaxYawRate( number yawRate )
Sets the max rate at which the NextBot can visually rotate. This will not affect moving or pathing.
CLuaLocomotion:SetStepHeight( number height )
Sets the max height the bot can step up
CLuaLocomotion:SetVelocity( Vector velocity )
Sets the current movement velocity

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...