Bot

From MyGamingTalk
Script Reference Bot Functions

Bot Properties


Unless otherwise noted, all properties can be get and set.

AimDamping

Effects the acceleration and turn rate.

AimPersistance

The time(in seconds) the bot will continue to aim at the last position of a target before aborting.

AimStiffness

Effects the acceleration of turning.

AimTolerance

The tolerance(in degrees) the bot tries to aim at stuff with.

Armor

Current Armor

FieldOfView

The angle(in degrees) the bot is capable of 'seeing'.

Health

Current health.

MaxArmor

Max Armor

MaxHealth

Max Health

MaxTurnSpeed

The maximum speed(in degrees/second) the bot can rotate his aim at.

MaxViewDistance

The max distance(in game units) the bot is capable of seeing.

MemorySpan

The time(in seconds) taken for the memory about an entity to become stale.

Name

Name of the bot.

ReactionTime

The time(in seconds) it takes the bot to begin responding to a newly sensed threat.


Enemy Territory Addendum


DoNotKill

Set it to true to prevent medics to kill the bot for revive. It is used by BUILD, PLANT and PLANTMINE goals.

TargetBreakableDist

The maximum distance (in game units) the bot will attempt to target breakable entities. It can be set by pre-scripted trigger region or inside OnBotJoin function.


Bot Functions


AddScriptGoal

Adds a goal to the bots behavior tree by name. Useful when a script goal has AutoAdd set to false, so you can more explicitly control when a bot gets the goal.

Parameters: (name of script goal to add to bot behavior tree)

Returns: true on success, false on failure

Example:

 b.AddScriptGoal("TestBot");

RemoveState

Removes a state from a bots behavior tree by name.

Parameters: (name of script goal to remove from bot behavior tree)

Returns: none

Example:

 b.RemoveState("TestBot");

SetStateEnabled

Enables/Disables a state by name.

Parameters: (name of state, bool enable)

Returns: none

Example:

 b.SetStateEnabled("Attack", false); // disable attack state


CanGrabItem

Returns true if bot can take item (flag, gold, radar parts, ...).

Parameters: (GameEntity)

Parameters: (FLAG or FLAG_dropped goal name)

Returns: true/false

Example:

 if (b.CanGrabItem("FLAG_gold")) {
 }

ChangeClass

Changes the bot to a specified class.

Parameters: (classId)

Returns: none

Example:

 b.ChangeClass(CLASS.SOLDIER);

ChangeTeam

Changes the bot to a specified team.

Parameters: (teamId)

Returns: none

Example:

 b.ChangeTeam(TEAM.AXIS);

ClearRoles

Takes away a role from the bot.

Parameters: roleId

Returns: none

Example:

 b.ClearRoles(ROLE.ATTACKER);

See Also: SetRoles, HasRole


DisableBotPush

Used by pre-scripted trigger region.

Parameters: (true/false)

Returns: none

Example:

 b.DisableBotPush(true);

DistanceTo

Overloaded utility function for simplified distance checks.

Parameters: (Vector3, useEyePosition<default false>)

Parameters: (MapGoal, useEyePosition<default false>)

Parameters: (GameEntity/GameId, useEyePosition<default false>)

Returns: float - distance from bot to Vector3, MapGoal, GameEntity or GameId

Example:

 v = Vector3(10,20,30);
 target = b.GetTarget();
 // distance from bot to target entity
 d1 = b.DistanceTo(target);
 // distance from bot to world position
 d2 = b.DistanceTo(v);
 // distance from bot eye to world position
 d3 = b.DistanceTo(v, true);

DumpBotTable

Dumps a file with the bot's table to a file in the user folder.

Parameters: (filename)

Returns: none

Example:

 b.DumpBotTable("foo.txt");

Enable

Disables all thinking for the bot.

Parameters: (true/false)

Returns: none

Example:

 b.Enable(false);

ExecCommand

Executes a string command on the bot as if the bot executed a console command.

Parameters: (command)

Returns: none

Example:

 b.ExecCommand("kill");

Weapons/Ammo

CanSnipe

It's deprecated and has been replaced by Util.CanBotSnipe(bot) in Enemy Territory.

Checks if the bot can snipe based on the internally implemented snipe checks. Vary by game. Typically involves checking if the bot has a snipe enabled weapon and has ammo.

Parameters: none

Returns: true if the bot can snipe, else false

Example:

 if(b.CanSnipe()) {}

EnableShooting

Disables all shooting for the bot.

Parameters: (true/false)

Returns: none

Example:

 b.EnableShooting(false);

GetWeapon

Gets a reference to a specific weapon from the bot.

Parameters: (weaponId)

Returns: Weapon reference, or NULL if the bot doesn't have the weapon.

Example:

 wpn = b.GetWeapon(WEAPON.SHOTGUN);
 wpn.PrimaryFire.AimOffset = Vector3(0,0,10);

GetBestWeapon

Gets a weapon id for the best weapon versus current target or a specific entity.

Parameters: none - uses current target

Parameters: (entity) evaluate weapon versus specific target entity

Returns: weapon id of weapon that is chosen.

Example:

 best = b.GetBestWeapon();
 // OR
 best = b.GetBestWeapon(someEnt);

GetRandomWeapon

Gets a random weapon id from the list of weapons the bot currently has.

Parameters: none

Returns: random weapon id

Example:

 randwpn = b.GetRandomWeapon();

GetCurrentWeapon

Gets the current weapon id for the bot.

Parameters: none

Returns: weapon Id for bot

Example:

 mywpn = b.GetCurrentWeapon();
 if(mywpn == WEAPON.SHOTGUN)
 {
 }

GetCurrentAmmo

Gets the ammo information for a weapon.

Parameters: (table)

Parameters: (table, firemode)

Parameters: (table, firemode, weaponId)

Returns: true if successful, false if not

Example:

 ammoTable = {};
 // Get primary ammo for current weapon
 b.GetCurrentAmmo(ammoTable);
 // Get secondary ammo for current weapon
 b.GetCurrentAmmo(ammoTable, 1);
 // Get primary ammo for another weapon.
 b.GetCurrentAmmo(ammoTable, 0, WEAPON.SHOTGUN);

 print("Current Ammo:", ammoTable.CurrentAmmo);
 print("Max Ammo:", ammoTable.MaxAmmo);
 print("Current Clips:", ammoTable.CurrentClip);
 print("Max Clips:", ammoTable.MaxClip);

GetMostDesiredAmmo

Gets information about the currently most needed ammo.

Parameters: (table)

Returns: none

Example:

 mostNeededAmmo = {};
 b.GetMostDesiredAmmo(mostNeededAmmo);
 if( mostNeededAmmo.Desire > 0) {
  print("Need ammo for weapon", Util.WeaponName(mostNeededAmmo.AmmoType));
 }

FireWeapon

Fires the current weapon.

Parameters: none

Returns: none

Example:

 b.FireWeapon();

HasAmmo

Checks if the bot has a certain ammo type.

Parameters: () - If no parameters passed, checks current weapon ammo.

Parameters: (WeaponId)

Parameters: (WeaponId, needed amount)

Returns: true/false if the bot has ammo.

Example:

 if(b.HasAmmo())
 {
 }
 if(b.HasAmmo(WEAPON.MP40))
 {
 }

HasAnyWeapon

Checks if the bot has any of specified weapons. Table keys are weaponIDs, table values should be set to true.

Parameters: (weapons, options<optional>, weaponList<optional>)

The second parameter is table which has items CheckAmmo and CheckCharged. Both options are true by default.

The third parameter is empty table to store all results.

Returns: weaponId if the bot has that weapon, 0 if the bot does not have any weapon from the list.

Example:

 weapons = table();
 weapons[WEAPON.MP40] = true;
 weapons[WEAPON.THOMPSON] = true;
 weapon = b.HasAnyWeapon(weapons, { CheckAmmo=true, CheckCharged=false } );
 if (weapon) {
 }

HasWeapon

Checks if the bot has a specific weapon.

Parameters: (weaponId)

Returns: true if the bot has it, false if not.

Example:

 if(b.HasWeapon(WEAPON.SHOTGUN))
 {
 }

IsWeaponCharged

Checks if a weapon is charged. A charged weapon is one that is capable of being used that might occasionally be unavailable for use due to lack of character 'charge', whether that be a gameplay charge bar, stamina, skill, etc.

Parameters: (weaponId, firemode<optional>)

Returns: true if weapon is charged, false if not.

Example:

 if(b.IsWeaponCharged(WEAPON.MORTAR, 0))
 {
 }

GetAllAlly

Fills a table with all known allied entities (from bot's sensory memory) that match a desired criteria.

Parameters: (category, class, table)

Returns: none

Example:

 // Get all known soldier players.
 players = table();
 b.GetAllAlly(CAT.PLAYER, CLASS.SOLDIER, players);
 foreach ( ent in players )
 {
     print(ent);
 }

GetAllEnemy

Fills a table with all known enemy entities (from bot's sensory memory) that match a desired criteria.

Parameters: (category, class, table)

Returns: none

Example:

 // Get all known soldier players.
 players = table();
 b.GetAllEnemy(CAT.PLAYER, CLASS.SOLDIER, players);
 foreach ( ent in players )
 {
     print(ent);
 }

GetAllType

Fills a table with all known entities (from bot's sensory memory) that match a desired criteria.

Parameters: (category, class, table)

Returns: none

Example:

 // Get all known soldier players.
 players = table();
 b.GetAllType(CAT.PLAYER, CLASS.SOLDIER, players);
 foreach ( ent in players )
 {
     print(ent);
 }

GetClass

Gets the current class id for the bot.

Parameters: none

Returns: class Id for bot

Example:

 myclass = b.GetClass();
 if(myClass == CLASS.SOLDIER)
 {
 }

GetEyePosition

Gets the world position of the bots 'eye'

Parameters: none

Returns: Vector3 eye position

Example:

 eyepos = b.GetEyePosition();

GetFacing

Gets the facing vector for the bots aim.

Parameters: none

Returns: Vector3 facing vector

Example:

 facing = b.GetFacing();
 pointinfront = b.GetEyePosition() + facing * 100;

GetGameEntity

Gets the game entity for the bot.

Parameters: none

Returns: entity

Example:

 ent = b.GetGameEntity();

GetGameId

Gets the game id for the bot.

Parameters: none

Returns: entity

Example:

 gameid = b.GetGameId();

GetHealthPercent

Gets the bot's current health percentage.

Parameters: none

Returns: 0.0 - 1.0 health scalar

Example:

 if(bot.GetHealthPercent() < 0.5) 
 {
     // < 50% health
 }

GetHighLevelGoalName

Gets the bot's current high level goal name.

Examples: UseCabinet, WatchForProjectile, CovertOps, BUILD, PLANT, CAMP, SWITCH, ROAMING, ...


Some goal names changed after they were moved to scripts.

Goals in 0.81: DefuseDynamite, ReviveTeammate, TakeCheckPoint, RepairMg42

Goals in 0.82: DEFUSE, REVIVE, CHECKPOINT, REPAIRMG42


Goals in 0.83: CaptureTheFlag, ReturnTheFlag, MobileMortar, PlantMine, CallArtillery

Goals in 0.84: FLAG, FLAGRETURN, MOBILEMORTAR, PLANTMINE, CALLARTILLERY


Parameters: none

Returns: goal name, or NULL if the bot doesn't have a high level goal.

Example:

 g = bot.GetHighLevelGoalName();

GetMapGoalName

Gets the bot's current map goal name (for example: BUILD_Tank, DEFEND_depot1, ...).

Returns NULL if the current high level goal is ROAMING, WatchForProjectile or CovertOps.

Note: This function has been added in 0.82.

Parameters: none

Returns: goal name or NULL.

Example:

 g = bot.GetMapGoalName();

GetLastTarget

Gets the target the bot had before the current target.

Parameters: none

Returns: entity OR null

Example:

 last = b.GetLastTarget();

GetNearest

Gets the nearest target matching the desired criteria, friend or foe.

Parameters: (category)

Parameters: (category, classId)

Parameters: (category, table of classIds)

Returns: entity OR null

Example:

 // get nearest player, defaults to any class within that category
 p = b.GetNearest(CAT.PLAYER);
 // get nearest soldier or medic player
 s = b.GetNearest(CAT.PLAYER, {CLASS.SOLDIER, CLASS.MEDIC});

GetNearestAlly

Gets the nearest target matching the desired criteria, only allies

Parameters: (category)

Parameters: (category, classId)

Parameters: (category, table of classIds)

Returns: entity OR null

Example:

 // get nearest player, defaults to any class within that category
 p = b.GetNearestAlly(CAT.PLAYER);
 // get nearest soldier player
 s = b.GetNearestAlly(CAT.PLAYER, CLASS.SOLDIER);

GetNearestEnemy

Gets the nearest target matching the desired criteria, only enemies

Parameters: (category)

Parameters: (category, classId)

Parameters: (category, table of classIds)

Returns: entity OR null

Example:

 // get nearest player, defaults to any class within that category
 p = b.GetNearestEnemy(CAT.PLAYER);
 // get nearest soldier player
 s = b.GetNearestEnemy(CAT.PLAYER, CLASS.SOLDIER);

GetNearestDestination

Finds paths from the current bot position to multiple destination positions. Returns index of the destination which has the shortest path. It can depend on navigation flags (e.g. teleports, axis/allied waypoints).

Parameters: (table of vectors)

Returns: index OR null

Example:

 positions = { Vec3(105,4564,0), Vec3(-48,1234,0) };
 id = bot.GetNearestDestination(positions);
 if(typeId(id)==0)
 {
 	print("path not found");
 }else{
 	print("path found to destination", positions[id]);
 }

GetPosition

Gets the world position of the bot.

Parameters: none

Returns: Vector3 world position

Example:

 mypos = b.GetPosition();

GetTarget

Gets the current target.

Parameters: none

Returns: entity OR null

Example:

 target = b.GetTarget();

GetTargetInfo

Returns the TargetInfo for an entity.

Parameters: (entity/gameId)

Returns: TargetInfo for entity.

Example:

 ti = b.GetTargetInfo(b.GetTarget());

GetTeam

Gets the current team the bot is on.

Parameters: none

Returns: team #

Example:

 myteam = b.GetTeam();

See also: TEAM


GetVelocity

Gets the world velocity of the bot. The bot must be alive. It returns wrong vector if the bot is injured.

Parameters: none

Returns: Vector3 world velocity

Example:

 myvel = b.GetVelocity();

HasTarget

Checks if the bot has a current target

Parameters: none

Returns: true if bot has a target

Example:

 if(b.HasTarget())
 {
 }

HasAnyEntityFlag

Checks if the bot has a given entity flag. This function can take any number of flags to check, and will return true if the bot has at least one of the flags, or false if it doesn't have any of them.

Parameters: (entityflag, ...)

Returns: true if bot has any flag, false if not

Example:

 // checking 1 flag
 if(b.HasAnyEntityFlag(ENTFLAG.ZOOMING))
 {
 }
 // checking multiple flags.
 if(b.HasAnyEntityFlag(ENTFLAG.MOUNTED, ENTFLAG.ON_LADDER))
 {
 }

HasEntityFlag

Checks if the bot has a given entity flag. This function can take any number of flags to check, and will return true if the bot has all the flags, or false if it is missing any.

Parameters: (entityflag, ...)

Returns: true if bot has all flags, false if not

Example:

 // checking 1 flag
 if(b.HasEntityFlag(ENTFLAG.RELOADING))
 {
 }
 // checking multiple flags.
 if(b.HasEntityFlag(ENTFLAG.INWATER, ENTFLAG.UNDERWATER))
 {
 }

HasLineOfSightTo

This functions checks whether the bot has line of sight to a 3d position. This function does not account for field of view, simply does a raycast for obstructions between the bots eye position and the provided position. To account for field of view, use InFieldOfView. If an entity or gameId is provided as the 2nd parameter, the function will return true if the raycast hits nothing on its way to the position OR if it hits the entity that is passed.

Parameters: (Vector3 position)

Parameters: (Vector3 position, entity)

Returns: true if the bot has line of sight to the position or entity passed. false if the bot's view is obstructed.

Note: This function calls TraceLine with parameter TRACE.SHOT | TRACE.SMOKEBOMB

Example:

 if(b.HasLineOfSightTo( Vec3(30,50,10) ))
 {
 }

HasPowerUp

Checks if the bot has a given powerup. This function can take any number of flags to check, and will return true if the bot has all the flags, or false if it is missing any.

Parameters: (powerup, ...)

Returns: true if bot has all powerups, false if not

Example:

 // checking 1 flag
 if(b.HasPowerUp(POWERUP.INVINCIBLE))
 {
 }
 // checking multiple flags.
 if(b.HasPowerUp(POWERUP.INVINCIBLE, POWERUP.QUADDAMAGE))
 {
 }

HasRole

Checks if the bot has a specific role or any role.

Parameters: roleId <optional>

Returns: true if the bot has role, false if not.

Example:

 if(b.HasRole(ROLE.INFILTRATOR)){
 }

See Also: ClearRoles, SetRoles


HoldButton

Makes the bot 'press' a button, and hold it for an amount of time. This function can take any number of buttons as parameters, and will apply the effect to all of them. The time value is ALWAYS the last parameter.

Parameters: (buttonId, ..., time in seconds)

Returns: none

Example:

 // hold crouch for 5 seconds
 b.HoldButton(BTN.CROUCH, 5);
 // hold multiple buttons for 5 seconds
 b.HoldButton(BTN.CROUCH, BTN.SPRINT, 5);

See Also: PressButton, ReleaseButton


IgnoreTarget

This function causes the bot to ignore specific entities for targeting for some duration of time.

Parameters: (entity/gameId or goal name or table, seconds to ignore <optional>)

Returns: none

Example:

 // ignore the entity, so the bot won't shoot at it.
 bot.IgnoreTarget("MOVER_bird1");
 bot.IgnoreTarget(Map.Movers);
 bot.IgnoreTarget(GetLocalEntity(), 100);

See also: Bots shooting map objects


InFieldOfView

Checks whether a position is within the bots current FieldOfView. This function can take an optional field of view(in degrees) to check. If not provided, it will use the bots current FieldOfView.

Parameters: (Vector3 position)

Parameters: (Vector3 position, fov angles)

Returns: Vector3 - center point of the AABB.

Example:

 v = Vector3(10,10,10);
 // check if in default field of view
 if(b.InFieldOfView(v))
 {
 }
 // check if in custom field of view
 if(b.InFieldOfView(v, 180))
 {
 }

IsAllied

Checks if the bot is allied with a given entity.

Parameters: (entity/gameId)

Returns: true if allied, false if not.

Example:

 if(b.IsAllied(someentity))
 {
 }

IsCarryingFlag

Checks if the bot is carrying objective (flag, gold, documents, radar parts, ...).

Parameters: none

Returns: true/false

Example:

 if(b.IsCarryingFlag())
 {
 }

IsStuck

Checks if the bot considers himself to be stuck. Stuckness is typically defined as an insignificant amount of movement over a short period of time. The time can be optionally passed to the function for flexibility.

Parameters: () - If no params passed, the time used is 0.5 seconds.

Parameters: (time in seconds)

Returns: true if bot is stuck, false if not.

Example:

 if(b.IsStuck())
 {
 }
 // or check stuckness for 1.5 seconds.
 if(b.IsStuck(1.5))
 {
 }

MoveTowards

Causes the bot to blindly move towards a target. This function does no path finding. It's primary use is short range movement when you are reasonably sure the bot can run right at the target.

Parameters: (Vector3 position) - if distance tolerance not specified, default of 32 units is used.

Parameters: (Vector3 position, distance tolerance)

Returns: true if the bot is within the distance tolerance, false if not.

Example:

 // get within 64 units of this position
 v = Vector3(10,10,10);
 while(b.MoveTowards(v, 64) == false)
 {
     yield();
 }

PressButton

Makes the bot 'press' a button. This function can take any number of buttons as parameters, and will apply the effect to all of them. Buttons that are pressed using this function are released automatically for the next bot update.

Parameters: (buttonId, ...)

Returns: none

Example:

 // press crouch
 b.PressButton(BTN.CROUCH);
 // press multiple buttons
 b.PressButton(BTN.CROUCH, BTN.SPRINT);

See Also: HoldButton, ReleaseButton


ReleaseButton

Makes the bot 'release' a button. This function can take any number of buttons as parameters, and will apply the effect to all of them.

Parameters: (buttonId, ...)

Returns: none

Example:

 // release crouch
 b.ReleaseButton(BTN.CROUCH);
 // release multiple buttons
 b.ReleaseButton(BTN.CROUCH, BTN.SPRINT);

See Also: HoldButton, PressButton


ReloadProfile

Reloads the bots profile. The profile is any script associated with the bots name.

Parameters: none

Returns: none

Example:

 b.ReloadProfile();

ResetStuckTime

Reset the stuck timer.

Parameters: none

Returns: none

Example:

 b.ResetStuckTime();

Say

Chat function used for bots to say messages through the normal chat channels of the game. For flexibility, this function can take any number and type of parameters, which it will convert to a single long string and use as the chat message.

Parameters: (string, ...)

Returns: none

Example:

 b.Say("My name is ", b.Name);

See Also: SayTeam, SayVoice


SayTeam

Chat function used for bots to say messages through the team chat channel of the game. For flexibility, this function can take any number and type of parameters, which it will convert to a single long string and use as the chat message.

Parameters: (string, ...)

Returns: none

Example:

 b.SayTeam("My name is ", b.Name);

See Also: Say, SayVoice


SayVoice

Broadcasts a voice macro to the game. Used with global VOICE table values.

Parameters: (macroId)

Returns: none

Example:

 b.SayVoice(VOICE.NEED_MEDIC);

See Also: Say, SayTeam


ScriptEvent

Sends SCRIPTMSG event.

Parameters: (name, param1, param2, param3)

Returns: none


SetDebugFlag

Enables a debug flag for the bot. See the global DEBUG table for available options. Enabling debug flags typically cause various debug visualizations to render in order to help identify whats going on with various systems of the bot.

Parameters: (flag, true/false to enable)

Returns: none

Example:

 b.SetDebugFlag(DEBUG.AIM, true);

SetRoles

Assign a role to the bot.

Parameters: roleId

Returns: none

Example:

 b.SetRoles(ROLE.DEFENDER);

See Also: ClearRoles, HasRole


ToLocalSpace

Converts a vector into local bot space. This results in a position relative to the bots current position and rotation. This function is useful for simplifying some types of logic.

  • x axis is side to side.
  • y axis is forward and back.
  • z axis is up and down.

Parameters: (Vector3)

Returns: Vector3 local space position.

Example:

 v = Vector3(4356,342,276); // some world position.
 v2 = b.ToLocalSpace(v);
 if(v2.y < 0)
 {
     // the position is behind the bot.
 }
 if(v2.x < 0)
 {
     // the position is to the right of the bot
 }

ToWorldSpace

Converts a vector from local bot space to world space.

  • x axis is side to side.
  • y axis is forward and back.
  • z axis is up and down.

Parameters: (Vector3)

Returns: Vector3 world space position.

Example:

 // slightly forward and to the right.
 v = Vector3(10,10,0);
 v2 = b.ToWorldSpace(v);



Enemy Territory Addendum

ChangePrimaryWeapon

Selects a new primary weapon for the bot. Should take effect next spawn. You must not use this function inside map scripts. You should use SetWeaponAvailability if you want to disable some weapons.

Parameters: (weaponId)

Returns: true if successful, false if not

Example:

 b.ChangePrimaryWeapon(WEAPON.PANZERFAUST);

See Also: ChangeSecondaryWeapon


ChangeSecondaryWeapon

Selects a new secondary weapon for the bot. Should take effect next spawn.

Parameters: (weaponId)

Returns: true if successful, false if not

Example:

 b.ChangeSecondaryWeapon(WEAPON.LUGER);

See Also: ChangePrimaryWeapon


ChangeSpawnPoint

Changes the desired spawn point for the bot to respawn at.

Parameters: (spawnpoint #)

Returns: none

Example:

 b.ChangeSpawnPoint(2);

GetConstructableState

Check state of a BUILD goal.

Parameters: (entity)

Returns: 1 if the bot can build the entity, 0 if the entity is already built, -1 if the entity is not constructable or has been built by enemy.

Example:

 if(b.GetConstructableState(TargetEntity) < 1 ) { 
 }

GetCursorHint

When a player is near enough something to get a hint icon, such as for dynamiting, this function can access what hint is showing. Some of these hints may or may not ever show up, they were taken as-is from the ET SDK.

  • NONE - 0
  • PLAYER - 1
  • ACTIVATE - 2
  • DOOR - 3
  • DOOR_ROTATING - 4
  • DOOR_LOCKED - 5
  • DOOR_ROTATING_LOCKED - 6
  • MG42 - 7
  • BREAKABLE - 8
  • BREAKABLE_DYNAMITE - 9
  • CHAIR - 10
  • ALARM - 11
  • HEALTH - 12
  • TREASURE - 13
  • KNIFE - 14
  • LADDER - 15
  • BUTTON - 16
  • WATER - 17
  • CAUTION - 18
  • DANGER - 19
  • SECRET - 20
  • QUESTION - 21
  • EXCLAMATION - 22
  • CLIPBOARD - 23
  • WEAPON - 24
  • AMMO - 25
  • ARMOR - 26
  • POWERUP - 27
  • HOLDABLE - 28
  • INVENTORY - 29
  • SCENARIC - 30
  • EXIT - 31
  • NOEXIT - 32
  • PLYR_FRIEND - 33
  • PLYR_NEUTRAL - 34
  • PLYR_ENEMY - 35
  • PLYR_UNKNOWN - 36
  • BUILD - 37
  • DISARM - 38
  • REVIVE - 39
  • DYNAMITE - 40
  • CONSTRUCTIBLE - 41
  • UNIFORM - 42
  • LANDMINE - 43
  • TANK - 44
  • SATCHELCHARGE - 45
  • LOCKPICK - 46

Parameters: (table)

Returns: none

Example:

 hint = table();
 b.GetCursorHint(hint);

 print(hint.type); // one of the values above
 print(hint.value); // usually a health associated with certain types

GetDestroyableState

Check state of a PLANT goal.

Parameters: (entity)

Returns: 1 if the bot can destroy the entity, -1 if the entity is not destroyable or is friendly objective.

Example:

 if(b.GetDestroyableState(TargetEntity) < 1 ) { 
 }

GetExplosiveState

Check state of a dynamite, landmine or tripmine.

Note: It does not work for a poison mine and bouncing betty in Jaymod.

Parameters: (entity)

Returns: 1 if the dynamite/mine can be armed, 0 if the dynamite is ticking or the mine is activated.

Example:

 if(b.GetExplosiveState(TargetEntity) == 1 ) { 
 }

GetMG42Info

Gets information about currently mounted MG42 - vector CenterFacing and angles MinHorizontal, MaxHorizontal, MinVertical, MaxVertical.

Parameters: (table)

Returns: true if info has been stored into table


GetMountedPlayerOnMG42

Gets player who is mounting MG42.

Parameters: (mg42Entity)

Returns: player's entity or null


GetReinforceTime

Gets the current time left(in seconds) before reinforcements spawn for the bots team.

Parameters: none

Returns: seconds left till reinforcements spawn

Example:

 if(b.GetReinforceTime() < 2)
 {
     // 2 seconds to reinforcements
 }

GetSkills

Gets the current skill values and puts them into the table parameter.

Parameters: (table)

Returns: none

Example:

 skills = table();
 b.GetSkills(skills);
 print("Battle Sense:", skills[SKILL.BATTLE_SENSE]);
 print("Engineering:", skills[SKILL.ENGINEERING]);
 print("First Aid:", skills[SKILL.FIRST_AID]);
 print("Signals:", skills[SKILL.SIGNALS]);
 print("Light Weapons:", skills[SKILL.LIGHT_WEAPONS]);
 print("Heavy Weapons:", skills[SKILL.HEAVY_WEAPONS]);
 print("Coverops:", skills[SKILL.COVERTOPS]);

See Also: SKILL


GetStat

Gets a current stat from the bot by name. Valid stat names for ET are kills, deaths and xp.

Parameters: (string) the stat name

Returns: the value of the stat

Example:

 xp = b.GetStat("xp");
 print("Bot xp value is",xp);

IsMG42Repairable

Parameters: (mg42Entity)

Returns: true if mg42 is damaged and can be repaired


TeamLandminesAvailable

Parameters: none

Returns: remaining count of team landmines