A sensor is the mechanism by which the user can get information about the bot and the bot's environment. For example, the behavior programmer might call the get_left_distance() sensor to determine the distance to the nearest object in the left portion of the bot's field of vision.
Called from within the behavior DLL, the sensors link to functions in the FlexBot "black box" DLL. The following sensors are available to the bot programmer:
Returns the distance to the closest obstacle in the left-hand portion of the bot's vision as determined by 8 evenly spaced traces with a maximum distance defined by the specified range. Note that the "left-hand portion of the bot's vision" is defined as the left-most third of the field of vision (the field of vision is divided into equal thirds). The field-of-view is defined internally in the FlexBot DLL, so the user cannot modify it. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch.
Returns the distance to the closest obstacle in the right-hand portion of the bot's vision as determined by 8 evenly spaced traces with a maximum distance defined by the specified range. The term "right-hand portion" is defined in a manner similar to get_left_distance. The field-of-view is defined internally in the FlexBot DLL, so the user cannot modify it. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch.
Returns the distance to the closest obstacle in the center portion of the bot's vision as determined by 8 evenly spaced traces with a maximum distance defined by the specified range. The term "center portion" is defined in a manner similar to get_left_distance. The field-of-view is defined internally in the FlexBot DLL, so the user cannot modify it. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch.
Returns the distance to the closest obstacle in the specified direction (a yaw relative to the direction that the bot is currently facing) at a maximum of the specified range as determined by a single traceline. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch. Note that sensors such as get_center_distance() could be defined using a series of calls to get_vision_distance(). The only difference is that this would not display the debugging beams that appear when polling the predefined sweep regions.
Returns the distance to the closest obstacle in a sweep of the specified portion of the bot's vision as determined by evenly spaced traces with a maximum distance defined by the specified range. The center of the sweep will be at angle, with the sweep testing sweep degrees to each side of the center (note that this means a range of twice sweep will be tested in total.) Traces will be run every interval degrees starting from the left-hand extreme.
Returns a boolean value indicating whether or not the specified player is visible to the bot. The return value is TRUE if the player is visible, FALSE if the player is not visible. Note that the function does not take into account a limited vision range (a player at an improbably large distance is visible even though this may not be a realistic representation of a human player).
Returns the distance from the bot to the specified player. Return values are always positive. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch. Distance can be returned regardless of whether the player is visible to the bot.
Returns the yaw (left-to-right) angle to the specified player relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a yaw to the right (clockwise) and negative values representing a yaw to the left (counter-clockwise). See the diagram of directions in FlexBot for more information. Yaw can be returned regardless of whether the player is visible to the bot.
Returns the pitch (up-down) angle to the specified player relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a pitch upward and negative values representing a pitch downwards (toward the floor). Pitch can be returned regardless of whether the player is visible to the bot.
Returns the value of the bot's health as an integer. The health level depends on what MOD is being played, but it generally starts at a default of 100. The health is 0 when a player is dead. In a standard Half-Life deathmatch, it is possible to boost your health over 100 by picking up health boosts.
Returns the absolute yaw of the bot with respect to its environment. Return values are floats between 0 and 360, with directions corresponding to those of a compass. The yaw angle is measured in degrees.
Returns the absolute pitch of the bot with respect to its environment. Return values are floats between -180 and 180. Zero is level with the ground. See the diagram of directions in FlexBot for more information. The pitch angle is measured in degrees.
Returns the client index (player number) of the nearest visible enemy as an integer. A value of -1 is returned if there are no visible enemies.
Returns whether the bot has changed position since the last think cycle as a boolean. A value of TRUE means that the bot's is no longer at the same position in the (x,y,z) coordinate system. A value of FALSE indicates that the position remained the same. Note that this function will return false if a bot is turning in place because the origin remains the same. This can be helpful if a bot is stuck on an "unseen" object (certain objects such as chain-link fences and translucent glass objects cannot be seen by bot vision traces.)
Returns the distance to the closest obstacle in the specified direction at a maximum of the specified range as determined by a single traceline. This sensor is distinct from the get_vision_distance() sensor in that it also takes a pitch at which to make the trace (negative pitch is down, positive pitch is up). Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch.
Returns the amount of ammo in the clip of the bot's currently-selected weapon as an integer. For weapons that do not use ammo (i.e. the crowbar), a value of zero is returned.
Returns the total amount of primary-fire ammo held by the bot for the specified weapon as an integer. Note that this is not necessarily the same as the amount of ammo in a weapon's clip (most, but not all, weapons utilize a clip of some type.)
Returns the total amount of secondary-fire ammo held by the bot for the specified weapon as an integer. Note that not all weapons have secondary-fire options or ammunition. For these weapons, a value of zero is returned.
Returns a boolean value indicating whether or not the bot has the specified weapon-type in its possession.
Returns the x-coordinate of the bot's current position in three-dimensional space. May be useful for dynamically building a map or other representation of the bot's environment.
Returns the y-coordinate of the bot's current position in three-dimensional space. May be useful for dynamically building a map or other representation of the bot's environment.
Returns the z-coordinate of the bot's current position in three-dimensional space. Could be useful for dynamically building a map or other representation of the bot's environment.
Returns the weapon-type of the bot's currently-selected weapon as an integer. Refer to the weapon-identifier constants listed with the do_weapon() actuator documentation for a list of possible return values.
Returns a boolean value indicating whether the given player-index belongs to a friend or enemy. If the player is a friend, TRUE is returned. FALSE is returned if the player is an enemy.
Returns the client index (player number) of the nearest visible teammate (friend) as an integer. A value of -1 is returned if there are no visible friends. Teammates will only be found when the multiplayer game is in co-operative mode.
Returns an item-index to the nearest visible item of the given item type. This index can then be passed to item-sensors to gather more information about the item. Item type constants are defined as the following:
0. Weapon
1. Ammo
2. Weaponbox (boxes dropped by dead players)
3. Health-kit
4. Wall-mounted health charger
5. Wall-mounted suit charger
Returns the yaw (left-to-right) angle to the specified item relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a yaw to the right (clockwise) and negative values representing a yaw to the left (counter-clockwise). See the diagram of directions in FlexBot for more information. It is important to pass in the correct item-type along with the item-index - failure to do so may result in unpredictable bot behavior.
Returns the distance from the bot to the specified item. Return values are always positive integers. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch. It is important to pass in the correct item-type along with the item-index - failure to do so may result in unpredictable bot behavior.
Returns the pitch (up-down) angle to the specified player relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a pitch upward and negative values representing a pitch downwards (toward the floor). See the diagram of directions in FlexBot for more information. It is important to pass in the correct item-type along with the item-index - failure to do so may result in unpredictable bot behavior.
Returns a boolean value indicating whether the specified item can be picked up by the bot. A value of FALSE may be returned for a variety of reasons, the most common being that the bot already has the item. If an ammunition item is passed, the function will check if the bot can hold any additional ammo of that type. It is important to pass in the correct item-type along with the item-index - failure to do so may result in unpredictable bot behavior.
Returns the yaw to the nearest audible sound made by an enemy as a float. See the diagram of directions in FlexBot for more information. This sensor acts as a primitive way of giving bots the ability to "hear" enemies. Note that bots can often hear other players through walls, making the sound sensors difficult to use effectively in certain situations.
Returns the distance to the nearest audible sound made by an enemy as an integer. This sensor acts as a primitive way of giving bots the ability to "hear" enemies. The distance measure is provided as an admittedly imperfect substitute for the problem of sound amplitude. Note that bots can often hear other players through walls, making the sound sensors difficult to use effectively in certain situations.
Returns an waypoint-index to the nearest waypoint. This index can then be passed to item-sensors to gather more information about the waypoint and its location. Further discussion of waypoints can be found in the "Complex Navigational Aids - Waypoints and Infopoints" section of the documentation.
Returns the yaw (left-to-right) angle to the specified waypoint relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a yaw to the right (clockwise) and negative values representing a yaw to the left (counter-clockwise). See the diagram of directions in FlexBot for more information. If the waypoint-index is invalid, a value of zero will be returned.
Returns the distance from the bot to the specified waypoint. Return values are always positive integers. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch. If the waypoint-index is invalid, a value of zero will be returned.
Returns the pitch (up-down) angle to the specified waypoint relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a pitch upward and negative values representing a pitch downwards (toward the floor). See the diagram of directions in FlexBot for more information. If the waypoint-index is invalid, a value of zero will be returned.
Returns an infopoint-index to the nearest infopoint of the specified type. This index can then be passed to item-sensors to gather more information about the infopoint and its location. Infopoint-type constant definitions are listed under the do_infopoint() actuator description in this documentation. Further discussion of infopoints can be found in the "Complex Navigational Aids - Waypoints and Infopoints" section of the documentation.
Returns the yaw (left-to-right) angle to the specified infopoint relative to the bot's current view angle. Return values are in degrees and range from [-180, 180] with positive values representing a yaw to the right (clockwise) and negative values representing a yaw to the left (counter-clockwise). See the diagram of directions in FlexBot for more information. If the infopoint-index is invalid, a value of zero will be returned. It is important to pass in the correct infopoint-type along with the infopoint-index - failure to do so may result in unpredictable bot behavior.
Returns the distance from the bot to the specified infopoint. Return values are always positive integers. Units are in standard Half-life distance units, which is one Half-Life unit equal to one inch. If the infopoint-index is invalid, a value of zero will be returned. It is important to pass in the correct infopoint-type along with the infopoint-index - failure to do so may result in unpredictable bot behavior.
Returns the pitch (up-down) angle to the specified infopoint relative to the bot's current view angle as a float. Return values are in degrees and range from [-180, 180] with positive values representing a pitch upward and negative values representing a pitch downwards (toward the floor). See the diagram of directions in FlexBot for more information. If the infopoint -index is invalid, a value of zero will be returned. It is important to pass in the correct infopoint-type along with the infopoint-index - failure to do so may result in unpredictable bot behavior.
Returns an infopoint-index to the nearest infopoint of the specified type as an integer. This index can then be passed to item-sensors to gather more information about the infopoint and its location. It is important to pass in the correct infopoint-type along with the infopoint-index-- failure to do so may result in unpredictable bot behavior.
Returns a boolean indicating whether or not the bot is currently on a ladder.