-
Notifications
You must be signed in to change notification settings - Fork 2
Functions
Here is a list of bot functions you can use.
This function will show messages in console if the CVar, gmbots_debug_mode, is over 0.
- Message = Self-explanatory.
- Color = The color of the message, you shouldn't have to use this.
- IsAError = Used for Player:Error, which isn't gonna be shown on this page, since you shouldn't have to use it.
ply:Debug("This is a example.",Color(0,255,0),false)
This would be shown in Green, just use your imagination.
GMBots Debug, BOT Example: This is a example.
This function will pathfind for you!
- CMD = User CMD, which is the second parameter you get from the 'GMBotsStart' hook.
- Position = Vector to pathfind too.
- Walk = Walk when you're close to the Position.
if ply.Enemy then
ply:Pathfind(cmd,ply.Enemy:GetPos(),true)
end
This function will follow a target, while also keeping distance.
This function also runs Player:Pathfind when the Target is not visible.
- CMD = User CMD, which is the second parameter you get from the 'GMBotsStart' hook.
- Target = The target to follow, which should be a player.
if ply.Friend then
ply:BotFollow(cmd,ply.Friend)
end
This function will make the Bot wander to spots in the nav mesh.
- CMD = User CMD, which is the second parameter you get from the 'GMBotsStart' hook.
if not ply.Enemy then
ply:BotWander(cmd)
end
This function makes the bot say something, but also has more parameters than Player:Say.
- Message = Self-explanatory.
- TeamOnly = Self-explanatory. Defaults to false.
- Cooldown = This function has a cooldown, you can use this to modify how long the cooldown is. Defaults to 2.
- Time = Should the bot take time to "type"? Defaults to false.
- TimeMultiplier = Multiply how long it would take to "type" by this amount. Defaults to 1.
The Time parameter's math is "(string length)/7 * (TimeMultiplier)
ply:BotSay("This is a example.",false,2,true,1)
This would take 2.57142857 seconds for the bot to "type".
BOT Example: This is a example.
This function will look for a player, if it find's one, it will return whoever it found.
- UseTeams = Should we only find people on other teams? Defaults to false.
ply.Enemy = ply:LookForPlayers(false)
if ply.Enemy then
ply:Debug("I found a enemy! "..ply.Enemy:Name())
end
Once the player finds a enemy...
GMBots Debug, BOT Example: I found a enemy! Noobz4Life
This returns if the Target is visible to the bot or not. This isn't the same as Entity:Visible, as this function finds if you can see the target infront of you.
- Target = Self-explanatory.
ply.Enemy = ply.Enemy or ply:LookForPlayers(false)
if ply.Enemy and ply:BotVisible(ply.Enemy) then
ply:Debug("Enemy is visible!")
end
Once the player finds a enemy and the enemy is visible...
GMBots Debug, BOT Example: Enemy is visible