Function List

AIInterface
Functions

Void  AI_ClearAllBudgetTotals( PlayerID pPlayer )
 

Clears all the resources for each budget and recalculate their values 

 

Void  AI_ClearAllBudgetWeight( PlayerID pPlayer )
 

Clears all the budget weights that have been previously added 

 

Void  AI_ClearBudgetTotal( PlayerID pPlayer, String budgetname )
 

Clear the given budget's account of all of its resources. 

Example budget names are BUDGET_Units, BUDGET_Tech, BUDGET_Addon and BUDGET_Secure Example: AI_ClearBudgetTotal( player4, "BUDGET_Tech" )

 

Void  AI_ClearBuildDemand( PlayerID pPlayer )
 

Clear the build demand table 

 

Void  AI_ClearClassPreference( PlayerID pPlayer )
 

Clear all class preferences that have been set up both class and anti-class 

 

Void  AI_ClearImportance( PlayerID pPlayer, EntityID pEntity )
 

This clears the importance override on this military point 

 

Void  AI_ClearProductionLimits( PlayerID pPlayer )
 

Clears all PBG limits that were previously set 

 

Void  AI_ClearTargetPlayer( PlayerID pPlayer )
 

Clears the attack request for this player. This player will now attack any enemies.  

 

Void  AI_DoString( PlayerID pPlayer, String s )
 

Run this string in the AI of player 

 

Void  AI_Enable( PlayerID pPlayer, Boolean enable )
 

Enables/Disables an AI player 

 

Void  AI_EnableAll( Boolean enable )
 

Enables/Disables all AI players 

 

Void  AI_EnableComponent( PlayerID pPlayer, Boolean enable, Real ct )
 

Enables/disables a component of the AI 

Components:
COMPONENT_Attacking
COMPONENT_Defending
COMPONENT_ForwardDefending
COMPONENT_Resourcing
COMPONENT_BuildUnits
COMPONENT_BuildStructures
COMPONENT_BuildResearch
COMPONENT_Securing
COMPONENT_BuildAddOns COMPONENT_Tactics

 

Void  AI_EnablePlayerOption( PlayerID pPlayer, Boolean bEnable, Real tp )
 

enables or disables an AI player option (currently options are: AIOPT_Retreat) 

 

Void  AI_ForceAttack( PlayerID pPlayer, PlayerID pPlayerTarget )
 

Tells the AI to take all of its units and forces them to attack the given player immediately 

 

Real  AI_GetDifficulty( PlayerID pPlayer )
 

Gets the difficulty level of this AI player 

Levels can be one of: AD_Easy, AD_Standard, AD_Hard, AD_Hardest

 

Boolean  AI_IsAIPlayer( PlayerID pPlayer )
 

Returns true if player is an AI player 

 

Boolean  AI_IsEnabled( PlayerID pPlayer )
 

Returns true if player is a AIPlayer and is enabled 

 

Void  AI_LockEntity( PlayerID pPlayer, EntityID pEntity )
 

Locks the entity and disables its tactics (if any) and the AI will no longer use this object 

 

Void  AI_LockSGroup( PlayerID ai_player, SGroup sgroup )
 

Lock an SGroup from the ai_player 

 

Void  AI_LockSquad( PlayerID pPlayer, SquadID pSquad )
 

Locks the squad and disables its tactics (if any) and the AI will no longer use this object 

 

Void  AI_SetAntiClassPreference( PlayerID pPlayer, String className, Real increment )
 

Offset the anticlass preference to increase the demand for certain unit anticlasses 

Classname can be: aiclass_infantry, aiclass_light_vehicle, aiclass_heavy_vehicle as defined in the AE under type_ai_class

 

Void  AI_SetBudgetWeight( PlayerID pPlayer, String budgetName, Real weight )
 

Sets the given budget to the given weight 

Example budget names are BUDGET_Units, BUDGET_Tech, BUDGET_Addon and BUDGET_Secure Example: AI_SetBudgetWeight( player4, "BUDGET_Tech", 50 )

 

Void  AI_SetBuildDemand( PlayerID pPlayer, Blueprint pbg, Real start, Real increment )
 

Sets the demand for this squadasd 

 

Void  AI_SetBuildTable( PlayerID ai_player, Table build_table )
 

Set a build order table for the ai_player 

An example build table:
local build_table =
{
 {SBP.ALLIED_RIFLEMEN, 1, 5},
 {SBP.ALLIED_TANKTHINGY, 2, 3}
}
The first number in each entry is the starting value -- the lowest number gets built first
The second number is the increment that happens each time the unit is built
NOTE: Setting build demand table clobbers the class preferences

 

Void  AI_SetClassPreference( PlayerID pPlayer, String className, Real increment )
 

Offset the class preference to increase the demand for certain unit class 

Classname can be: aiclass_infantry, aiclass_light_vehicle, aiclass_heavy_vehicle as defined in the AE under type_ai_class

 

Void  AI_SetDifficulty( PlayerID pPlayer, Real difficultyLevel )
 

Set the difficulty level of this AI player 

Levels ca be one of: AD_Easy, AD_Standard, AD_Hard, AD_Hardest

 

Void  AI_SetImportance( PlayerID pPlayer, EntityID pEntity, Real importance )
 

This overrides the default importance of the given military point 

 

Void  AI_SetProductionLimits( PlayerID pPlayer, Blueprint pbg, Real limit )
 

Sets a limit to a PBG type (buildings, squads, upgrades, etc) 

 

Void  AI_SetProductionLimitsTable( PlayerID ai_player, Table limits_table )
 

Set limits to the production items that an AI can build 

An example production limites table:
local production_limits_table =
{
 {SBP.ENGINEER_SQUAD, 2},
 {EBP.ALLIED_BARRACKS, 0}
 {UPG.ALLIED_MINESWEEPER, 0}
}
The first argument is the table is the blueprint, and second: the number of those items the AI can build

 

Void  AI_SetTargetPlayer( PlayerID pPlayer, Real playerID )
 

Tells the AI to attack only the given player. 

 

Void  AI_SetVictoryPointPercentage( PlayerID pPlayer, Real percentage )
 

Set the victory point percentage - how much should we prefer victory points over resource points? Percentage should be between 0.0 and 1.0. 1.0 means 100 percent. 0.5 means choose equally between victory points and other kinds of points. 

 

Void  AI_UnlockAll( PlayerID pPlayer )
 

 

 

Void  AI_UnlockEntity( PlayerID pPlayer, EntityID pEntity )
 

Unlocks this entity so that AI can use it again 

 

Void  AI_UnlockSGroup( PlayerID ai_player, SGroup sgroup )
 

Unlock an SGroup from the ai_player 

 

Void  AI_UnlockSquad( PlayerID pPlayer, SquadID pSquad )
 

Unlocks the given squad so the AI can use it again 

 

Void  AI_UpdateStatics( PlayerID pPlayer )
 

Re-updates the AI in regards to all the static objects in the world (if SCAR creates new strategic points dynamically this will need to be called) 

 

 

 

Balance
Functions

SGroupID  Balance_CreateSquadsAtMarkerByResource( PlayerID playerId, String squadgroupName, String squadBlueprint, Table load_out_table, String markername, Float requisition_amount, Float power_amount )
 

Creates the maximum number of squads of this loadout given the resources at a marker position and adds them to a squadgroup. The squadgroup will be created if it doesnt exist. 

Loadout will be clipped to unitMin and unitMax from the squad blueprint.

 

Void  Balance_SetInit( LuaFunction func )
 

Set the Lua Function used to initialize each Balance Tool iteration.  

The function is used to set up the forces that will battle

 

 

 

battlesim
Functions

Void  BattleSim_DumpResults( Void  )
 

write all battle simulation result 

 

Void  BattleSim_StartBattleSim( Void  )
 

start battle simulation screen.  

 

Void  BattleSim_WriteOneResult( const char *s )
 

record one sentence of battle sim result 

 

 

 

Blueprint
Functions

EntityBlueprint  BP_GetEntityBlueprint( String pbgPath )
 

Returns an entity property bag group. 

 

Real  BP_GetID( Blueprint pbg )
 

Returns an ID that uniquely identifies this pbg. NOTE: this is an arbitrary 32bit ID, and does not start from 0. 

 

MedalBlueprint  BP_GetMedalBlueprint( String pbgPath )
 

Returns a medal property bag group. 

 

String  BP_GetName( Blueprint pbg )
 

Return the path name of the group 

Example name would be "abilities\ally_mad_minute_ability"

 

Real  BP_GetPropertyBagGroupCount( Real type )
 

Return the number of property bag groups of the same type 

Example type would be PBG_Critical

 

String  BP_GetPropertyBagGroupPathName( Real type, Real id )
 

Return the path name of the group 

Example name would be "abilities\ally_mad_minute_ability"

 

SquadBlueprint  BP_GetSquadBlueprint( String pbgPath )
 

Returns a squad property bag group. 

 

Boolean  BP_IsPropertyBagGroupValid( String groupname )
 

Return whether a blueprint exists at this path 

 

Boolean  EBP_Exists( String name )
 

Returns true if an entity blueprint exists with the given name. 

 

Boolean  SBP_Exists( String name )
 

Returns true if a squad blueprint exists with the given name. 

 

 

 

Camera
Functions

Void  Camera_AutoRotate( Position target, Real distance, Real declination, Real speed )
 

Procedurally rotates the camera around a target. Camera input will be disabled. distance is in meters, declination is in degrees, speed is in degrees/sec. 

 

Void  Camera_ClampToMarker( MarkerID marker )
 

Clamps the camera's target position to a marker 

 

Void  Camera_Dump(  void )
 

Print current camera settings. 

 

Void  Camera_FocusOnPosition( Position pos, Boolean bPan )
 

Camera would move to the specified position. bPan is a boolean flag that pans the camera if set to true 

 

Void  Camera_FocusOnTargetPos( Position targetpos )
 

Focus the Camera on the specificed position 

 

Void  Camera_FollowEGroup( EGroupID egroup )
 

Set the camera to follow the first entity in an EGroup. 

The camera will follow it until the player takes control again.

 

Void  Camera_FollowEntity( EntityID entity )
 

Camera will follow specified entity 

 

Void  Camera_FollowSelection( Void  )
 

Camera would follow current selection 

 

Void  Camera_FollowSGroup( SGroupID sgroup )
 

Set the camera to follow the first squad in an SGroup. 

The camera will follow them until the player takes control again.

 

Void  Camera_FollowSquad( SquadID pSquad )
 

Camera will follow specified squad 

 

Real  Camera_GetDeclination( Void  )
 

Get the current camera declination (tilt) 

 

Real  Camera_GetOrbit( Void  )
 

Get the current camera orbit (rotation) 

 

Position  Camera_GetTargetPos( Void  )
 

Get the current target position for the camera. 

 

Real  Camera_GetTuningValue( Real tuningValue )
 

Get values: TV_SlideTargetRate, TV_SlideTargetBase, TV_SlideTargetThreshold 

 

Real  Camera_GetZoomDist( Void  )
 

Get the current zoom distance for the camera. 

 

Boolean  Camera_IsDefault( Void  )
 

Returns whether the camera distance, orbit and declination are close to default values 

 

Boolean  Camera_IsInputEnabled( Void  )
 

Returns the enabled/disabled state of the camera input. 

 

Void  Camera_LockOnEGroup( EGroupID egroup, Float declination, Float distance )
 

Locks the camera to an EGroup's position and orientation (first entity), and a fixed arbitrary declination/distance (or -1 to allow user input)  

 

Void  Camera_LockOnEntity( EntityID entity, Real declination, Real distance )
 

Locks the camera to an entity's position and orientation, and a fixed arbitrary declination/distance (or -1 to allow user input) 

 

Void  Camera_LockOnSGroup( SGroupID sgroup, Float declination, Float distance )
 

Locks the camera to an SGroup's position and orientation (first entity), and a fixed arbitrary declination/distance (or -1 to allow user input)  

 

Void  Camera_MoveToEGroup( EGroupID egroup[, Boolean pan, Float panRate] )
 

Move the camera to an EGroup's location. The optional pan flag should be true if you want the camera to glide to the new location. You can specify a pan rate to use (use SLOW_CAMERA_PANNING for a default slower rate) 

This function can be called through a CTRL object in NISlets.

 

Void  Camera_MoveToPosition( MarkerID/Pos position[, Boolean pan, Float panRate] )
 

Move the camera to desired location. The optional pan flag should be true if you want the camera to glide to the new location. You can specify a pan rate to use (use SLOW_CAMERA_PANNING for a default slower rate) 

This function canNOT be called through a CTRL object in NISlets.

 

Void  Camera_MoveToPositionIfClose( MarkerID/Pos position )
 

Slightly refocus the camera to rest on a position if it's close by. 

This function can be called through a CTRL object in NISlets.

 

Void  Camera_MoveToSGroup( SGroupID sgroup[, Boolean pan, Float panRate] )
 

Move the camera to an SGroup's location. The optional pan flag should be true if you want the camera to glide to the new location. You can specify a pan rate to use (use SLOW_CAMERA_PANNING for a default slower rate) 

This function can be called through a CTRL object in NISlets.

 

Void  Camera_ReleaseEntityLock( Void  )
 

Camera is no longer locked to an entity 

 

Void  Camera_Reload( Void  )
 

Reload all cameras' tuning values 

 

Void  Camera_ResetFocus( Void  )
 

Clears state info related to camera focus 

 

Void  Camera_ResetToDefault( Void  )
 

Reset camera position to default home position 

 

Void  Camera_SetDeclination( Real dec )
 

Set the current camera declination (tilt) 

 

Void  Camera_SetDefault( Float height, Float declination, Float angle )
 

Helper function to set the default camera parameters 

If the parameter is nil, the particular property is not modified

 

Void  Camera_SetInputEnabled( Boolean enabled )
 

Enables / Disables camera input. 

 

Void  Camera_SetOrbit( Real orbit )
 

Set the current camera orbit (rotation) 

 

Void  Camera_SetTuningValue( Real tuningValue, Real value )
 

Set values: TV_SlideTargetRate, TV_SlideTargetBase, TV_SlideTargetThreshold 

 

Void  Camera_SetZoomDist( Real distance )
 

Set the current zoom distance for the camera. 

 

Void  Camera_StopAutoRotating( Void  )
 

Stops the camera from procedurally rotating. Input is restored. 

 

Void  Camera_Unclamp( Void  )
 

Frees up the camera (so it's not clamped to a marker anymore) 

 

 

 

Command
Functions

Void  Cmd_AbandonTeamWeapon( SGroupID sgroupid[, Boolean preserveCrew, Boolean queued] )
 

Order a squad group to abandon their current team weapon if they have it and they could (tuning value in attribute editor) 

 

Void  Cmd_Ability( PlayerID/EGroupID/SGroupID user, AbilityBlueprint blueprint, [Position/SGroupID/EGroupID target, Position direction, Bool skipCostPrereq, Bool queued] )
 

Sends an ability command to a player, egroup or sgroup. extra parameters are provided if the ability requires them. 

 

Void  Cmd_AttachSquads( SGroupID sgroup, SGroupID sgroupAttachee )
 

Attach the squad from sgroupnameAttachee to sgroupname. Both SGroups must contain only one squad. 

 

Void  Cmd_Attack( SGroupID sgroup, SGroup/EGroup/Pos/Marker target[, Boolean queued, Boolean stationary, String plan] )
 

Issues an attack command to an SGroup 

 

Void  Cmd_AttackMove( SGroupID sgroup, Position targetposition[, Boolean queued, String plan, Real coverSearchRadius] )
 

Order a squad group to attack move to a position (anything whose position can be queried). can be queued, can follow a plan, can search for cover within a radius 

 

Void  Cmd_AttackMoveThenCapture( SGroupID attacker, EGroupID target, [!Boolean!queued ] )
 

Command attacker sgroup to attack move to strategic point target; when it is capturable, the sgroup would capture it 

 

Void  Cmd_CaptureTeamWeapon( SGroupID sgroupid, EGroupID targetid, [Boolean queued] )
 

Order a squad group to capture team weapon entity group. 

 

Void  Cmd_Construct( SGroup sgroupid, Entity blueprint, EGroupID/Position/Marker targetid[, Position Facing, Boolean queued] )
 

Orders a squad to contruct a building at specified position, or to continue construction on an existing building. 

The command also checks to see if a building already exists at the location, and the squad will continue building it, if it is of the correct type.

 

Void  Cmd_CriticalHit( PlayerID playerid, SGroupID/EGroupID/Squad/Entity target, CriticalID criticalid, DamageID damageid )
 

Applies critical hit to entity/squad/sgroup/egroup 

Player id doesn't have to be the owner as the applied entities but need to make sure the player is still alive

 

Void  Cmd_DetonateDemolitions( PlayerID player, EGroupID target[, Boolean queued] )
 

Detonates a building's demolitions 

 

Void  Cmd_DigIn( SGroupID sgroup, Position targetposition, Position facingposition )
 

Order a squad group to dig in the first position and facing the second position 

 

Void  Cmd_DigOut( SGroupID sgroup )
 

Order a squad group to dig out if they are already dug in 

 

Void  Cmd_DoPlan( SGroupID sgroupid, String plan[, Postion pos, Boolean!queued ] )
 

Order a squad group to execute a squad AI plan. pass in nil to execute the default plan. 

 

EntityID or SquadID id of the destination  Cmd_Garrison( SGroupID fromsgroupid, EGroupID/SGroupID togroupid, [Bool overload, Bool queued] )
 

Order a squad group to load at a random entity or squad of the group 

overload is a flag that will allow the hold entity to ignore maximum slot check

 

Void  Cmd_InstantDigIn( SGroupID sgroup )
 

Order a squad group to dig in instantly at the current position and facing 

This order should only be used in the beginning of missions since it skips all the dig in animation. Also, if any of the squad member is on terrain that doesn't allow dig in, the whole squad would refuse to instant dig in.

 

Void  Cmd_InstantDigOut( SGroupID sgroup )
 

Order a squad group to dig out instantly 

 

Void  Cmd_InstantGarrison( Void  )
 

See Cmd_Garrison. 

 

Void  Cmd_InstantReinforceUnit( SGroupID sgroup, Real count )
 

Sends a instant reinforce command to all squads in a group. count represents the number of commands to send. 

Note: This function bypasses pre-reqs, costs and the production queue

 

Void  Cmd_InstantReinforceUnitPos( SGroupID sgroup, Real count, MarkerID/Pos spawnlocation[, Real checktype[, Real failtype]] )
 

Sends a instant reinforce command to all squads in a group. count represents the number of commands to send. spawnlocation is where the reinforced unit will spawn. You can optionally find a hidden position by specifying a checktype (CHECK_OFFCAMERA, CHECK_IN_FOW or CHECK_BOTH), and what to do if a hidden position can't be found (SPAWN_ATMARKER, SPAWN_ATSQUAD, or DO_NOTHING) - SPAWN_ATMARKER is the default. 

Note: This function bypasses pre-reqs and costs and the production queue

 

Void  Cmd_InstantSetupTeamWeapon( SGroupID sgroupid, [Boolean queued] )
 

Order a squad group to instant setup their team weapon 

 

Void  Cmd_InstantUpgrade( PlayerID/EGroupID/SGroupID target, UpgradeBlueprint/Table blueprint[, Real count] )
 

Sends an instant upgrade command to a player, egroup or sgroup. accepts a single upgrade or table of upgrades. 

 

Void  Cmd_Move( SGroupID sgroup, Pos/SGroupID/EGroupID/MarkerID position, [Boolean queued, MarkerID deleteWhenNearMarker, Position facing, Real offset, Real distance, Real coverSearchRadius] )
 

Move a squad group to a given position. 

Supports facing, 'offset' movement, and can find cover. The sgroup can be deleted when in proximity of a marker (it assumes a proximity of 5 if you forget to set one on the marker)

 

Void  Cmd_MoveAwayFromPos( SGroupID sgroup, Pos position, Int radius, [Boolean queued] )
 

Move a squad group out of a position to a certain radius 

All squads in the group will move away from the centre position from its current position

 

markerID  Cmd_MoveToClosestMarker( SGroupID sgroup, Table markertable )
 

Moves a squad group to the closest marker in a list/table of MarkerIDs. 

 

Void  Cmd_MoveToThenCapture( SGroupID attacker, EGroupID target, [!Boolean!queued ] )
 

Command attacker sgroup to attack move to strategic point target; when it is capturable, the sgroup would capture it 

 

Void  Cmd_ReinforceUnit( SGroupID sgroup, Real count )
 

Sends a reinforce command to all squads in a group. count represents the number of commands to send. 

Note: To reinforce squad bypassing the pre-reqs and costs use Cmd_InstantReinforceUnit.

 

Void  Cmd_ReinforceUnitPos( SGroupID sgroup, Real count, MarkerID/Pos spawnlocation[, Real checktype[, Real failtype]] )
 

Sends a reinforce command to all squads in a group. count represents the number of commands to send. spawnlocation is where the reinforced unit will spawn. You can optionally find a hidden position by specifying a checktype (CHECK_OFFCAMERA, CHECK_IN_FOW or CHECK_BOTH), and what to do if a hidden position can't be found (SPAWN_ATMARKER, SPAWN_ATSQUAD, or DO_NOTHING) - SPAWN_ATMARKER is the default. 

To reinforce squads bypassing the pre-reqs and costs use Cmd_InstantReinforceUnit

 

Void  Cmd_Retreat( SGroupID sgroup[, Position location, MarkerID deleteWhenNearMarker, Boolean queued] )
 

Order a squad group to retreat, optionally to a specific location. The sgroup can be deleted when in proximity of a marker (it assumes a proximity of 5 if you forget to set one on the marker) 

 

Void  Cmd_RevertOccupiedBuilding( SGroupID sgroupid, EGroupID targetid, [Boolean queued] )
 

Order a squad group to revert occupied building 

 

Void  Cmd_SetDemolitions( SGroupID sgroupid, EGroupID targetid[, Boolean skipCostPrereq, Boolean queued] )
 

Orders a squad group to place demolition charges on a building (egroup). Function does nothing if egroup cannot be detonated, or player can't afford the demolitions 

 

Void  Cmd_SquadCamouflageStance( SGroupID sgroup, CamouflageStanceID stanceid )
 

Sends an camouflage stance command to all squads in a group. stanceid should be the number returned by Util_GetCamouflageStanceID( stancename ) 

 

Void  Cmd_SquadPath( SGroupID sgroup, String pathName, Boolean bFromClosest, Real loop, Boolean bAttackMove, Float pauseTime[, MarkerID deleteWhenNearMarker, Boolean queued, Boolean bMoveForward] )
 

Send a command to the squad to follow a path. Can wait at each waypoint. The sgroup can be deleted when in proximity of a marker if you pass in the marker as the 7th argument (it assumes a proximity of 5 if you forget to set one on the marker) 

loop can be: LOOP_NONE, LOOP_NORMAL, LOOP_TOGGLE_DIRECTION

 

Void  Cmd_SquadPatrolMarker( SGroupID sgroup, MarkerID marker )
 

Causes a squad to patrol a marker attacking any enemies that come within its radius. If used on circular markers, the radius must be at least 5. To stop the squad from patrolling the marker, use Cmd_Stop. 

 

Void  Cmd_Stop( EGroupID/SGroupID group )
 

Sends a stop command to egroup or sgroup. 

 

Void  Cmd_Surrender( SGroup!sgroupid [, Real actionpoints, Position exitpos] )
 

Orders a squad to surrender and awards the local player with an appropriate number of action points 

The command will also overwrite the exit position as well, if you do not want the squads to exit at the map entry point.

 

Void  Cmd_Ungarrison( EGroupID/SGroupID fromgroupid[, Position destination, Boolean queued] )
 

Orders an EGroup or SGroup to kick out its occupants. If no position is specified, the occupants stay at the exit. 

 

Void  Cmd_UngarrisonSquad( SGroupID sgroupid[, Position destination, Boolean queued] )
 

Orders an sgroup to exit the building or vehicle that it's in. If no position is specified, the sgroup stays at the exit. 

 

Void  Cmd_Upgrade( PlayerID/EGroupID/SGroupID user, UpgradeBlueprint/Table blueprint[, Real count] )
 

Sends an upgrade command to a player, egroup or sgroup. accepts a single upgrade or table of upgrades. 

 

Void  Command_Entity( PlayerID player, EGroupID egroup, Real entityCommand )
 

Send a entity command to a entity group(CMD_DefaultAction, CMD_Stop, CMD_Destroy, CMD_BuildSquad, CMD_CancelProduction, CMD_RallyPoint, CMD_AttackForced) 

Entity commands are mostly used for buildings etc. If you need to issue commands to units, use the Squad_Command function.

 

Void  Command_EntityAbility( PlayerID player, EGroupID egroup, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send an entity ability command (CMD_Ability) to an entity 

 

Void  Command_EntityEntity( PlayerID player, EGroupID egroup, Real entityCommand, EGroupID target )
 

Send a entity-based command to an entity group. 

Use this function to issue orders that require a entity to an entity group (eg. order a building to attack another building)
See Command_Entity for a list of all the possible entityCommands.

 

Void  Command_EntityExt( PlayerID player, EGroupID egroup, Real entityCommand, Real cmdparam, Boolean queued )
 

Send a squad command to a squad group with custom data 

 

Void  Command_EntityPos( PlayerID player, EGroupID egroup, Real entityCommand, Position target )
 

Send a position command to an entity group. 

Use this function to issue orders that require a position to an entity group (eg. set a rally point for a building)
See Command_Entity for a list of all the possible entityCommands.

 

Void  Command_EntityPosAbility( PlayerID player, EGroupID egroup, Position pos, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a positional ability command (CMD_Ability) to an entity 

Use this function to issue ability orders that require a position to player

 

Void  Command_EntityPosDirAbility( PlayerID player, EGroupID egroup, Position pos, Position dir, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a positional/directional ability command (CMD_Ability) to an entity 

Use this function to issue ability orders that require a position and a direction to player

 

Void  Command_EntityPosSquad( PlayerID player, EGroupID egroup, Real entityCommand, Position target, SGroupID sgroup )
 

Send a dual target (position and squad) command to an entity group. 

Use this function to issue orders that require a position and a squad to an entity group (eg. unloading squad from hold)
See Command_Entity for a list of all the possible entityCommands.

 

Void  Command_EntitySquad( PlayerID player, EGroupID egroup, Real entityCommand, SGroupID target )
 

Send a squad-based command to an entity group. 

Use this function to issue orders that require a squad to an entity group (eg. order a building to attack a squad)
See Command_Entity for a list of all the possible entityCommands.

 

Void  Command_EntityUpgrade( PlayerID player, EGroupID egroup, UpgradeBlueprint upgrade, Boolean instant, Boolean queued )
 

Send a squad command to a entity group with custom data 

 

Void  Command_Player( PlayerID player, PlayerID dest, Real playerCommand )
 

Send a player command to a player 

PCMD_Ability

 

Void  Command_PlayerAbility( PlayerID player, PlayerID dest, AbilityBlueprint abilityPBG, Boolean skipCostPrereq )
 

Send a player ability command (PCMD_Ability) to a player 

 

Void  Command_PlayerEntity( PlayerID player, PlayerID dest, Real playerCommand, EGroupID target )
 

Send an entity command to a player. 

 

Void  Command_PlayerEntityCriticalHit( PlayerID player, EGroupID egroup, Real playerCommand, CriticalBlueprint criticalPBG, Boolean queued, DamageBlueprint damagePBG )
 

Send a player command to itself to act upon single with custom parameter and index data (PCMD_CriticalHit) 

This is a special command for SCAR and debug feature

 

Void  Command_PlayerExt( PlayerID player, PlayerID dest, Real playerCommand, Real cmdparam, Boolean queued )
 

Send a player command to a player with a custom flag 

 

Void  Command_PlayerPos( PlayerID player, PlayerID dest, Real playerCommand, Position pos )
 

Send a position command to a player. 

Use this function to issue orders that require a position to player)
See Command_Player for a list of all the possible playerCommands.

 

Void  Command_PlayerPosAbility( PlayerID player, PlayerID dest, Position pos, AbilityBlueprint abilityPBG, Boolean skipCostPrereq )
 

Send a positional ability command (PCMD_Ability) to a player 

Use this function to issue ability orders that require a position to player

 

Void  Command_PlayerPosDirAbility( PlayerID player, PlayerID dest, Position pos, Position dir, AbilityBlueprint abilityPBG, Boolean skipCostPrereq )
 

Send a positional/directional ability command (PCMD_Ability) to a player 

Use this function to issue ability orders that require a position and a direction to player

 

Void  Command_PlayerPosExt( PlayerID player, PlayerID dest, Real playerCommand, Position pos, Real cmdparam, Boolean queued )
 

Send a position command to a player with extra info 

Use this function to issue orders that require a position to player
See Command_Player for a list of all the possible playerCommands.

 

Void  Command_PlayerSquadConstructBuilding( PlayerID player, SGroupID sgroup, EntityBlueprint ebp, Position position, Position facing, Boolean queued )
 

Send a player command to itself to order squads in the sgroup to construct the building at specific position and facing 

structureBlueprint must be a valid building that can be constructed by the sgroup. This building would cost nothing and does not effect population and availability This is a special command for SCAR use

 

Void  Command_PlayerSquadConstructFence( PlayerID player, SGroupID sgroup, EntityBlueprint ebp, Position posStart, Position posEnd, Boolean queued )
 

Send a player command to itself to order squads in the sgroup to construct fences from posStart to posEnd 

structureBlueprint must be a valid building that can be constructed by the sgroup. This building would cost nothing and does not effect population and availability This is a special command for SCAR use

 

Void  Command_PlayerSquadConstructField( PlayerID player, SGroupID sgroup, EntityBlueprint ebp, Position posStart, Position posEnd, Boolean queued )
 

Send a player command to itself to order squads in the sgroup to construct a field ranging from posStart to posEnd 

structureBlueprint must be a valid building that can be constructed by the sgroup. This building would cost nothing and does not effect population and availability This is a special command for SCAR use

 

Void  Command_PlayerSquadCriticalHit( PlayerID player, SGroupID sgroup, Real playerCommand, CriticalBlueprint criticalPBG, Boolean queued, DamageBlueprint damagePBG )
 

Send a player command to itself to act upon all entities in the sgroup with custom parameter and index data (PCMD_CriticalHit) 

This is a special command for SCAR & debug use

 

Void  Command_PlayerUpgrade( PlayerID player, UpgradeBlueprint upgrade, Boolean instant, Boolean queued )
 

Sends an upgrade command to a player 

 

Void  Command_Squad( PlayerID player, SGroupID sgroup, Real squadCommand, Boolean queued )
 

Send a squad command to a squad group 

SCMD_DefaultAction, SCMD_Move, SCMD_Stop, SCMD_Destroy, SCMD_BuildStructure, SCMD_Capture, SCMD_Attack, SCMD_ReinforceUnit, SCMD_Upgrade, SCMD_CancelProduction SCMD_AttackMove, SCMD_Ability, SCMD_Attach, SCMD_Detach SCMD_Load,SCMD_UnloadSquads, SCMD_DoPlan SCMD_SlotItemRemove, SCMD_InstantReinforceUnit, SCMD_InstantUpgrade

 

Void  Command_SquadAbility( PlayerID player, SGroupID sgroup, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a ability command (SCMD_Ability) to a squad 

 

Void  Command_SquadAttackMovePos( PlayerID player, SGroupID sgroup, Real squadCommand, Position target, String planName, Boolean queued )
 

Send a position ATTACK MOVE command to a squad group with custom data 

 

Void  Command_SquadDoCustomPlan( PlayerID player, SGroupID sgroup, String planFile, Boolean queued )
 

Send a custom squad AI plan command to the squad to execute the plan specified towards the position 

 

Void  Command_SquadDoCustomPlanTarget( PlayerID player, SGroupID sgroup, Position pos, String planFile, Boolean queued )
 

Send a custom squad AI plan command to the squad to execute the plan specified towards the position 

 

Void  Command_SquadEntity( PlayerID player, SGroupID sgroup, Real squadCommand, EGroupID target, Boolean queued )
 

Send an entity command to a squad group. 

Use this function to isssue an entity-based command to a squad group.
See Command_Squad for a list of all the possible squadCommands

 

Void  Command_SquadEntityAbility( PlayerID player, SGroupID sgroup, EGroupID target, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a entity ability command (SCMD_Ability) to a squad 

 

Void  Command_SquadEntityAttack( PlayerID player, SGroupID sgroup, EGroupID target, Boolean bCheckFOW, Boolean bStationary, String planName, Boolean queued )
 

Send an entity command ATTACK to a squad group. 

Use this function to issue an entity-based command to a squad group with custom FOW check flag. (eg. order a squad to attack a building)
planName is the name of the custom plan file to execute. Pass in empty string to use the default
stationary flag uses SCMD_StationaryAttack instead where plan file is ignored and squad does not pursue its target See Command_Squad for a list of all the possible squadCommands

 

Void  Command_SquadEntityBool( PlayerID player, SGroupID sgroup, Real squadCommand, EGroupID target, Boolean cmdparam, Boolean queued )
 

Send a entity command to a squad group with custom BOOLEAN data 

 

Void  Command_SquadEntityExt( PlayerID player, SGroupID sgroup, Real squadCommand, EGroupID target, Real cmdparam, Boolean queued )
 

Send a entity command to a squad group with custom data 

 

Void  Command_SquadEntityLoad( PlayerID player, SGroupID sgroup, Real squadCommand, EGroupID target, Boolean bOverLoad, Boolean queued )
 

Send special squad command to a squad group with squad load parameters 

This is a special command for loading squads into building (entity) holds (SCMD_Load, SCMD_InstantLoad)

 

Void  Command_SquadExt( PlayerID player, SGroupID sgroup, Real squadCommand, Real cmdparam, Boolean queued )
 

Send a squad command to a squad group with custom data 

 

Void  Command_SquadPos( PlayerID player, SGroupID sgroup, Real squadCommand, Position target, Boolean queued )
 

Send a position command to a squad group. 

Use this function to issue orders that require a position to a squad group (eg. order a squad to move to position, or attack position)
See Command_Squad for a list of all the possible squadCommands.

 

Void  Command_SquadPosAbility( PlayerID player, SGroupID sgroup, Position pos, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a positional ability command (SCMD_Ability) to a squad 

 

Void  Command_SquadPosExt( PlayerID player, SGroupID sgroup, Real squadCommand, Position target, Real cmdparam, Boolean queued )
 

Send a position command to a squad group with custom data 

 

Void  Command_SquadPosFacing( PlayerID player, SGroupID sgroup, Real squadCommand, Position target, Position facing, Boolean queued )
 

Send a move-facing command to a squad group 

 

Void  Command_SquadPositionAttack( PlayerID player, SGroupID sgroup, Position target, Boolean bCheckFOW, Boolean bStationary, String planName, Boolean queued )
 

Send an position command ATTACK to a squad group. 

Use this function to issue an position-based command to a squad group with custom FOW check flag. (eg. order a squad to attack a building)
planName is the name of the custom plan file to execute. Pass in empty string to use the default
stationary flag uses SCMD_StationaryAttack instead where plan file is ignored and squad does not pursue its target See Command_Squad for a list of all the possible squadCommands

 

Void  Command_SquadPosPos( PlayerID player, SGroupID sgroup, Real squadCommand, Position target, Position target2 )
 

Send a command to a squad group with 2 positional input 

Use this function to issue orders that require a position to a squad group and additional data (eg. order a squad to dig in with facing)
See Command_Squad for a list of all the possible squadCommands.

 

Void  Command_SquadSquad( PlayerID player, SGroupID sgroup, Real squadCommand, SGroupID target, Boolean queued )
 

Send an squad-based command to a squad group. 

Use this function to issue a squad-based command to a squad group.
See Command_Squad for a list of all the possible squadCommands

 

Void  Command_SquadSquadAbility( PlayerID player, SGroupID sgroup, SGroupID target, AbilityBlueprint abilityPBG, Boolean skipCostPrereq, Boolean queued )
 

Send a squad ability command (SCMD_Ability) to a squad 

 

Void  Command_SquadSquadAttack( PlayerID player, SGroupID sgroup, SGroupID target, Boolean bCheckFOW, Boolean bStationary, String planName, Boolean queued )
 

Send an squad-based command to a squad group. 

Use this function to issue a squad-based command to a squad group with special boolean flag. (eg. order a squad to attack another squad)
If bCheckFOW is set to false, the squad would be able to attack other squads hidden in FOW
planName is the name of the custom plan file to execute. Pass in empty string to use the default
stationary flag uses SCMD_StationaryAttack instead where plan file is ignored and squad does not pursue its target See Command_Squad for a list of all the possible squadCommands

 

Void  Command_SquadSquadExt( PlayerID player, SGroupID sgroup, Real squadCommand, SGroupID target, Real cmdparam, Boolean queued )
 

Send a squad command to a squad group with custom data 

 

Void  Command_SquadSquadLoad( PlayerID player, SGroupID sgroup, Real squadCommand, SGroupID target, Boolean bOverLoad, Boolean queued )
 

Send special squad command to a squad group with squad load parameters 

This is a special command for loading squads into vehicle (squad) holds (SCMD_Load, SCMD_InstantLoad)

 

Void  Command_SquadUpgrade( PlayerID player, SGroupID sgroup, UpgradeBlueprint upgrade, Boolean instant, Boolean queued )
 

Sends an upgrade command to a squad group. 

 

 

 

Core
Functions

Void  Event_Delay( Real seconds )
 

Pauses for a given amount of time. This function MUST be called from a CTRL object in NISlet events only! 

See Event_Start for more information on NISlet events.

 

Boolean  Event_IsRunning( LuaFunction f )
 

Returns true if a given event is running 

 

Void  Event_Skip( Void  )
 

Completes execution of the event immediatley (all calls to Wait() are ignored) 

 

Void  Event_Start( LuaFunction eventFunction, Real priority )
 

Starts event. Event will not start until all rules are evaluated for this frame! 

We allow saving events in multiplayer so please don't put any non-UI events in multiplayer Running events are not saved at all.

 

Void  Event_StartEx( LuaFunction eventFunction, Real priority, LuaFunction onComplete )
 

Starts an event the same way as Event_Start, but calls a user defined function when the event is over 

 

String  Misc_GetScarFullFilename( Void  )
 

Returns the full path name to the main SCAR script 

 

Void  Scar_AddInit( LuaFunction f )
 

Register an init function with the scar system. 

This init function will be called when scar is started up.
**Important: Make sure you do not register two functions with the same name; the init function names should be unique.

 

Boolean  Scar_InitExists( LuaFunction f )
 

Returns true if an init function exists 

 

Void  Scar_RemoveInit( LuaFunction f )
 

Unregister an init function that was registered from Scar_AddInit 

 

Void  TimeRule_Add( LuaFunction f, Real priority )
 

Add a rule to be executed every frame 

 

Void  TimeRule_AddInterval( LuaFunction f, Real interval, Real priority )
 

Add a rule to be executed at every 'interval' seconds 

 

Void  TimeRule_AddIntervalEx( LuaFunction f, Real delay, Real interval, Real calls, Real priority )
 

Add a rule to be executed 'calls' times, at every 'interval' seconds 

 

Void  TimeRule_AddOneShot( LuaFunction f, Real interval, Real priority )
 

Add a rule to be executed once, after 'interval' seconds 

 

Void  TimeRule_ChangeInterval( LuaFunction f, Real interval )
 

Change 'interval' seconds of an existing rule 

 

Boolean  TimeRule_Exists( LuaFunction f )
 

Test if a rule is currently active 

 

Void  TimeRule_Remove( LuaFunction f )
 

Remove a currently active rule 

 

Void  TimeRule_RemoveAll( Real maxpriority )
 

Kills all rules. 

 

Void  TimeRule_RemoveMe( Void  )
 

Remove a currently executing rule (only works inside a rule function) 

 

Void  TimeRule_Replace( LuaFunction oldf, LuaFunction newf )
 
 

 

 

DesignerLib
Functions

Void  ATGun_AddGroup( SGroupID/EGroupID group, PlayerID player[, Table facingdirections, Real currentfacing, Real reinforcecount, EGroupID/SGroupID/MarkerID/Pos reinforcespawnlocation], Boolean threatarrow )
 

Add a gun to the gun manager. The manager will take care of turning it around to attack units, and optionally reinforcing it if the crew is killed. 

If you pass in an EGroup, it will automatically find or create a corresponding SGroup with sg_ instead of the eg_ prefix.

Void  ATGun_RemoveDirections( SGroupID/EGroupID/SyncWeaponID gun )
 

Remove's the direction settings for a gun, turning it into a fire-at-anything type.  

Use this if you are relocating a gun. Also removes any special first-trigger speech if you have any hooked up, as it may no longer be suitable if you're moving it.

Void  ATGun_RemoveGroup( SGroupID/EGroupID/SyncWeaponID gun )
 

Remove a gun from the gun manager. 

Void  AutoCharge_AddSGroup( SGroupID sgroup, MarkerID/Position/EGroupID triggerarea[, Real triggerrange, LuaFunction onTrigger] )
 

Sets an sgroup to charge a position when the player steps into the trigger zone 

 

Void  AutoCharge_RemoveAll( )
 

Stops monitoring all squads from the auto-charge functions 

 

Void  AutoCharge_RemoveSGroup( SGroupID sgroup )
 

Removes a squad from being monitored by the auto-charge functions 

 

Void  AutoCinematic( Boolean in/out, Real seconds )
 

Toggles all cinematic related settings. true = go to cinematic, false = go back to normal 

 

Void  AutoReinforce_RemoveAll( )
 

Stops monitoring all squads from the auto-reinforce functions 

 

Void  AutoReinforce_RemoveSGroup( SGroupID sgroup )
 

Removes an SGroup from the auto-reinforce functions 

 

Void  AutoRetreat_AddSGroup( SGroupID sgroup, MarkerID/Position/EGroupID destination[, Real threshold, LuaFunction onTrigger] )
 

Sets an sgroup to retreat to the given destination or building once pinned for a certain duration, or reduced to a third of it's original size 

The optional threshold value should be a percentage (between 0.0 and 1.0) - when the member count drops below this, they retreat

 

Void  AutoRetreat_RemoveAll( )
 

Stops monitoring all squads from the auto-retreat functions 

 

Void  AutoRetreat_RemoveSGroup( SGroupID sgroup )
 

Removes a squad from being monitored by the auto-retreat functions 

 

Void  AutoTerritory_AddEGroup( EGroupID egroup[, EGroupID egroup2, EGroupID egroup3...] )
 

Adds a territory to the automanager. You specify the territory by passing in an EGroup containing the flag. 

 

Void  AutoTerritory_RemoveAll( )
 

Removes all territories from the automanager and shuts the system down. 

 

Void  AutoTerritory_RemoveEGroup( EGroupID egroup[, EGroupID egroup2, EGroupID egroup3...] )
 

Removes a territory from the automanager. You specify the territory by passing in an EGroup containing the flag. 

 

Void  BridgeTerritory_Add( EGroupID bridge_egroup, EGroupID bridgepoint, EGroupID bank1point, EGroupID bank2point )
 

Add a bridge to the Bridge Territory Manager.  

bridgepoint, bank1point and bank2point should be egroups each containing one territory flag

Void  Ceasefire_AddSGroup( SGroupID sgroup[, LuaFunction function] )
 

Stops an SGroup from auto-targetting, until one of their members is explicity given an attack order or Ceasefire_RemoveSGroup() is called (at which point they all start firing again) 

You can optionally specify a function that will be called when the ceasefire is broken by the game (rather than by calling Ceasefire_RemoveSGroup)

 

Void  Ceasefire_RemoveSGroup( SGroupID sgroup )
 

Removes the ceasefire effect from an sgroup. This may already have been removed by issuing an attack order directly to the group. 

 

Void  Game_DefaultGameRestore( )
 

Restores various aspects of the single player game after loading a mission from a save game 

 

Void  Resources_Disable( )
 

Disables any resource income - useful to stop resources accruing during the opening movie 

 

Void  Resources_Enable( )
 

Re-enables resource income.  

 

Void  ShootTheSky_AddSyncWeapon( SyncWeaponID syncweapon, PlayerID player )
 

Forces a sync weapon to shoot at the sky, so long as it's manned by a given player. 

 

Void  ShootTheSky_RemoveAll( )
 

Stops all sync weapons from going through their "shooting at the sky" routine. 

 

Void  ShootTheSky_RemoveSyncWeapon( SyncWeaponID syncweapon )
 

Removes a sync weapon from the "shoot at the sky" system. It can then target people again. 

 

Void  SmokeEntrance_Do( MarkerID marker )
 

Triggers smoke to come in from the map edge, at the position and direction of the given marker 

 

Item/Table  Table_GetRandomItem( Table table[, Real numberofitems] )
 

Returns a random item from a table. You can return multiple items (without duplicates) by passing in an optional number parameter. 

 

Void  Util_AI_Setup( playerID Player, table CapLimits, playerID Target, int AI_difficulty, int ProdTemplate, int Aggression, int Preference, int Counter )
 

Utility wrapper to setup the AI. Visit Scardoc to read the extended description. 


An example use:
Util_AI_Setup(player5, 10, player1, 1, 6, 5, 2, 3)
player5 = the AI player
10 = the popcap override value
player1 = the main target for the AI
1 = the difficulty setting
6 = the AI production template table entry
5 = the aggression setting, 1-5, 5 is the most aggressive
2 = the unit preference, 1-5, 1 is infantry heavy, 5 is vehicle heavy
3 = the counter preference, 1-5, 1 is anti-infantry, 5 is anti-vehicle

 

Void  Util_SpawnRaft( PlayerID player, EGroupID eg_raft, SGroupID sgroup, SquadBlueprint/Table sbp, Positon spawn, Position land, [Real numsquads, Real loadout] )
 

Spawns a raft that will travel from the spawn location to a specified landing location. 

Note: the raft does not know the difference between land and water and will travel over all of it.

 

 

 

EGroup
Functions

Void  EGroup_Add( EGroupID group, EntityID entity )
 

Adds an entity to the end of a group if the group doesnt already have it. 

 

Void  EGroup_AddEGroup( EGroupID group, EGroupID grouptoadd )
 

Appends the entities in one group to another group.  

All entities from 'grouptoadd' will be added to 'group'.
If 'group' already contains an entity from 'grouptoadd' it will not be added.
This function does not clear the contents of 'grouptoadd'.
Example: Add group2 (0, 10, 11, 22) to group1 (1, 11, 20) --> group1 would now be (1, 11, 20, 0, 10, 22)

 

Boolean  EGroup_CanSeeEGroup( EGroupID egroup, EGroupID targetegroup, Boolean all )
 

Returns true if ALL or ANY entities in a group can see ALL or ANY entities in a given egroup. 

 

Boolean  EGroup_CanSeeSGroup( EGroupID egroup, SGroupID targetsgroup, Boolean all )
 

Returns true if ALL or ANY entities in a group can see ALL or ANY squads in a given sgroup. 

 

Void  EGroup_Clear( EGroupID egroup )
 

Removes all entities from a group 

 

Boolean  EGroup_Compare( EGroupID group1, EGroupID group2 )
 

Returns true if the contents of the two groups are equal. Order of the entities does not matter. 

 

Boolean  EGroup_ContainsBlueprints( EGroupID egroup, BP/Table blueprint, Boolean all )
 

Check if a group contains ALL or ANY of the blueprints. 

 

Boolean  EGroup_ContainsEGroup( EGroupID egroup1, EGroupID egroup2, Boolean all )
 

Returns true if EGroup1 contains ANY or ALL of EGroup2 

 

Boolean  EGroup_ContainsEntity( EGroupID egroup, EntityID entity )
 

Returns true if EGroup contains a particular EntityID 

 

Real  EGroup_Count( EGroupID egroup )
 

Returns the total number of spawned and despawned entities in a group. 

 

int  EGroup_CountAlive( EGroupID egroup )
 

Get the number of alive entities (both spawned and despawned) 

 

Real  EGroup_CountDeSpawned( EGroupID egroup )
 

Returns the number of despawned entities in a group. 

 

Real  EGroup_CountSpawned( EGroupID egroup )
 

Returns the number of spawned entities in a group. 

 

EGroupID  EGroup_Create( String name )
 

Returns a new entity group with the given name. 

Entity groups are used for buildings and objects such as rocks and trees.
If you need to issue orders to a group vehicles or units you must use a SquadGroupObs.

 

EGroupID  EGroup_CreateIfNotFound( String egroupname )
 

Find a entity group from name. Creates a new one with given name if it doesnt exist. 

 

Void  EGroup_CreateKickerMessage( EGroupID group, LocString textid )
 

Create and display kicker message on the each entity in the egroup to the player

 

Void  EGroup_DeSpawn( EGroupID egroup )
 

Despawn all spawned entities in a group. 

 

Void  EGroup_Destroy( EGroupID egroup )
 

Manually destroy a group that you dont need anymore. 

 

Void  EGroup_DestroyAllEntities( EGroupID egroup )
 

Destroys all spawned and despawned entities in a group. 

Be careful not to confuse this with EGroup_Destroy which destroys the group and NOT the items it contains. This function will destroy spawned and despawned items in a group

 

Void  EGroup_Duplicate( EGroupID egroupid1, EGroupID egroupid2 )
 

Duplicates an EGroup 

Creates a copy of egroup1 in egroup2. The function will clear egroup2 beforehand if necessary.

 

Void  EGroup_EnableMinimapIndicator( EGroupID egroup, Boolean enable )
 

Enables or disables the minimap indicator for all entities in a group 

 

Boolean  EGroup_Exists( String name )
 

Returns true if the entity group with the given name exists 

 

Void  EGroup_Filter( EGroupID egroup, String/ID/Table blueprint, Real filtertype )
 

Filters an EGroup by blueprint. 

Blueprints can be provided by name or by ID, and in a table if you want to filter on more than one type. Setting filtertype to FILTER_KEEP results in the group only containing entities of the types listed in the blueprint table. Setting filtertype to FILTER_REMOVE will strip those same entities out and leave those that aren't of the types listed.

 

Void  EGroup_FilterUnderConstruction( EGroupID egroup, Real filtertype )
 

Filters an EGroup by construction status. 

Setting filtertype to FILTER_KEEP results in the group only containing those entities that are in the process of being built. Setting filtertype to FILTER_REMOVE will strip those same entities out and leave those that are complete.

 

Boolean  EGroup_ForEach( EGroupID egroup, LuaBinding::StackVarFunction f )
 

Call a lua function for each item in a group. Function will recieve (groupid, itemindex, itemid) and should return true to break or false to continue. 

function Rule_Test( )
 local DespawnEntity = function( egroupid, itemindex, entityID )
  Entity_Despawn( entityID )
 end

 EGroup_ForEach( EGroup_FromName("eg_PlayersHQ"), DespawnEntity )
end
Note: This function iterates over SPAWNED ENTITIES ONLY.

 

Boolean  EGroup_ForEachAllOrAny( EGroupID egroup, Boolean all, LuaBinding::StackVarFunction f )
 

Call a lua function for each item in a group. Function will recieve (groupid, itemindex, itemid) and should return a bool. 

Only use this to TEST conditions on entities. DO NOT use this to perform operations on all entities, since it may not call your function on all entities (due to short circuit evaluation). This is used for checking if ALL or ANY items in a group match a given predicate. (eg. Are all items in a group choas marines)
Note: This function iterates over SPAWNED ENTITIES ONLY.

 

Boolean  EGroup_ForEachAllOrAnyEx( EGroupID egroup, Boolean all, LuaBinding::StackVarFunction f, Boolean spawned, Boolean despawned )
 

Same as EGroup_ForEachAllOrAny except you have a choice to iterate over spawned entities, despawned entities, or both. 

 

Boolean  EGroup_ForEachEx( EGroupID egroup, LuaBinding::StackVarFunction f, Boolean spawned, Boolean despawned )
 

Same as EGroup_ForEach except you have a choice to iterate over spawned entities, despawned entities, or both. 

 

EGroupID  EGroup_FromName( String name )
 

Find an entity group with a given name. 

 

Real  EGroup_GetAvgHealth( EGroupID egroup )
 

Returns the average health of all units in a entity group. 

This uses the "proper" measure of health for panel buildings, so should accurately reflect what the user sees.

 

EntityID  EGroup_GetDeSpawnedEntityAt( EGroupID group, Real index )
 

Returns the despawned entity at the given index. 

Use EGroup_GetSpawnedEntityAt if you want the spawned items in the group
Use index 1 to get the first entity in the group.
It is an error if index > EGroup_GetCountDeSpawned()

 

Boolean  EGroup_GetInvulnerable( EGroupID egroup, Boolean all )
 

Check invulnerablity state for ALL or ANY entity in an entity group. 

Set all param to true to check for ALL or set to false to check for ANY.

 

Void  EGroup_GetLastAttacker( EGroup EGroupVictim, SGroup SGroupAttacker )
 

Gets the last attacker(s) for all the entities in an EGroup Gets the last attacker for all the squads in an SGroup and stores that in SGroupAttacker 

 

String  EGroup_GetName( EGroupID egroup )
 

Returns the name of a given entity group. 

 

Real  EGroup_GetNumCombatSlots( EGroupID egroup, String holdTypeName )
 

Returns the number of combat slots in total of a certain hold-able type  

 

Position  EGroup_GetOffsetPosition( EGroupID egroup, Real offset, Real value )
 

Returns a position (a certain distance away) relative to an entity's current position/orientation. see LuaConsts.scar for explanation of 'offset' parameter 

 

Position  EGroup_GetPosition( EGroupID group )
 

Returns the center position of an entity group. 

 

EntityID  EGroup_GetRandomSpawnedEntity( EGroup egroupid )
 

Get a random spawned entity from egroup 

 

Table  EGroup_GetSequence( String name )
 

Builds a table of EGroupIDs that are named in a sequence. i.e. a name of "eg_building" will find groups "eg_building1", "eg_building2" and so on, up until it looks for a group that isn't there. 

 

EntityID  EGroup_GetSpawnedEntityAt( EGroupID group, Real index )
 

Returns the spawned entity at the given index. 

Use EGroup_GetDeSpawnedEntityAt if you want the despawned items in the group
Use index 1 to get the first entity in the group.
It is an error if index > EGroup_GetCountSpawned()

 

Real  EGroup_GetSpread( EGroupID egroup )
 

Returns the distance from the centre of the group of the entity that furthest out.  

 

Void  EGroup_GetSquadsHeld( EGroupID egroup, SGroupID sgroupRecipient )
 

Returns an sgroup containing all squads held by any entities in an egroup 

 

Boolean  EGroup_HasUpgrade( EGroupID egroup, UpgradeID upgrade, Boolean all )
 

Returns whether ANY or ALL entities in an EGroup have the specified upgrade 

 

Void  EGroup_Hide( EGroupID egroup, Bool hide )
 

Hide or show all entities in an EGroup 

Bool should be true to hide, false to show

 

Void  EGroup_InstantCaptureStrategicPoint( EGroupID egroup, PlayerID player )
 

Change the ownership of a Strategic Point 

 

Void  EGroup_InstantRevertOccupiedBuilding( EGroupID egroup )
 

Reverts an occupied building 

 

Void  EGroup_Intersection( EGroupID group, EGroupID grouptointersect )
 

Performs a group intersection.  

Only entities that are in both groups will be added to 'group'.
The contents of 'grouptointersect' will not be changed.
Example: group = (1,2,3,4,5,6) grouptointersect = (2,4,6,8,10) --> group will now equal (2,4,6)

 

Boolean  EGroup_IsCapturedByPlayer( EGroupID egroup, PlayerID playerId, Boolean all )
 

Returns true if all or any strategic points in a group have been captured. Use ANY or ALL. 

This function will ignore all entities that cannot be captured and will return false if no entities in the group can be captured.

 

Boolean  EGroup_IsDoingAttack( EGroupID egroup, Boolean all, Float time )
 

Returns true if ALL or ANY entities are attacking within the time 

 

Boolean  EGroup_IsEmpty( EGroupID egroup )
 

Returns true if a named entity group contains no spawned or despawned entities 

 

Void  EGroup_IsHoldingAny( EGroupID egroup )
 

Returns whether any entity in an EGroup has a hold on anything 

 

Boolean  EGroup_IsInCover( EGroupID egroup, Boolean all )
 

Returns true if ALL or ANY entities are in cover. 

 

Boolean  EGroup_IsMoving( EGroupID egroupid, Boolean all )
 

Returns true if ANY or ALL entities in an EGroup are moving. 

 

Bool  EGroup_IsOnScreen( PlayerID player, EGroupID group, Bool all[, Float percent] )
 

Returns true if ANY or ALL (use those keywords) of the enities in the group are present onscreen. You can pass in a percentage of the screen to check, so 0.8 would be a centered rectangle occupying 80% of the screen. 

 

Boolean  EGroup_IsProducingSquads( EGroupID egroup, Boolean all )
 

Returns true if ALL or ANY entities in a group are currently producing squads 

Set all to true to check for ALL or set to false to check for ANY

 

Boolean  EGroup_IsUnderAttack( EGroupID egroup, Boolean all, Float time )
 

Returns true if ALL or ANY entities are under attack within the time 

 

Bool  EGroup_IsUnderAttackByPlayer( EGroupID group, PlayerID attackerplayer, Float duration )
 

Check if the entities are attacked by the player 

 

Boolean  EGroup_IsUnderAttackFromDirection( EGroupID egroup, Boolean all, Real/Table offset, Float time )
 

Returns true if ALL or ANY entities are under attack from a direction within the time. see LuaConsts.scar for types of directions. you can pass in a table of offsets 

 

Boolean  EGroup_IsUsingAbility( EGroupID egroup, Boolean ALL )
 

Checks if ANY or ALL squads within an EGroup are using an ability 

also used for emplacements/entities that are built but function through the use of squads. Does not check WHAT ability a squad is using.

 

Void  EGroup_Kill( EGroupID egroup )
 

Kill all entities in an EGroup 

 

Void  EGroup_Remove( EGroupID group, EntityID entity )
 

Removes an entity from a group. 

 

Void  EGroup_RemoveDemolitions( EGroupID egroup )
 

Removes all demolition charges on an egroup 

 

Void  EGroup_RemoveGroup( SGroupID group, SGroupID grouptoremove )
 

Remove from the first SGroup all squads contained in the second SGroup. SGroup2 remains untouched. 

 

Void  EGroup_RemoveUpgrade( EGroupID egroup, UpgradeBlueprint/Table upgrade )
 

Removes upgrade(s) from an egroup 

 

Void  EGroup_ReSpawn( EGroupID egroup )
 

Respawn all despawned entities in a group. 

 

Void  EGroup_SetAnimatorAction( EGroupID egroup, String actionName )
 

Trigger animation action for an EGroup. Please only use this for simple animations 

 

Void  EGroup_SetAnimatorEvent( EGroupID egroup, String eventName )
 

Set animation event for an EGroup. Please only use this for simple animations 

 

Void  EGroup_SetAnimatorState( EGroupID egroup, String stateMachineName, String stateName )
 

Set animation state of a state machine for an EGroup. Please only use this for simple animations 

 

Void  EGroup_SetAnimatorVariable( EGroupID egroup, String variableName, Real value )
 

Set animation variable value for an EGroup. Please only use this for simple animations 

 

Void  EGroup_SetAutoTargetting( EGroupID group, String hardpoint, Bool enable )
 

Sets whether a weapon to auto-target things or not 

 

Real  EGroup_SetAvgHealth( EGroupID egroup, Real healthPercent )
 

Sets the health of each unit in an entity group to a given percent [0.0, 1.0]. 

 

Void  EGroup_SetCrushable( EGroupID egroup, Boolean crushable )
 

Overrides crushable behavior for an egroup 

 

Void  EGroup_SetHealthMinCap( EGroupID egroup, float minhealth )
 

Set the minimum health for this entity 

This is usually set to zero, any higher value prevents the entity from having its health reduced below this given value

 

Void  EGroup_SetInvulnerable( EGroupID egroup, Boolean enabled[, Float reset_time] )
 

Enable/Disable invulnerablity for an entire entity group. Use true and false for simple on/off, or use a number between 0.0 and 1.0 for more precise control on how much damage an entity can take before it takes no more. 

The optional reset_time is used to automatically remove invulnerability after a set time. If invulnerable, both health and critical damage are disabled.

 

Void  EGroup_SetPlayerOwner( EGroup egroup, PlayerID owner )
 

Changes the player owner for all spawned and despawned entities of an EGroup. 

Strategic/capturable point does not support setting player owner directly

 

Void  EGroup_SetSelectable( EGroupID egroup, Bool selectable )
 

Set player selectable state of entities in the egroup 

 

Void  EGroup_SetSharedProductionQueue( EGroupID egroup, Boolean enable )
 

Enables shared team production on a building (teammates can build using THEIR resources) 

 

Void  EGroup_SetStrategicPointNeutral( EGroupID egroup )
 

Sets a strategic point to neutral (not owned by any team)  

 

Void  EGroup_SetWorldOwned( EGroupID egroup )
 

Makes an egroup neutral 

 

EGroupID  EGroup_Single( EGroupID egroup, entityID entity )
 

Creates an entity group containing a single entity 

Creates an EGroup containing just one entity, creating the group if it doesn't exist and clearing it if it does. It returns the name of the EGroup.

 

Boolean  SGroup_HasEntityUpgrade( EGroupID egroup, UpgradeID upgrade, Boolean all )
 

Returns true if ANY or ALL of the squad's entities have the specified upgrade 

 

 

 

Entity
Functions

Void  EGroup_NotifyOnPlayerDemolition( EGroupID id, LuaFunction function )
 

Calls a function when any entity in an EGroup gets destroyed by the player clicking the "Detonate me" button 

 

Void  EGroup_SetDemolitions( PlayerID player, EGroupID egroupid[, Real numcharges] )
 

Instantly wires a building for demolitions 

 

Void  Entity_BuildingPanelInfo( EntityID pEntity, Position cam, Position terrain )
 

Displays info about the panel that is intersected by the passed in ray 

 

Boolean  Entity_CanAttackNow( EntityID attacker, Position target )
 

Returns whether an entity can attack a target without moving or turning. 

 

Boolean  Entity_CanLoadSGroup( EntityID entity, SGroupID loadthis, Boolean bCheckSquadState, Boolean bOverload )
 

Check if the entity can load an sgroup or not 

 

Boolean  Entity_CanLoadSquad( EntityID entity, SquadID squad, Boolean bCheckSquadState, Boolean bOverload )
 

Check if the entity can load squad or not 

 

Boolean  Entity_CanSeeEntity( EntityID entity, EntityID target )
 

Returns true if a target entity is in the entities sight radius 

 

Boolean  Entity_CanSeeSquad( EntityID entity, SquadID target )
 

Returns true if a target squad is in the squads sight radius 

 

Void  Entity_ClearPostureSuggestion( EntityID entity )
 

Clears any previous posture suggestions made to an entity 

 

EntityID  Entity_Create( EntityBlueprint ebp, PlayerID player, Position pos, Position toward )
 

Creates an entity at a given position and assigns it to a given player. 'blueprint' is a string value containing the name of the entity blueprint. This function does not spawn the entity so you will need to call Entity_Spawn to see this entity 

 

EntityID  Entity_CreateENV( EntityBlueprint ebp, Position pos, Position toward )
 

Creates an entity at a given position and assigns it to a given player. 'blueprint' is a string value containing the name of the entity blueprint. This function spawns the entity so there is no need to call Entity_Spawn 

 

Void  Entity_DeSpawn( EntityID entity )
 

DeSpawn the entity at its current position 

 

Void  Entity_Destroy( EntityID entity )
 

Remove an entity from the world and destroy it. 

 

Boolean  Entity_DisableBuildingDeath( EntityID pEntity, Boolean bDisableDeath )
 

Disables the death of the given entity building, only works for panel based destructible buldings 

 

Void  Entity_DoBuildingDamageRay( EntityID pEntity, Position cam, Position terrain, Real dmgType, Real radius )
 

Damages this entity but only if its a destructible building 

dmgType of 0 is damage accessory, 1 is damage panel, 2 is destroy panel and 3 is destroy radius

 

Void  Entity_EnableAttention( EntityID entity, Boolean attentive )
 

Sets whether an entity pays attention to its surroundings 

 

Void  Entity_EnableProductionQueue( EntityID entity, Boolean enable )
 

Sets whether an entity can produce anything (including upgrades) 

 

Void  Entity_ForceConstruct( EntityID e )
 

Force constructs this entity but only if its a building 

 

EntityID  Entity_FromWorldID( Real id )
 

Get an entity from a mission editor ID. 

 

Real  Entity_GetActiveCommand( EntityID entity )
 

Returns the active entity command. Some valid entity commands: STATEID_StructureBuilding, STATEID_Dead, STATEID_Idle, STATEID_Pause 

 

EntityBlueprint  Entity_GetBlueprint( EntityID entity )
 

Returns the entity's blueprint 

 

Real  Entity_GetBuildingProgress( EntityID pEntity )
 

Returns the construction progress (with range [0.0, 1.0] for a given entity. Returns 0.0 if the entity is not a building. 

 

Real  Entity_GetCoverValue( EntityID entity )
 

Get cover safety value from the where the entity is standing. The safety value is number from -.5 to .5. 

Higher value means better cover. If the entity doesn't have cover_ext, value of 0 would be returned

 

Real  Entity_GetGameID( EntityID entity )
 

Returns the entities unique id in the world 

 

Position  Entity_GetHeading( EntityID entity )
 

Returns the heading of the entity. The heading is currently a lua table with three entries (x, y, z) 

 

Real  Entity_GetHealth( EntityID entity )
 

Returns the health of an entity. 

Health will be zero for entities with no health extension.

 

Real  Entity_GetHealthMax( EntityID entity )
 

Returns the max health of an entity. 

Max health will be zero for entities with no health extension.

 

Real  Entity_GetHealthPercentage( EntityID entity )
 

Returns the percentage health, taking into account destructible buildings 

Health will be zero for entities with no health extension nor building destruction

 

Bool  Entity_GetInvulnerable( SquadID squad )
 

Check if the entity is invulnerable or not 

 

Real  Entity_GetInvulnerableMinCap( EntityID entity )
 

Returns the invulnerable point in terms of percentage 

For buildings, retrieve the percentage value of healthy below which no more panels could be destroyed

 

Void  Entity_GetLastAttacker( EntityID entity, SGroupID group )
 

Find the last squad attacker on this entity. If found, the squad is added to the sgroup 

 

Void  Entity_GetLastAttackers( EntityID entity, SGroupID group, Real timeSeconds )
 

Find the squad attackers on this entity from the last seconds specified. If found, the squads are added to the sgroup. Building attackers are ignored 

 

Real  Entity_GetNumCombatSlots( EntityID entity, String holdTypeName )
 

Returns the number of combat slots in total of a certain hold-able type 

 

Position  Entity_GetOffsetPosition( EntityID entity, Real offset, Real distance )
 

Returns a position relative to an entity's current position and orientation. see LuaConsts.scar for explanation of 'offset' parameter. 

 

PlayerID  Entity_GetPlayerOwner( EntityID entity )
 

Returns the Player owner of the given entity. Entity MUST NOT be owned by the world. 

Use World_OwnsEntity to make sure entity is not owned by the world before calling this function

 

Position  Entity_GetPosition( EntityID entity )
 

Returns the position of the entity. The position is currently a lua table with three entries (x, y, z) 

 

Blueprint  Entity_GetProductionQueueItem( EntityID entity, Real index )
 

Returns the blueprint for a production queue item with index. 

 

Real  Entity_GetProductionQueueItemType( EntityID entity, Real index )
 

Returns the production type (PITEM_Upgrade, PITEM_Spawn, PITEM_SquadUpgrade, PITEM_SquadReinforce, PITEM_PlayerUpgrade) for a production queue item with index. 

 

Real  Entity_GetProductionQueueSize( EntityID entity )
 

Returns the number of items in the entities production queue. 

It is an error to call this function on an entity that does not have a production queue.
Use Entity_HasProductionQueue to check that the entity has a queue.

 

Real  Entity_GetSightInnerHeight( EntityID entity )
 

Returns the inner sight radius for this entity 

Radius will be zero for entities without a sight extension

 

Real  Entity_GetSightInnerRadius( EntityID entity )
 

Returns the inner sight radius for this entity 

Radius will be zero for entities without a sight extension

 

Real  Entity_GetSightOuterHeight( EntityID entity )
 

Returns the outer sight radius for this entity 

Radius will be zero for entities without a sight extension

 

Real  Entity_GetSightOuterRadius( EntityID entity )
 

Returns the outer sight radius for this entity 

Radius will be zero for entities without a sight extension

 

SquadID  Entity_GetSquad( EntityID pEntity )
 

Returns the Squad for the passed Entity. (May be NULL) 

 

Boolean  Entity_GetSquadsHeld( EntityID pEntity, SGroupID sgroup )
 

Adds squads held by an entity to an SGroup 

 

Real  Entity_GetTotalPanelCount( EntityID pEntity )
 

Gets the total number of panels in a building (returns 0 for anything but panel based destructible buldings) 

 

Real  Entity_GetUndestroyedPanelCount( EntityID pEntity )
 

Gets the current number of undestroyed panels in a building (returns 0 for anything but panel based destructible buldings) 

 

WeaponBlueprint  Entity_GetWeaponBlueprint( EntityID entity, Real hardPointIndex )
 

Returns a weapon hardpoint 

 

Real  Entity_GetWeaponHardpointCount( EntityID entity )
 

Returns how many hardpoints an entity has 

 

Boolean  Entity_HasCritical( EntityID pEntity, CriticalBlueprint criticalPBG )
 

Return true if the entity has the given criticalID applied to it 

 

Boolean  Entity_HasProductionQueue( EntityID entity )
 

Returns true if an entity has a production queue. 

 

Boolean  Entity_HasUpgrade( EntityID pEntity, UpgradeBlueprint upgradePBG )
 

Return true if the entity has purchased the specified upgrade. 

 

Void  Entity_InstantCaptureStrategicPoint( EntityID entity, PlayerID player )
 

Strategic point will be captured instantly by the team of the supplied player 

 

Void  Entity_InstantRevertOccupiedBuilding( EntityID entity )
 

Reverts an occupied building 

 

Real  Entity_IsAlive( EntityID pEntity )
 

Returns true if entity is still alive 

 

Boolean  Entity_IsAttacking( EntityID entity, Real time )
 

Returns true if the entity is attacking within the time 

Time is in seconds

 

Boolean  Entity_IsBuilding( EntityID e )
 

Returns true if the given entity is a building 

 

Boolean  Entity_IsCamouflaged( EntityID entity )
 

Returns whether the entity is camouflaged. 

 

Boolean  Entity_IsCapturableBuilding( EntityID entity )
 

Returns true if the entity is a capturable building 

 

Boolean  Entity_IsCasualty( EntityID entity )
 

Returns true if entity is a casualty else false 

 

Boolean  Entity_IsDemolitionReady( EntityID entity )
 

Returns whether this entity's demolition charges are ready to be detonated 

 

Real  Entity_IsEBPBuilding( EntityBlueprint ebp )
 

Returns true if the given blueprint is a building 

 

Boolean  Entity_IsEBPObjCover( EntityBlueprint ebp )
 

Returns true if the given blueprint is objcover 

 

Boolean  Entity_IsHardpointActive( EntityID entity, Real hardPointIndex )
 

Returns whether a hardpoint is active 

 

Boolean  Entity_IsHoldingAny( EntityID entity )
 

Check if the entity has a hold on anything 

 

Boolean  Entity_IsInCover( EntityID entityId )
 

Returns true if entity is in cover. 

 

Boolean  Entity_IsMoving( EntityID pEntity )
 

Returns whether an entity is moving. 

 

Boolean  Entity_IsOfType( EntityID entity, String type )
 

Determines if this entity is of the given type. Types are defined in type_ext/unit_type_list 

 

Boolean  Entity_IsPartOfSquad( EntityID pEntity )
 

Returns true if the entity is part of a squad 

 

Boolean  Entity_IsSoldier( EntityID pEntity )
 

Returns whether an entity is a soldier 

 

Boolean  Entity_IsSpawned( EntityID entity )
 

if entity is spawned return true 

 

Boolean  Entity_IsStartingPosition( EntityID entity )
 

Returns true if the entity is a starting position 

 

Boolean  Entity_IsStrategicPoint( EntityID entity )
 

Returns true if the entity is a strategic point. 

 

Boolean  Entity_IsStrategicPointCapturedBy( EntityID entity, PlayerID player )
 

Returns true if strategic point is captured by the team of the player provided. 

 

Boolean  Entity_IsSyncWeapon( EntityID entity )
 

Return true if the entity is a team weapon 

 

Boolean  Entity_IsUnderAttack( EntityID entity, Real time )
 

Returns true if the entity is under attack.  

 

Boolean  Entity_IsUnderAttackByPlayer( EntityID entity, PlayerID pAttackerOwner, Real time )
 

Returns true if the entity is under attack by a certain player 

 

Boolean  Entity_IsUnderAttackFromDirection( EntityID entity, Real offset, Real timeSeconds )
 

Returns true if the entity was under attack from a certain direction (8 offset types, see LuaConsts.scar) 

 

Boolean  Entity_IsValid( Real id )
 

Check if an entity with the given ID can be found in the world 

 

Boolean  Entity_IsVehicle( EntityID pEntity )
 

Returns whether an entity is a vehicle 

 

Boolean  Entity_IsVictoryPoint( Entity *pEntity )
 

Returns true if entityID is a victory point 

 

Void  Entity_Kill( EntityID entity )
 

Kill the entity. Sets health to 0, and triggers death effects. 

 

Void  Entity_NotifyOnPlayerDemolition( Entity entity, LuaFunction function )
 

Calls a function when an entity gets destroyed by the player clicking the "Detonate me" button next to an entity. 

 

Void  Entity_RemoveBoobyTraps( EntityID pEntityTarget )
 

Removes all booby-traps on this entity 

 

Void  Entity_RemoveDemolitions( EntityID entity )
 

Removes all demolition charges on an entity 

 

Void  Entity_RemoveUpgrade( EntityID entity, UpgradeBlueprint upgrade )
 

Removes an upgrade from an entity 

 

Void  Entity_SetAnimatorAction( EntityID pEntity, String actionName )
 

Trigger animation action for an entity. Please only use this for simple animations 

 

Void  Entity_SetAnimatorActionParameter( EntityID pEntity, String actionParameterName, String actionParameterValue )
 

Set animation action parameter for an entity. Please only use this for simple animations 

 

Void  Entity_SetAnimatorEvent( EntityID pEntity, String eventName )
 

Set animation event for an entity. Please only use this for simple animations 

 

Void  Entity_SetAnimatorState( EntityID pEntity, String stateMachineName, String stateName )
 

Set animation state of a state machine for an entity. Please only use this for simple animations 

 

Void  Entity_SetAnimatorVariable( EntityID pEntity, String variableName, Real value )
 

Set animation variable value for an entity. Please only use this for simple animations 

 

Void  Entity_SetCrushable( EntityID entity, Boolean crushable )
 

Overrides crushable behavior for an entity 

 

Boolean  Entity_SetDemolitions( PlayerID player, EntityID entity, Real numcharges )
 

Fully wires this entity for demolitions, if it's set up to be demolishable. 'player' is the one that owns the demolitions and can detonate them. 

 

Void  Entity_SetHeading( EntityID entity, Position pos, Boolean bInterpolate )
 

Sets the heading of the entity. The position is currently a lua table with three entries (x, y, z) 

 

Void  Entity_SetHealth( EntityID entity, Real healthPercent )
 

Set the health of an entity. healthPercent must be in the range [0.0, 1.0]. 

 

Void  Entity_SetInvulnerable( EntityID entity, Bool enable, Float reset_time )
 

Set invulnerability on the entity. Reset time is in seconds. If it it set, the invulnerability will expire after this time. 

 

Void  Entity_SetInvulnerableMinCap( EntityID entity, Real minHealthPercentage, Real resetTime )
 

Make an entity invulnerable to physical damage when health is below the minimum health percentage 

resetTime is the time in seconds that vulnerability will be restored.; zero time for reset time means the buff will last forever

 

Void  Entity_SetPlayerOwner( EntityID entity, PlayerID owner )
 

Changes the owner of the given squad. 

This function doesn't work with strategic/capturable point

 

Void  Entity_SetPosition( EntityID entity, Position pos )
 

Sets the position of the entity. The position is currently a lua table with three entries (x, y, z) 

 

Void  Entity_SetProjectileCanExplode( EntityID projectile, Boolean canExplode )
 

Sets whether or not a projectile can explode.  

 

Void  Entity_SetSharedProductionQueue( EntityID entity, Boolean shared )
 

Enables shared team production on a building (teammates can build using THEIR resources) 

 

Void  Entity_SetStrategicPointNeutral( EntityID entity )
 

Sets a strategic point to neutral (not owned by any team) 

 

Void  Entity_SetWorldOwned( EntityID entity )
 

Makes an entity neutral 

 

Void  Entity_SimHide( EntityID entity, Boolean hide )
 

Shows/hides the entity in the simulation 

 

Void  Entity_Spawn( EntityID entity )
 

Spawn the entity at its current position 

 

Void  Entity_StopAbility( EntityID entity, AbilityBlueprint ability, Boolean bEarlyExit )
 

Abruptly stops an active ability 

 

Void  Entity_SuggestPosture( EntityID entity, unsigned posture, Real duration )
 

Suggests a posture to an entity, lasting the passed duration 

Posture of 0 is prone, 1 is kneel/crouch, and 2 is standing. Duration is in seconds, negative means indefinate.

 

Boolean  Entity_SupportsDemolition( EntityID entity )
 

Returns whether this entity is set up to have demolitions placed on it 

 

Void  Entity_TagDebug( EntityID entity )
 

Tags the entity to be used for debugging 

 

Void  Entity_VisHide( EntityID pEntity, Boolean bHide )
 

Hides or shows an entity visually. 

 

Void  ModMisc_MakeCasualtyAction( EntityID pTargetEntity )
 

Make the passed entity a casualty by triggering the MakeCasualtyAction 

 

Void  ModMisc_MakeWreckAction( EntityID pTargetEntity )
 

Make the passed entity a wreck by triggering the MakeWreckAction 

 

Void  ModMisc_OOCAction( EntityID pTargetEntity )
 

Make the passed entity go out of control 

Triggers an OutOfControlAction on the unit. Does not trigger any actions associated with an OOC weapon hit critical, just the OOC action.

 

 

 

FOW
Functions

Void  FOW_RevealAll( Void  )
 

Reveal FOW for all players 

 

Void  FOW_RevealArea( Position pos, Real radius, Real durationSecs )
 

Reveals a circular area for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until unreveal is called )

 

Void  FOW_RevealEGroup( EGroupID group, Real durationSecs )
 

Reveals an entity groups line of sight(LOS) for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until the entities are dead )

 

Void  FOW_RevealEGroupOnly( EGroupID group, Real durationSecs )
 

Reveals an entity groups in FOW for all alive players over a given duration. 

Pass in a duration of -1 for indefinite duration ( until the entities are dead )

 

Void  FOW_RevealEntity( EntityID entity, Real durationSecs )
 

Reveals an entities line of sight (LOS) for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until the entity is dead )

 

Void  FOW_RevealMarker( MarkerID marker, Real duration )
 

Reveals an area the size of a given markers proximity at that markers position for a given amount of time. Pass in a duration of 1 for indefinite duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA.  

This function will reveal the FOW for ALL alive players. This does not work with markers with rectangular proximity type

 

Void  FOW_RevealSGroup( SGroupID group, Real durationSecs )
 

Reveals a squad groups line of sight(LOS) for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until the squads are dead )

 

Void  FOW_RevealSGroupOnly( SGroupID group, Real durationSecs )
 

Reveals a squad groups in fow for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until the squads are dead )

 

Void  FOW_RevealSquad( SquadID squad, Real durationSecs )
 

Reveals a squads line if sight(LOS) for all alive players over a given duration. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

Pass in a duration of -1 for indefinite duration ( until the entity is dead )

 

Void  FOW_RevealTerritory( PlayerID player, Real sectorID, Real durationSecs, Boolean mustOwn )
 

Reveals a territory to a player 

 

Void  FOW_TagSGroup( PlayerID player, SGroupID group )
 

Adds all items in a group to a given players FOW. 

Items line of sight will be visible until it is destroyed or UnTag is called.

 

Void  FOW_UnRevealAll( Void  )
 

Use to undo a FOW_RevealAll 

 

Void  FOW_UnRevealArea( Position pos, Real radius )
 

UnReveals a circular area for all alive players. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA. 

 

Void  FOW_UnRevealMarker( MarkerID marker )
 

Unreveals an area the size of a given markers proximity at that markers position. YOU SHOULD ONLY CALL THIS ONCE FOR EACH AREA.  

This does not work with markers with rectangular proximity type

 

Void  FOW_UnRevealTerritory( PlayerID player, Real sectorID )
 

Unreveals a territory sector 

 

Void  FOW_UnTagSGroup( PlayerID player, SGroupID group )
 

Removes items from a players FOW that were added using FOW_TagSGroup 

 

 

 

ID
Functions

LuaTable  EGroup_CreateTable( String format, Real size )
 

Returns a table of egroups NOT in the world builder 

See Marker_GetTable for more info on format parameter

 

LuaTable  EGroup_GetWBTable( String format )
 

Returns a table of egroups from the world builder 

See Marker_GetTable for more info on format parameter

 

LuaTable  Marker_GetNonSequentialTable( String format, Real size )
 

Returns a fixed size table of markers from the world builder. Markers that do not exist in the WB, will be nil in the table. This is why we call it 'non-sequential' 

 

LuaTable  Marker_GetTable( String format )
 

Returns a table of markers from the world builder. Creates as many as it finds 

mkr_table = Marker_GetTable( 'mkr_%d' ) -- creates a table with 3 markers named 'mkr_1', 'mkr_2', and 'mkr_3' (and so on) from the WB

mkr_table2 = Marker_GetTable( 'mkr_%02d' ) -- creates a table with 3 markers named 'mkr_01', 'mkr_02', 'mkr_03' (and so on) from the WB

mkr_table3 = Marker_GetTable( 'mkr_%03d_patrol' ) -- creates a table with 3 markers named 'mkr_001_patrol', 'mkr_002_patrol' (and so on) from the WB

 

LuaTable  SGroup_CreateTable( String format, Real size )
 

Returns a table of sgroups NOT in the world builder 

See Marker_GetTable for more info on format parameter

 

LuaTable  SGroup_GetWBTable( String format )
 

Returns a table of sgroups from the world builder 

See Marker_GetTable for more info on format parameter

 

 

 

Marker
Functions

Boolean  Marker_DoesNumberAttributeExist( MarkerID marker, String attrname )
 

Returns true if a generic number attribute exists for the marker type. 

 

Boolean  Marker_DoesStringAttributeExist( MarkerID marker, String attrname )
 

Returns true if a generic string attribute exists for the marker type. 

 

Boolean  Marker_Exists( String name, String type )
 

Returns true if marker exists. If you don't care about the type, pass in an empty string ( "" ) 

 

MarkerID  Marker_FromName( String name, String type )
 

Returns a ScarMarker from the Mission Editor. If you don't care about the type, pass in an empty string ( "" ) 

The type is defined in the markers list of the mission editor when placing markers.
You will need the result of this function to call any functions that start with Marker_

 

Position  Marker_GetDirection( MarkerID marker )
 

Returns a vector for the marker direction 

 

String  Marker_GetName( MarkerID marker )
 

Returns the name of a given marker. This value gets set in the Mission Editor. 

 

Real  Marker_GetNumberAttribute( MarkerID marker, String attrname )
 

Returns a generic number attribute defined in a marker. 

Different marker types have different attributes. Note: All marker types have Name and Proximity. Do not use this function to retrieve these values, use Marker_GetName and Marker_GetProximity instead.

 

Position  Marker_GetPosition( MarkerID marker )
 

Returns the position of a given marker. 

 

Real  Marker_GetProximityRadius( MarkerID marker )
 

Returns the proximity radius of a given marker. Only for marker with proximity type PT_Circle. This value gets set in the Mission Editor. 

 

Real  Marker_GetProximityType( MarkerID marker )
 

Returns the proximity type of a given marker. The possible results are PT_Circle and PT_Rectangle 

 

Table  Marker_GetSequence( String name )
 

Builds a table of MarkerIDs that are named in a sequence. i.e. a name of "spot" will find markers "spot1", "spot2" and so on, up until it looks for a marker that isn't there. 

 

String  Marker_GetStringAttribute( MarkerID marker, String attrname )
 

Returns a generic string attribute defined in a marker. 

Different marker types can have different attributes.
Note: All marker types have Name and Proximity. Do not use this function to retrieve these values, use Marker_GetName and Marker_GetProximity instead.
See markertypes.lua for a listing of all the marker types.

String  Marker_GetType( MarkerID marker )
 

Returns the typename of a given marker. This is the typename from the Mission Editor (name displayed when placing markers) 

 

Boolean  Marker_InProximity( MarkerID marker, Position pos )
 

Returns true if the given position is in the markers proximity radius or proximity rectangle (depending on the type). 

 

 

 

modalui
Functions

Void  ModalUI_AllEntityFacing( BindingInterface* bi, SquadID squad, Vector3f facingPos )
 

Issue a facing order to an all entities in a squad 

 

Boolean  ModalUI_CanMoveFaceValidation( SquadID squad, Boolean turnOnly )
 

ensures your squad is allowed to enter the move or facing states 

 

Real  ModalUI_EntityCanShoot_Entity( EntityID entity, Real hardPointIndex, EntityID targetEntity )
 

Returns a value indicating whether the weapon can target an entity. 

 

Real  ModalUI_EntityCanShoot_Pos( EntityID entity, Real hardPointIndex, Vector3f pos )
 

Returns a value indicating whether the weapon can target a position. 

 

Void  ModalUI_EntityFacing( BindingInterface* bi, EntityID entity, Vector3f facingPos )
 

Issue a facing order to an entity 

 

Real  ModalUI_EntityGetAllianceWithLocalPlayer( EntityID entity )
 

Returns the relationship between the local player and the entity: R_Ally, R_Enemy, R_Neutral... 

 

Real  ModalUI_EntityGetBurstProgress( EntityID entity, Real hardPointIndex )
 

Returns the fraction of the burst cycle complete: 1 for burst just started, 0 for burst complete. 

 

Real  ModalUI_EntityGetCoolDownProgress( EntityID entity, Real hardPointIndex )
 

Returns the fraction of the cooldown cycle complete: 0 for reload just started, 1 for reload complete. 

 

Boolean  ModalUI_EntityGetIsCoolDown( EntityID entity, Real hardPointIndex )
 

Returns true if entities weapon is cooled down 

 

Real  ModalUI_EntityGetReloadProgress( EntityID entity, Real hardPointIndex )
 

Returns the fraction of the reload cycle complete: 0 for reload just started, 1 for reload complete. 

 

std::string  ModalUI_EntityGetWeaponBlueprint( EntityID entity, Real hardPointIndex )
 

Returns the active weapon's blueprint name. 

 

Real  ModalUI_EntityGetWindDownProgress( EntityID entity, Real hardPointIndex )
 

Returns the fraction of the cooldown cycle complete: 0 for reload just started, 1 for reload complete. 

 

Boolean  ModalUI_EntityHasLOSToTarget( EntityID entity, Real hardPointIndex )
 

Returns a value indicating whether the weapon can target a position. 

 

Boolean  ModalUI_EntityIsControllable( EntityID entity )
 

Returns a value indicating whether the weapon is in position to fire on its current target. 

 

Boolean  ModalUI_EntityIsTrackingTarget( EntityID entity, Real hardPointIndex )
 

Returns a value indicating whether the weapon is in position to fire on its current target. 

 

ConstEntityGroupTemp  ModalUI_GetEntitiesInSquad( SquadID squad )
 

Returns a table containing the entities in a squad. 

 

Real  ModalUI_GetWeaponType( EntityID entity, Real hardPointIndex )
 

Returns Weapon_Ranged, Weapon_Projectile or Weapon_Artillery, or -1 if no weapon for that hardpoint 

 

Boolean  ModalUI_PointIsInWorld( Math::Vector3f point )
 

ensures given point is within the world 

 

Void  ModalUI_SelectClear( Void  )
 

Resets the potential selection to only this entity (this highlights and shows the health status of the unit) 

 

Void  ModalUI_SelectEntity( EntityID entity )
 

Resets the potential selection to only this entity (this highlights and shows the health status of the unit) 

 

Void  ModalUI_SelectPotentialClear( Void  )
 

Resets the potential selection to only this entity (this highlights and shows the health status of the unit) 

 

Void  ModalUI_SelectPotentialEntity( EntityID entity )
 

Resets the potential selection to only this entity (this highlights and shows the health status of the unit) 

 

Void  ModalUI_SquadFacing( BindingInterface* bi, Boolean queue, SquadID squad, Vector3f facingPos )
 

Issues a move-and-face order to a squad. 

 

Void  ModalUI_SquadMoveFacing( BindingInterface* bi, Boolean queue, Boolean faceOnly, SquadID squad, Vector3f pos, Vector3f facingPos )
 

Issues a move-and-face order to a squad. 

 

Void  ModalUI_SquadMoveNoFacing_Pos( BindingInterface* bi, Boolean queue, SquadID squad, Vector3f pos )
 

Issues a move order to a squad. 

 

Void  ModalUI_SquadStop( BindingInterface* bi, SquadID squad )
 

Issues a halt order to a entity, with no speech trigger 

 

Real  ModalUI_UtilDistance( Vector3f a, Vector3f b )
 

Returns the distance between two points. 

 

Real  ModalUI_UtilGetUITime( BindingInterface* bi )
 

Returns the current wall time, in milliseconds. 

 

 

 

Modifiers
Functions

Void  Modifier_IsEnabledOnEGroup( EGroupID egroup, String modifier, String modtype, Boolean all, Boolean bEnabledByDefault )
 

Checks if a modifier is enabled on all or any entities in an egroup 

 

Void  Modifier_Remove( ModID modifier )
 

Remove an applied modifier.  

 

Void  Modifier_RemoveAllFromEGroup( EGroupID egroup )
 

Removes all SCAR-applied modifiers for a specific EGroup.  

 

Void  Modifier_RemoveAllFromSGroup( SGroupID sgroup )
 

Removes all SCAR-applied modifiers for a specific SGroup.  

 

ModID  Modify_AbilityDelayTime( PlayerID player, AbilityID ability, Real scalefactor )
 

Modifies the initial delay time of an ability 

 

ModID  Modify_AbilityDurationTime( PlayerID player, AbilityID ability, Real scalefactor )
 

Modifies the duration of an ability 

 

ModID  Modify_AbilityMaxCastRange( PlayerID player, AbilityID ability, Real scalefactor )
 

Modifies the maximum casting range of an ability. NOTE: it assumes that the actions that the ability executes can also handle the modified range 

 

ModID  Modify_AbilityMinCastRange( PlayerID player, AbilityID ability, Real scalefactor )
 

Modifies the minimum casting range of an ability. NOTE: it assumes that the actions that the ability executes can also handle the modified range 

 

ModID  Modify_AbilityRechargeTime( PlayerID player, AbilityID ability, Real scalefactor )
 

Modifies the recharge time of an ability 

 

ModID  Modify_CaptureTime( EGroupID sgroup, Real scalefactor )
 

Modifies the capture time of all strategic points in an EGroup 

 

ModID  Modify_DisableHold( EGroupID group, Boolean disable )
 

Enable or disable hold (garrisoning) for an egroup or sgroup 

 

Void  Modify_Enable_ParadropReinforcements( PlayerID playerId, Boolean enable )
 

Allows paratroopers to reinforce from the sky. Set to true to enable, false to disable. 

 

ModID  Modify_EntityBuildTime( PlayerID playerId, String ebp, Real scalefactor )
 

Modifies the time taken to build a particular EBP. This only affects the given player.  

 

ModID  Modify_EntityCost( PlayerID player, String blueprint, Real resourcetype, Real addition )
 

Modifies the cost of an entity for a particular player. Possible resource types are RT_Manpower, RT_Munition, RT_Fuel, RT_Action  

 

ModID  Modify_PlayerExperienceReceived( PlayerID player, Real factor )
 

Modifies the veterancy experience received by a player 

 

ModID  Modify_PlayerProductionRate( PlayerID sgroup, Real scalefactor )
 

Modifies the production rate of a player. 

 

ModID  Modify_PlayerResourceGift( PlayerID playerId, Real resourceType, Real scalefactor )
 

Modifies a player's resource bonus received (ie. one-time resource gifts) Possible resource types are RT_Manpower, RT_Munition, RT_Fuel, RT_Action  

 

ModID  Modify_PlayerResourceRate( PlayerID playerId, Real resourceType, Real scalefactor[, Real mathtype] )
 

Modifies a player's incoming resource rate. Possible resource types are RT_Manpower, RT_Munition, RT_Fuel, RT_Action. Possible math types are MUT_Multiplication, MUT_Addition. 

 

ModID  Modify_PlayerSightRadius( PlayerID player, Real scalefactor )
 

Modifies the sight radius for a player. 

 

ModID  Modify_ProductionRate( EGroupID sgroup, Real scalefactor )
 

Modifies the production rate of all factories in an EGroup 

 

ModID  Modify_ReceivedAccuracy( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the chance of a squad/entity being hit 

 

ModID  Modify_ReceivedDamage( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the damage a squad/entity receives. 

 

ModID  Modify_ReceivedPenetration( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the chance of a squad/entity being penetrated 

 

ModID  Modify_ReceivedSuppression( SGroupID sgroup, Real scalefactor )
 

Modifies the rate at which a squad gets suppressed 

 

ModID  Modify_SetUpgradeCost( PlayerID playerId, UpgradeID upgrade, Real resourceType, Real newCost )
 

Sets the cost of an upgrade. This only affects the given player 

 

ModID  Modify_SightRadius( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the sight radius for an egroup or an sgroup. 

 

ModID  Modify_SquadAvailability( PlayerID player, String blueprint, Real addition )
 

Modifies the availability limit of a squad type for any given player 

 

ModID  Modify_TargetPriority( SGroupID/EGroupID group, Real addition )
 

Modifies the target priority of a squad or entity group from the attacker. The value is an addition 

 

ModID  Modify_TerritoryRadius( EGroupID group, Real scalefactor )
 

Modifies the territory radius for an egroup or an sgroup. 

 

ModID  Modify_UnitSpeed( SGroupID sgroup, Real scalefactor )
 

Modifies the maximum speed for a vehicle. This has no effect on infantry. 

 

ModID  Modify_UnitVeterancyValue( SGroup/EGroup group, Real scalefactor[, Real mathtype )
 

Modifies the Veterancy Experience value of the target SGroup, EGroup, Entity, or Squad. Mathtype is Multiplication by default 

 

ModID  Modify_UpgradeBuildTime( PlayerID playerId, UpgradeID upgrade, Real scalefactor )
 

Modifies the build time for a particular upgrade. This only affects the given player.  

 

ModID  Modify_Upkeep( PlayerID playerId, Real scalefactor )
 

Modifies the upkeep for a player  

 

ModID  Modify_VehicleRepairRate( PlayerID player, Real factor[, String engineer_blueprint] )
 

Modifies the vehicle repair rate of all a player's engineers 

 

ModID  Modify_Vulnerability( EGroupID/SGroupID group, Real scalefactor )
 

Increases the received accuracy, penetration, and damage on a squad by the scalefactor. For example, a scalefactor of 2 means that the squad gets 2x the received accuracy, 2x the received penetration, and 2x the received damage. 

 

ModID  Modify_WeaponAccuracy( SGroupID/EGroupID group, String hardpoint, Real scalefactor )
 

Modifies a squad's weapon accuracy. 

The hardpoint should be specified as a string - i.e. "hardpoint_01"

 

ModID  Modify_WeaponBurst( SGroupID/EGroupID group, String hardpoint, Real scalefactor )
 

Modifies a squad's weapon burst time. 

The hardpoint should be specified as a string - i.e. "hardpoint_01"

 

ModID  Modify_WeaponCooldown( SGroupID/EGroupID group, String hardpoint, Real scalefactor )
 

Modifies a squad's weapon cooldown time. 

The hardpoint should be specified as a string - i.e. "hardpoint_01"

 

ModID  Modify_WeaponDamage( SGroupID/EGroupID group, String hardpoint, Real scalefactor )
 

Modifies a squad's weapon damage. 

The hardpoint should be specified as a string - i.e. "hardpoint_01"

 

ModID  Modify_WeaponRange( SGroupID/EGroupID group, String hardpoint, Real scalefactor )
 

Modifies a squad's weapon range. Does not work on artillery (mortar, nebelwerfer, etc.) 

The hardpoint should be specified as a string - i.e. "hardpoint_01"

 

 

 

NIS
Functions

Void  nis_debugdisplay( Boolean bDisplay )
 

If set to true extra debugging information will be displayed 

 

Void  nis_setintransitiontime( Real numSeconds )
 

Sets the number of seconds it takes to transition from game to nis, 0 is instantaneous 

This includes blending the camera position, fov and clip planes

 

Void  nis_setouttransitionnis( String filename )
 

Lets the nis system know which nis will be transitioned to when the first one ends. 

This function doesn't actually trigger a second nis to start, rather it lets the NIS system know which one will be next, so it can prevent the camera from popping back to the game camera.

 

Void  nis_setouttransitiontime( Real numSeconds )
 

Sets the number of seconds it takes to transition from nis back to game, 0 is instantaneous 

This includes blending the camera position, fov and clip planes

 

Void  nis_usegamecamera( Boolean bUseGameCamera )
 

If set to true the nis camera isn't used, when an nis is playing 

This is a debugging command, the game camera is used even when the NIS is playing

 

 

 

Objectives
Functions

LabelID  Objective_AddLabel( LuaTable objectiveTable, Position pos, LocString text )
 

Adds a tactical map label to an objective 

 

PingID  Objective_AddPing( LuaTable objectiveTable, Position pos )
 

Adds a tactical map ping to an objective 

 

ElementID  Objective_AddUIElements( LuaTable objTable, Position pos[, Boolean ping, LocString hintpointText, Boolean worldArrow, Float/Position objectiveArrowOffset] )
 

Adds multiple UI elements on one position. 'pos' can be group/entity/squad/marker. worldArrow adds a 3D arrow which points to the thing in the world. hintpointText adds a hint point that appears on the thing when moused over. If you're adding an arrow or a hintpoint, this thing will be among those potentially pointed to by the 2D HUD arrow. objectiveArrowOffset is an offset applied to the arrow's position (you can specify a height offset or a 3D position offset). 

 

Void  Objective_AlertSitRep( LuaTable objTable )
 

Drops an event cue for player 1, allowing them to access the sitrep for the objective 

 

Boolean  Objective_AreAllPrimaryObjectivesComplete( )
 

Returns whether all primary objectives have been completed. 

 

Void  Objective_Complete( LuaTable objTable[, Boolean bShowTitle] )
 

'Completes' an objective. Wrapper function for Objective_SetState with a few other features. If you do not want the objective title to be shown on screen, pass in 'false' for bShowTitle 

Includes managing the blips and triggers the OnComplete() function as defined by the objective table created in the main scar file.

 

Void  Objective_Fail( LuaTable objTable[, Boolean bShowTitle] )
 

'Fails' an objective. Wrapper function for Objective_SetState with a few other features. 

Includes managing the blips and triggers the OnFail() function as defined by the objective table created in the main scar file.

 

Void  Objective_ForceSitRep( LuaTable objTable )
 

Brings you to the tactical map screen and plays the sitrep for this objective 

 

Real  Objective_GetCounter( LuaTable objTable )
 

Returns the current count associated with this objective. 

 

Real  Objective_GetTimerSeconds( LuaTable objTable )
 

Returns the amount of seconds on the timer (time remaining or time elapsed, based on the type of timer used) 

 

Boolean  Objective_IsComplete( LuaTable objTable )
 

Returns whether an objective is complete 

 

Boolean  Objective_IsCounterSet( LuaTable objTable )
 

Returns true if a counter has been set for this objective 

 

Boolean  Objective_IsFailed( LuaTable objTable )
 

Returns whether an objective is failed 

 

Void  Objective_IsStarted( LuaTable objTable )
 

Returns whether an objective has been started. Completed objectives will return true. 

 

Boolean  Objective_IsTimerSet( LuaTable objTable )
 

Returns true if a timer has been set for this objective 

 

Void  Objective_PauseTimer( LuaTable objTable )
 

Pauses the objective's timer. If a timer has not been set, it does nothing. 

 

ObjectiveID  Objective_Register( LuaTable objTable[, PlayerID/TeamID owner] )
 

'Registers' an objective. Wrapper function for Objective_Create with a few other features. 

Includes pointers, labels and pings as defined by the objective table created in the main scar file. You can pass in a team or player, so that the objective only applies to it.

 

Void  Objective_RemoveLabel( LuaTable objectiveTable, Real LabelID )
 

Removes a tactical map label from an objective 

 

Void  Objective_RemovePing( LuaTable objectiveTable, Real PingID )
 

Removes a tactical map ping from an objective 

 

Void  Objective_RemoveUIElements( LuaTable objTable, Real elementID )
 

Removes a group of UI elements that were added by Objective_AddUIElements 

 

Void  Objective_ResumeTimer( LuaTable objTable )
 

Resume the objective's timer. If a timer has not been set, it does nothing. 

 

Void  Objective_SetAlwaysShowDetails( LuaTable objTable, Boolean title, Boolean hud_arrow, Boolean hintpoints )
 

Sets whether this objective always shows detailed text, the HUD arrow, or the hintpoints. There can only be one objective at a time that forces the HUD arrow to show up. If you pass in 'nil' for hud_arrow then its behavior is not affected. 

 

Void  Objective_SetCounter( LuaTable objTable, Float current[, Float maximum] )
 

Sets a counter that is associated with this objective in the UI. You can provide a 'maximum' so that it shows up as "1 of 5" 

 

Void  Objective_Show( LuaTable objective_table, Boolean on/off )
 

Shows or hides an objective from the UI and tactical map 

 

Void  Objective_Start( LuaTable objTable[, Boolean bShowTitle] )
 

Shows an objective to the player and activates it 

Includes pointers, labels, pings and FOW as defined by the objective table created in the main scar file.

 

Void  Objective_StartTimer( LuaTable objTable, Real direction[, Float initialTime, Float flashThreshold] )
 

Starts a timer that is associated with this objective in the UI. Use COUNT_DOWN or COUNT_UP for the 'direction' parameter 

 

Void  Objective_StopCounter( LuaTable objTable )
 

Stops the objective's counter. If a counter has not been set, it does nothing. 

 

Void  Objective_StopTimer( LuaTable objTable )
 

Stops the objective's timer. If a timer has not been set, it does nothing. 

 

Void  Objective_TogglePings( LuaTable objective_table, Boolean on/off )
 

Toggles minimap blips on or off. 

 

Void  Objective_UpdateText( LuaTable objTable, LocString title, LocString description[, Boolean bShowTitle] )
 

Updates the title and description for the objective. If you only want to set one of them, pass in nil for the other 

 

 

 

Player
Functions

Void  Player_AddAbility( PlayerID pPlayer, AbilityBlueprint pAbilityPBG )
 

Add an ability to a player 

 

Void  Player_AddAbilityLockoutZone( PlayerID player, AbilityBlueprint abilityPBG, MarkerID marker )
 

Specifies a marker where an ability cannot be used. This only applies to abilities where you use the cursor to pick a location in the world (like a location to paradrop at). 

 

Real  Player_AddHeroToSpawner( PlayerID pModPlayer, const ScarSquadPBG ScarEntityPBGHero, const ScarEntityPBG ScarEntityPBGSpawner, const unsigned long experience, const unsigned long durability )
 

Allows the specified hero unit blueprint to be built at the specified spawner location blueprint (like an HQ) 

 

Void  Player_AddResource( PlayerID playerId, Real resourceType, Real value )
 

Add resource to player, as opposed to just setting it. Possible resource types are RT_Manpower, RT_Munition, RT_Fuel, RT_Action  

 

SGroupID  Player_AddSquadsToSGroup( PlayerID playerId, String squadgroupName )
 

For the given player, get all of the squads gathered into a squadgroup of your naming.  

Squads will be added to given squad group. If the given squad group does not exist it will be created.

 

Void  Player_AddUnspentCommandPoints( PlayerID player, Real points )
 

Gives the player new command points to spent on 

 

Boolean  Player_AreSquadsNearMarker( PlayerID playerid, MarkerID marker )
 

Returns true if ANY of a players squads are in proximity of a marker 

 

Boolean  Player_CanSeeEGroup( PlayerID playerid, EGroupID egroup, Boolean all )
 

Returns true if a player can see ALL or ANY items in an egroup 

 

Boolean  Player_CanSeeEntity( PlayerID player, EntityID entity )
 

Returns true if a player can see a given entity 

 

Boolean  Player_CanSeePosition( PlayerID player, Position pos )
 

Returns true if a player can see a given position. 

 

Boolean  Player_CanSeeSGroup( PlayerID playerid, SGroupID sgroup, Boolean all )
 

Returns true if a player can see ALL or ANY items in an sgroup 

 

Boolean  Player_CanSeeSquad( PlayerID player, SquadID squad, Boolean all )
 

Returns true if a player can see ALL or ANY units in a given squad 

Set all to true to check that ALL units are visible or set to false to check for ANY.

 

Void  Player_ClearArea( PlayerID player, MarkerID marker, Bool invulnerable )
 

Any of the player's units in the marker area move out of the area, and can be made invulnerable for a bit whilst they do it 

You can replace the marker with a position and a range - i.e. Player_ClearArea(player, pos, range, invulnerable)

 

Void  Player_ClearAvailabilities( PlayerID player )
 

Clears item, command and construction menu availabilities for the player. 

 

Void  Player_ClearPopCapOverride( PlayerID player )
 

Clears the pop cap override so that modifiers can take effect again 

 

Void  Player_CompleteUpgrade( PlayerID pPlayer, UpgradeBlueprint pUpgradePBG )
 

Finish upgrade for a player 

 

Void  Player_DoParadrop( PlayerID player, SGroupID sgroup, Position pos, Real dropHeight, Real dropDrift, LuaBinding::StackVar blueprint, Real maxSquadEntityCount, Real maxDeathOnBuilding )
 

Do a paradrop with custom parameters for this player. This is similar to regular paradrop ability without any prereq check 

sgroup is the SGroup that the newly created squad would be added to dropHeight is Height in metres the paratroopers are dropped from. dropDrift is Horizontal distance in metres from where the paratroopers are dropped from. blueprint is the blueprint to spawn. It could be squad or entity maxSquadEntityCount is the number of squad members to spawn. 0 means default is used maxDeathOnBuilding is the number of entities allowed to die when landing on buildings Example: local id = SBP.ALLIED_AIRBOURNE Player_DoParadrop( g_player1, sg_soldier1, Marker_GetPosition( marker4 ), 100.0, 10.0, id, 3, 2 )

 

PlayerID  Player_FindFirstEnemyPlayer( PlayerID player )
 

Searches the player list in the world and returns the id of the first enemy player 

 

PlayerID  Player_FromId( Real id )
 

Returns a player given a player id from the ME. NOTE: this is a temp function, and will be replaced with Player_FromName 

 

PlayerID  Player_FromName( String name )
 

Get a player using their name from the Mission Editor. NOT DONE YET 

 

Real  Player_GetAIType( PlayerID pPlayer )
 

Returns the type of the given player if it is an AI. Possible types are: AII_None, AII_Normal, AII_LocalHumanTakeover, AII_RemoteAITakeover, AII_RemoteHumanTakeover (-1 if the player does not exist) 

 

Void  Player_GetAll( PlayerID player[, SGroupID sgroup, EGroupID egroup] )
 

Creates/Clears groups that contain all of a player's units and buildings. Defaults - sg_allsquads and eg_allentities 

Fills an SGroup with all of the given player's squads, and an EGroup with all the player's entities. If you don't provide and groups, then it defaults to using sg_allsquads and eg_allentities.

 

Void  Player_GetAllEntitiesNearMarker( PlayerID playerid, EGroupID egroup, MarkerID/Pos/SectorID position[, Real range] )
 

Gather together all of a player's entities that are in proximity to a marker, a position, or within a territory sector into an EGroup. The EGroup is cleared beforehand.  

You can override a marker's normal proximity by specifying a range.

 

Void  Player_GetAllSquadsNearMarker( PlayerID player, SGroupID sgroup, MarkerID/Pos/SectorID position[, Real range] )
 

Gather together all of a player's squads that are in proximity to a marker, a position, or within a territory sector into an SGroup. The SGroup is cleared beforehand.  

You can override a marker's normal proximity by specifying a range.

 

Real  Player_GetBuildingsCount( PlayerID playerId )
 

Returns the total number of buildings owned by this player. 

 

Real  Player_GetBuildingsCountExcept( PlayerID playerId, BlueprintTable exceptions )
 

Returns the total number of buildings owned by this player (with exclusions). 

 

Real  Player_GetBuildingsCountOnly( PlayerID playerId, BlueprintTable ebplist )
 

Returns the number of buildings owned by this player (inclusive). 

 

Real  Player_GetCurrentPopulation( PlayerID player, Real capType )
 

Use capType CT_Personnel to get current squad cap, CT_Vehicle to get current vehicle cap, CT_Medic to get current medic cap 

 

LocString  Player_GetDisplayName( PlayerID player )
 

Returns the players UI name. 

 

EGroupID  Player_GetEntities( PlayerID player )
 

Returns an EntityGroupObs containing all the players entities. 

This function returns a 'global' entity group with the name '__Player%dEntities', where %d is the player ID. This means that you should never need to destroy it./n However, if you do destroy it, it will be recreated the next time this function is called.

 

Real  Player_GetEntityCount( PlayerID player )
 

Returns the number of entities a player currently owns 

 

String  Player_GetEntityName( PlayerID player, Real index )
 

Returns the name of an entity a player currently owns 

 

Real  Player_GetHeroExperience( PlayerID pModPlayer, boost::uint64_t id )
 

Gets the specified hero's veterancy level for the player. If hero is not found, -1 is returned 

 

Real  Player_GetID( PlayerID player )
 

Returns the id of the player 

 

Real  Player_GetMaxPopulation( PlayerID player, Real capType )
 

Use capType CT_Personnel to get max squad cap or CT_VehicleCap to get max vehicle cap. 

 

Real  Player_GetNumStrategicPoints( PlayerID p )
 

Returns the number of strategic points (not objectives) this player owns 

 

Real  Player_GetNumVictoryPoints( PlayerID p )
 

Returns the number of strategic objectives this player owns 

 

Real  Player_GetPhase( PlayerID player )
 

Returns the phase the given player is currently at 

 

Real  Player_GetRace( PlayerID player )
 

Returns the race index for the given player. 

 

String  Player_GetRaceName( PlayerID player )
 

Returns the name of the race for a given player (eg. allies, allies_commonwealth, axis, axis_panzerelite) and always in english 

 

Real  Player_GetRelationship( PlayerID player1, PlayerID player2 )
 

Returns the relationship between 2 players. Possible relationships are R_ENEMY, R_ALLY, R_NEUTRAL, R_UNDEFINED. 

 

Real  Player_GetResource( PlayerID player, Real resourceType )
 

Returns the amount of resources a given player has. Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command 

 

Real  Player_GetResourceRate( PlayerID player, Real resourceType )
 

Returns the amount of resources a given player is getting per second. Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command 

 

Real  Player_GetSquadCount( PlayerID player )
 

Returns the number of squads a player currently owns 

 

String  Player_GetSteamID()
 

Returns the steamid of the local player. Note: As String, since Lua forces scientific notation on big Reals.
This function is only available in CoH:EF 

 

SGroupID  Player_GetSquads( PlayerID player )
 

Returns a SquadGroupObs containing all the players units. 

This function returns a 'global' squad group with the name '__Player%dSquads', where %d is the player ID. This means that you should never need to destroy it./n However, if you do destroy it, it will be recreated the next time this function is called.

 

Position  Player_GetStartingPosition( PlayerID player )
 

Returns the starting position for this player 

 

Real  Player_GetTeam( PlayerID p )
 

Get the team a player is on 

 

Real  Player_GetUnitCount( PlayerID player )
 

Returns the current number of units the player has. 

 

Real  Player_GetUpgradeCost( PlayerID player, UpgradeBlueprint upgradePBG, Real resourceType )
 

Returns the cost of an upgrade. Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command. 

 

boolean  Player_HasBuilding( PlayerID player, BlueprintTable entitytypes )
 

Returns true if this player owns any buildings listed in the table. 

This only looks at completed buildings - use Player_HasBuildingUnderConstruction to see if the player is building something

 

boolean  Player_HasBuildingsExcept( PlayerID playerId, BlueprintTable exceptions )
 

Returns true if this player owns any buildings. (with exclusions). 

 

boolean  Player_HasBuildingUnderConstruction( PlayerID player, BlueprintTable entitytypes )
 

Returns true if this player owns any buildings listed in the table currently under construction. 

 

Boolean  Player_HasLost( PlayerID player, LuaTable Blueprints )
 

Checks to see if a player has lost (if player owns any squads and any buildings contained in blueprints) 

Pass in a table of blueprints of buildings that the player must have in order to be considered "alive". Ambient buildings are already take into consideration since they must be occupied by a squad.

 

Boolean  Player_HasMapEntryPosition( PlayerID player )
 

Returns whether a player has a map entry position 

 

Boolean  Player_HasUpgrade( PlayerID pPlayer, UpgradeBlueprint upgradePBG )
 

Return true if the squad has purchased the specified upgrade. 

 

Boolean  Player_IsAlive( PlayerID player )
 

Returns true if player is still alive and false if player is dead. Will error if playerIdx is an invalid index. 

 

Boolean  Player_IsAllied( PlayerID playerId1, PlayerID playerId2 )
 

Returns true if the players are allied and false if they are not. 

 

Boolean  Player_IsHuman( PlayerID pPlayer )
 

Returns whether a player is human controlled (local or remote), not dead, and not replaced by an AI 

 

Void  Player_Kill( PlayerID player, Boolean endgame )
 

Kill a player. Will error if playerIdx is an invalid index. 

 

Real (amount of squads promoted)  Player_MakeSGroupVeteran( PlayerID player, SGroupID sgroup )
 

Tries to promote each squad in an sgroup, given that the player has veteran squads available for the appropriate squad types. See Player_MakeSquadVeteran for more details. 

 

Boolean  Player_MakeSquadVeteran( PlayerID player, SquadID squad )
 

If the player has a veteran squad of the same type in reserve, it promotes an existing squad to match the veteran squad (rank and slot items). The veteran squad is "used up" and is no longer available. Does not promote squad if there would be no benefit in doing so. 

 

Real  Player_NumUpgradeComplete( PlayerID player, const char *upgradeName )
 

Returns the number of upgrades that this player has. The upgradeName should be a relative filename (eg. upgrade/allies/research/phase_2.lua) 

 

Boolean  Player_OwnsEGroup( PlayerID playerid, EGroupID egroup[, Boolean all] )
 

Returns true if a given player owns ALL or ANY items in a group 

 

Boolean  Player_OwnsEntity( PlayerID playerid, EntityID entity )
 

Returns true if a given player owns an entity 

 

Boolean  Player_OwnsSGroup( PlayerID playerid, SGroupID sgroup[, Boolean all] )
 

Returns true if a given player owns ALL or ANY items in a group 

 

Boolean  Player_OwnsSquad( PlayerID playerid, SquadID squad )
 

Returns true if a given player owns a squad 

 

Void  Player_RemoveAbilityLockoutZone( PlayerID player, AbilityBlueprint abilityPBG, MarkerID marker )
 

Removes a marker that was previously a lockout zone. 

 

Void  Player_RemoveUpgrade( PlayerID player, UpgradeBlueprint upgrade )
 

Removes an upgrade from a player 

 

Void  Player_ResetResource( PlayerID player, Real resourceType )
 

Reset the resource amount for a given player to zero. Also reset team weapon 

Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command.

 

Void  Player_RestrictAddOnList( PlayerID playerid, Table addonlist )
 

Restrict a list of addons. 

list should contain an array of strings to restrict.

 

Void  Player_RestrictBuildingList( PlayerID playerid, Table blueprintlist )
 

Restrict a list of buildings. 

list should contain an array of strings to restrict.

 

Void  Player_RestrictResearchList( PlayerID playerid, StringTable list )
 

Restrict a list of research items. 

list should contain an array of strings to restrict.

 

Void  Player_RevertChosenCommanderTree( PlayerID player )
 

Removes chosen CC tree and all upgrades associated with it. 

 

Void  Player_SetAbilityAvailability( PlayerID player, AbilityBlueprint/Table bp, Real availability )
 

Sets the availability of an ability. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetAllCommandAvailability( PlayerID player, Real availability )
 

Sets availability of ALL entity, squad and player commands. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetCommandAvailability( PlayerID player, Real/Table command, Real availability )
 

Sets the availability of entity, squad and player commands. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetConstructionMenuAvailability( PlayerID player, String/Table menuname, Real availability )
 

Sets the availability of a construction menu. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetDefaultSquadMoodMode( PlayerID pPlayer, Real mode )
 

Set default squad mood mode which can be overrided by squad level mood mode settings 

 

Void  Player_SetEntityProductionAvailability( PlayerID player, EntityBlueprint/Table bp, Real availability )
 

Sets the availability of an entity production item. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetHeroBuildable( PlayerID pModPlayer, const int id, Boolean bBuildable, const ScarEntityPBG ScarEntityPBGSpawner )
 

Sets the hero to be buildable or not at the specified spawner 

 

Void  Player_SetMaxCapPopulation( PlayerID playerid, Real captype, Real newcap )
 

Sets the current personnel or vehicle max-cap for a player. The captype is either CT_Personnel or CT_Vehicle (you can't adjust Medic caps just yet). 

you will have to call Player_SetMaxPopulation to adjust the current max population to do this.

 

Void  Player_SetMaxPopulation( PlayerID playerid, Real captype, Real newcap )
 

Sets the current personnel or vehicle cap for a player. The captype is either CT_Personnel or CT_Vehicle (you can't adjust Medic caps just yet). 

Note that any modifiers that adjust the current cap will be applied on top of this. Also note, the current cap cannot go higher than the max cap.

 

Void  Player_SetPopCapOverride( PlayerID player, Real personnel )
 

Sets a pop cap override that ignores any modifiers. 

 

Void  Player_SetResource( PlayerID player, Real resourceType, Real amt )
 

Set the resource amount for a given player. Ignores income cap and resource sharing. 

Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command.

 

Void  Player_SetSquadProductionAvailability( PlayerID player, SquadBlueprint/Table bp, Real availability )
 

Sets the availability of a squad production item. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetUpgradeAvailability( PlayerID player, UpgradeBlueprint/Table bp, Real availability )
 

Sets the availability of an upgrade. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

 

Void  Player_SetUpgradeCost( PlayerID player, UpgradeID upgrade, Real manpower, Real fuel, Real munition, Real action, Real command )
 

Sets the cost of an upgrade. 

 

EntityID  Player_SpawnGlider( PlayerID player, EntityBlueprint glider, Position start, Position end )
 

Spawns a glider and returns it 

 

Void  Player_StopAbility( PlayerID player, AbilityBlueprint ability, Boolean bEarlyExit )
 

Abruptly stops an active ability 

 

Void  Player_StopEarningActionPoints( PlayerID player )
 

Prevents a player from earning any action points (and by extention, command points) 

 

Void  Player_Triangulate( PlayerID player, SGroupID squads, EGroupID entities )
 

Returns the enemy squads and entities within a player's radio beacons. Radio beacons are shared among team members. 

 

 

 

Presentation
Functions

Void  Actor_Clear( ActorTable actor )
 

Clear ties between an actor and any units 

 

Void  Actor_PlaySpeech( ActorTable actor, Real locID[, Boolean continueButton, Boolean stickySubtitle, Boolean blockInput] )
 

Plays a speech event for a given actor WITH a portrait and subtitle 

Be VERY careful how you use the 'blockInput' parameter. It blocks all input except mouse movement, a few critical keyboard keys, and the Continue and Menu buttons. So you should always allow a continue button when blocking input. You shouldn't block input for a sticky subtitle! If the speech file is not available, a placeholder time will be calculated for the message using the number of words and the message will be displayed for that length of time.
Actors: ACTOR.GenericAlly, ACTOR.GenericAxis, ACTOR.Keller, ACTOR.McKay, ACTOR.Conti, ACTOR.Franks, ACTOR.Peoples, ACTOR.Coogi, etc...

 

Void  Actor_PlaySpeechWithoutPortrait( ActorTable actor, Real locID[, Boolean continueButton, Boolean stickySubtitle, Boolean blockInput] )
 

Plays a speech event for a given actor WITHOUT a portrait or subtitle. See Actor_PlaySpeech for more details 

 

Void  Actor_SetFromSGroup( ActorTable actor, SGroupID sgroup )
 

Tie an entire sgroup to an actor, so audio comes from a squad member 

 

Void  Actor_SetFromSquad( ActorTable actor, SquadID squad )
 

Tie a single squad to an actor, so audio comes from a squad member 

 

 

 

Proximity
Functions

Boolean  Prox_AreEntitiesNearMarker( EGroupID egroup, MarkerID/Position/SectorID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL entities from a group are in range of a given position, marker, or territory sector. 

Markers with proximity type rectangle will use circular proximity check if custom range is supplied

 

Boolean  Prox_ArePlayerMembersNearMarker( PlayerID player, MarkerID/Position/SectorID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL of a player's members (i.e. individual guys, not squads as a whole) are in range of a given position, marker, or territory sector. DO NOT USE THIS FUNCTION UNLESS YOU ABSOLUTELY HAVE TO!! 

You MUST specify a range if you are using a position rather than a marker.

 

Boolean  Prox_ArePlayersNearMarker( PlayerID player, MarkerID/Position/SectorID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL of a player's squads are in range of a given position, marker, or territory sector. THIS FUNCTION IS VERY SLOW. DO NOT USE THIS UNLESS ABSOLUTELY NECESSARY. 

Markers with proximity type rectangle will use circular proximity check if custom range is supplied

 

Boolean  Prox_AreSquadMembersNearMarker( SGroupID sgroup, MarkerID/Position/SectorID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL squad members (i.e. individual guys, not squads as a whole) from a group are in range of a given position, marker, or territory sector. DO NOT USE THIS FUNCTION UNLESS YOU ABSOLUTELY HAVE TO!! 

Markers with proximity type rectangle will use circular proximity check if custom range is supplied

 

Boolean  Prox_AreSquadsNearMarker( SGroupID sgroup, MarkerID/Position/SectorID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL squads from a group are in range of a given position, marker, or territory sector 

Markers with proximity type rectangle will use circular proximity check if custom range is supplied

 

Real  Prox_EGroupEGroup( EGroupID egroup1, EGroupID egroup2, ProxType checktype )
 

Returns the distance between two entity groups. use checktype PROX_SHORTEST, PROX_LONGEST, or PROX_CENTER. 

If check is PROX_SHORTEST this will return the shortest distance between the two groups.
If check is PROX_LONGEST this will return the longest distance between the two groups.
If check is PROX_CENTER this will return the distance between the two groups centers.

 

Real  Prox_EGroupSGroup( EGroupID egroup1, SGroupID sgroup2, ProxType checktype )
 

Returns the distance between an entity group and a squad group. use checktype PROX_SHORTEST, PROX_LONGEST, or PROX_CENTER. 

If check is PROX_SHORTEST this will return the shortest distance between the two groups.
If check is PROX_LONGEST this will return the longest distance between the two groups.
If check is PROX_CENTER this will return the distance between the two groups centers.

 

Boolean  Prox_EntitiesInProximityOfEntities( EGroupID egroup1, EGroupID egroup2, Real proximity, Boolean all )
 

Checks if ALL or ANY entities are in proximity of a given entity group. 

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY.

 

Real  Prox_MarkerEGroup( MarkerID marker, EGroupID egroup, ProxType checktype )
 

Returns the distance between a marker and an entity group. use checktype PROX_SHORTEST, PROX_LONGEST, or PROX_CENTER. 

If check is PROX_SHORTEST this will return the shortest distance between the two groups.
If check is PROX_LONGEST this will return the longest distance between the two groups.
If check is PROX_CENTER this will return the distance between the two groups centers.

 

Real  Prox_MarkerSGroup( MarkerID marker, SGroupID sgroup, ProxType checktype )
 

Returns the distance between a marker and a squad group. use checktype PROX_SHORTEST, PROX_LONGEST, or PROX_CENTER. 

If check is PROX_SHORTEST this will return the shortest distance between the two groups.
If check is PROX_LONGEST this will return the longest distance between the two groups.
If check is PROX_CENTER this will return the distance between the two groups centers.

 

Boolean  Prox_PlayerEntitiesInProximityOfEntities( PlayerID playerid, EGroupID egroup, Real proximity, Boolean all, EntityID exclude )
 

Checks if ALL or ANY players squads are in proximity of a given entity group. 

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerEntitiesInProximityOfPlayerSquads( PlayerID playerentities, PlayerID playersquads, Real proximity, Boolean all )
 

Checks if ALL or ANY players entities are in proximity of a given squad group. 

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerEntitiesInProximityOfSquads( PlayerID playerid, SGroupID sgroup, Real proximity, Boolean all )
 

Checks if ALL or ANY players entities are in proximity of a given squad group. 

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerSquadsInProximityOfEntities( PlayerID playerid, EGroupID egroup, Real proximity, Boolean all )
 

Checks if ALL or ANY players squads are in proximity of a given entity group. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerSquadsInProximityOfPlayerEntities( PlayerID playersquads, PlayerID playerentities, Real proximity, Boolean all )
 

Checks if ALL or ANY players squads are in proximity of a given players entities. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerSquadsInProximityOfPlayerSquads( PlayerID playerid1, PlayerID playerid2, Real proximity, Boolean all )
 

Checks if ALL or ANY players squads are in proximity of a given players squads. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_PlayerSquadsInProximityOfSquads( PlayerID playerid, SGroupID sgroup, Real proximity, Boolean all, SquadID exclude )
 

Checks if ALL or ANY players squads are in proximity of a given squad group. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

Real  Prox_SGroupSGroup( SGroupID sgroup1, SGroupID sgroup2, ProxType checktype )
 

Returns the distance between two squad groups. use checktype PROX_SHORTEST, PROX_LONGEST, or PROX_CENTER. 

If check is PROX_SHORTEST this will return the shortest distance between the two groups.
If check is PROX_LONGEST this will return the longest distance between the two groups.
If check is PROX_CENTER this will return the distance between the two groups centers.

 

Boolean  Prox_SquadsInProximityOfEntities( SGroupID sgroup, EGroupID egroup, Real proximity, Boolean all )
 

Checks if ALL or ANY squads are in proximity of a given entity group. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

Boolean  Prox_SquadsInProximityOfSquads( SGroupID sgroup1, SGroupID sgroup2, Real proximity, Boolean all )
 

Checks if ALL or ANY squads are in proximity of a given squad group. 

Set "all" to true to check that ALL squads are in proximity, or set "all" to false to check for ANY.

 

 

 

RuleSystem
Functions

Void  Rule_Add( LuaFunction rule[, Real priority] )
 

Add a rule to be executed every frame. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddDelayedInterval( LuaFunction rule, Real delay, Real interval[, Real priority] )
 

Add a rule to be executed at every 'interval' seconds, after an initial delay. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddDelayedIntervalEx( LuaFunction rule, Real delay, Real interval, Real calls[, Real priority, Real calls] )
 

Add a rule to be executed 'calls' times, at every 'interval' seconds, after an initial delay. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddEGroupEvent( LuaFunction rule, EGroupID egroup, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on entities in the 'egroup' 

Event types are: GE_EntityKilled

 

Void  Rule_AddEntityEvent( LuaFunction rule, EntityID entity, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on the 'entity' 

Event types are: GE_EntityKilled

 

Void  Rule_AddInterval( LuaFunction rule, Real interval[, Real priority] )
 

Add a rule to be executed at every 'interval' seconds. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddIntervalEx( LuaFunction rule, Real interval, Real calls[, Real priority] )
 

Add a rule to be executed 'calls' times, at every 'interval' seconds. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddOneShot( LuaFunction rule, Real interval[, Real priority] )
 

Add a rule to be executed once, after 'interval' seconds. Priority can be from 0 to 1000, with 0 being the lowest. Priority is used in conjunction with Rule_RemoveAll so that rules with high priority do not get removed. 

 

Void  Rule_AddPlayerEvent( LuaFunction rule, PlayerID player, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on the 'player' 

Event types are: GE_PlayerBeingAttacked

 

Void  Rule_AddSGroupEvent( LuaFunction rule, SGroupID sgroup, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on squads in the 'sgroup' 

Event types are: GE_SquadKilled, GE_SquadPinned, GE_SquadCommandIssued, GE_AbilityExecuted

 

Void  Rule_AddSquadEvent( LuaFunction rule, SquadID squad, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on the 'squad' 

Event types are: GE_SquadKilled, GE_SquadPinned, GE_SquadCommandIssued, GE_AbilityExecuted

 

Void  Rule_ChangeInterval( LuaFunction rule, Real interval )
 

Change 'interval' seconds of an existing rule 

 

Boolean  Rule_Exists( LuaFunction rule )
 

Test if a rule is currently active 

 

Void  Rule_Remove( LuaFunction rule )
 

Remove a currently active rule (this does not remove any event rules) 

 

Void  Rule_RemoveAll( [Real max_priority] )
 

Kills all rules below a certain priority. The default is to remove ALL rules. 

 

Void  Rule_RemoveEGroupEvent( LuaFunction rule, EGroupID egroup )
 

Remove an active event rule for entities in the 'egroup' 

 

Void  Rule_RemoveEntityEvent( LuaFunction rule, EntityID entity )
 

Remove an active event rule for the 'entity' 

 

Void  Rule_RemoveIfExist( LuaFunction rule )
 

Remove a currently active rule if it exists(this does not remove any event rules) 

 

Void  Rule_RemoveMe( )
 

Remove a currently executing rule (only works inside a rule function) 

 

Void  Rule_RemovePlayerEvent( LuaFunction rule, PlayerID player )
 

Remove an active event rule for the 'player' 

 

Void  Rule_RemoveSGroupEvent( LuaFunction rule, SGroupID sgroup )
 

Remove an active event rule for squads in the 'sgroup' 

 

Void  Rule_RemoveSquadEvent( LuaFunction rule, SquadID squad )
 

Remove an active event rule for the 'squad' 

 

 

 

Setup
Functions

Void  Setup_Difficulty( PlayerID player[, Real difficulty, string Race, Table infantry_mod, Table vehicle_mod )
 

Sets up difficulty (currently: modifies entity health, and sets AI difficulty). You should pass in Game_GetSPDifficulty() as the difficulty. 

You can optionally specify the race if the player is using squads different from his current race selection.

 

Void  Setup_MissionPreset( Real missionIDnum )
 

Refers to 'MissionPresets.scar' and allows for all missions to have preset data taken into account. 

 

PlayerID  Setup_Player( Real playerIndex, LocString playerName, String playerRace, Real team )
 

Initializes the all of the players settings in one function and returns the playerID. 

In most cases you will call this function from OnGameSetup and store the returned playerId in a global variable. The player index should be in the range [1 , (numPlayers)].
Valid player races: TRACE_ALLIES or TRACE_AXIS
Example:
function OnGameSetup( )
 g_player1 = Setup_Player(0, "PlayerDisplayName", TRACE_ALLIES, 1)
 -- g_player2 and g_player3 will be on the same team (allies)
 g_player2 = Setup_Player(1, "$20000", TRACE_AXIS 2)
 g_player3 = Setup_Player(2, "$20001", TRACE_AXIS, 2)
 -- The team ID starts from one!
end

 

 

 

SGroup
Functions

Void  Cmd_StopSquadsExcept( SGroupID sgroup1[, Boolean stopCapture, Boolean stopBuild] )
 

Pass in a group to command to 'stop'. Pass in booleans for capturing and building 

 

Boolean  EGroup_CanLoadSGroup( EGroupID sgroup, SGroupID sgroup_to_load, Boolean ALL) )
 

Checks whether an EGroup can load ALL or ANY of the squads in the SGroup 

 

Void  Rule_AddEGroupEvent( LuaFunction fule, EGroup egroup, Real eventtype )
 

Add a rule to be executed when the event of 'eventType' has happened on the 'EGroup' Event types are: GE_EntityKilled 

 

Void  SGroup_Add( SGroupID group, SquadID squadron )
 

Adds an squadron to the end of a group if the group doesnt already have it. 

 

Void  SGroup_AddGroup( SGroupID group, SGroupID grouptoadd )
 

Same as EGroup_AddGroup. Note: You cannot mix squad groups and entity groups. 

 

Void  SGroup_AddLeaders( SGroupID sgroup )
 

Adds a leader to all squads in a group that can take a leader. 

This function will bypass all cost and queue prereqs

 

Void  SGroup_AddSlotItemToDropOnDeath( SGroupID groupid, Int itemid, Float drop_chance, Bool exclusive )
 

Add to the list of slot items to drop when any one of the squads is wiped out 

SGroup_AddSlotItemToDropOnDeath( squadid, item, false )

 

Boolean  SGroup_CanInstantReinforceNow( SGroupID group, Boolean all )
 

Return true if ANY or ALL of a group can reinforce now 

 

Boolean  SGroup_CanLoadSGroup( SGroupID sgroup, SGroupID sgroup_to_load, Boolean ALL) )
 

Checks whether an SGroup can load ALL or ANY of the squads in the SGroup 

 

Boolean  SGroup_CanSeeSGroup( SGroupID sgroup, SGroupID targetsgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group can see ALL or ANY squads in a target sgroup. 

 

Boolean  SGroup_CheckVeterancyRank( SGroupID sgroup, Real vetlevel )
 

Returns true if ALL squads in a group are at provided veterancy level.
This function is only available in CoH:EF

 

Real  SGroup_CountVeterancyRank( SGroupID sgroup, Real vetlevel )
 

Returns amount of squads at provided veterancy level in this SGroup.
This function is only available in CoH:EF

 

Void  SGroup_Clear( SGroupID sgroup )
 

Removes all entities from a group. 

 

Void  SGroup_ClearPostureSuggestion( SGroupID sgroup )
 

Clears any previous posture suggestions made to a squad 

 

Boolean  SGroup_Compare( SGroupID group1, SGroupID group2 )
 

Returns true if the contents of the two groups are equal. Order of the entities does not matter. 

 

Boolean  SGroup_ContainsBlueprints( SGroupID sgroup, BP/Table blueprints, Boolean all )
 

Check if a group contains ALL or ANY of the blueprints. 

 

Boolean  SGroup_ContainsSGroup( SGroupID group1, SGroupID group2, Boolean all )
 

Returns true if SGroup1 contains ANY or ALL of SGroup2 

 

Boolean  SGroup_ContainsSquad( SGroupID group, Real SquadID )
 

Returns true if SGroup contains a particular SquadID 

 

Real  SGroup_Count( SGroupID sgroup )
 

Returns the total number of spawned and despawned squads in a group. 

NOTE: SGroup_Count does not count the individiual soldiers in an SGroup. For that, use SGroup_TotalMembersCount

 

Real  SGroup_CountDeSpawned( SGroupID sgroup )
 

Returns the number of despawned squads in a group. 

 

Real  SGroup_CountSpawned( SGroupID sgroup )
 

Returns the number of spawned squads in a group. 

 

SGroupID  SGroup_Create( String name )
 

Returns a new squadron group with the given name.  

Squad groups are used for all units and vehicles. You can issue orders such as move and attack to an entire squad group. If you want a group for buildings or objects such as trees, use an EntityGroupObs instead.
Note that you are allowed to have unamed squadgroups or squadgroups with the samename. Be careful not to create duplicates of your squad group when you dont intend to. To be safe, you can check if the SquadGroupObs you want to create exists using SGroup_Exists( )

 

SGroupID  SGroup_CreateIfNotFound( String name )
 

Find a squad group from name. Creates a new one with given name if it doesnt exist. 

 

Void  SGroup_CreateKickerMessage( SGroupID group, PlayerID player, LocString textid )
 

Create and display kicker message on the each squad in the sgroup to the player 

 

Void  SGroup_DeSpawn( SGroupID groupid )
 

Despawn all spawned squads in a group. 

 

Void  SGroup_Destroy( SGroupID egroup )
 

Manually destroy a group that you dont need anymore. 

 

Void  SGroup_DestroyAllInMarker( SGroupID sgroup, MarkerID marker )
 

Destroys all items in a group that are in proximity to a given marker. 

 

Void  SGroup_DestroyAllSquads( SGroupID sgroup )
 

Destroys all spawned and despawned squads in a group. 

Be careful not to confuse this with SGroup_Destroy which destroys the group and NOT the squads it contains. This function will destroy spawned and despawned items in a group

 

Void  SGroup_DisableCombatPlans( SGroupID groupID )
 

Disables all current combat plans for the squads in the sgroup 

 

Void  SGroup_Duplicate( SGroupID sgroup1, SGroupID sgroup2 )
 

Duplicates an SGroup 

Creates a copy of sgroup1 in sgroup2. The function will clear sgroup2 beforehand if necessary.

 

Void  SGroup_Eject( SGroupID sgroup, Position destination )
 

Tells an SGroup to eject themselves from whatever they're inside (building or vehicle) 

 

Void  SGroup_EnableAttention( SGroupID sgroup, Boolean attentive )
 

Sets whether an entity pays attention to its surroundings 

 

Void  SGroup_EnableMinimapIndicator( SGroupID group, Boolean enable )
 

Enable or disable minimap indicator on all squads in the sgroup 

 

Void  SGroup_EnableSurprise( SGroupID groupid, Boolean enable )
 

Enables or disables the surprise feature for an sgroup 

 

Void  SGroup_EnableUIDecorator( SGroupID group, Boolean enable )
 

Enable or disable decorators on all squads in the sgroup  

 

Boolean  SGroup_Exists( String name )
 

Returns true if the squad group with the given name exists 

 

Void  SGroup_FaceEachOther( SGroupID sgroup1, SGroupID sgroup2 )
 

Makes two SGroups face each other 

 

Void  SGroup_FaceMarker( SGroupID sgroup, MarkerID marker )
 

Makes a SGroup face a marker. 

 

Void  SGroup_Filter( SGroupID sgroup, ID/Table blueprint, Real filtertype )
 

Filters an SGroup by blueprint. 

Blueprints can be provided by name or by ID, and in a table if you want to filter on more than one type. Setting filtertype to FILTER_KEEP results in the group only containing squads of the types listed in the blueprint table. Setting filtertype to FILTER_REMOVE will strip those same squads out and leave those that aren't of the types listed.

 

Void  SGroup_FilterCount( SGroupID sgroup1, Int groupSize )
 

Pass in a group and it will filter it down to the indicated number 

 

Void  SGroup_FilterThreat( SGroupID sgroup, LuaTable tableSBPs, [Boolean bEmpty] )
 

Searches an SGroup and finds the first threat within the table (searching first to last) and removes all other SBPs. 

Optional parameter bEmpty can be set to true, will clear the SGroup if none of the SBPS in the table are found.

 

Boolean  SGroup_ForEach( SGroupID sgroup, LuaBinding::StackVarFunction f )
 

Call a lua function for each item in a group. Function will recieve (groupid, itemindex, itemid) and should return true to break or false to continue. 

function Rule_Test( )
 local DespawnSquad = function( sgroupid, itemindex, squadID )
  Squad_Despawn( squadID )
 end

 SGroup_ForEach( SGroup_FromName("sg_Squads"), DespawnSquad )
end

This functions iterates over spawned squads only.

 

Boolean  SGroup_ForEachAllOrAny( SGroupID sgroup, Boolean all, LuaBinding::StackVarFunction f )
 

Call a lua function for each item in a group. Function will recieve (groupid, itemindex, itemid) and should return a bool. 

Only use this to TEST conditions on squads. DO NOT use this to perform operations on all squads, since it may not call your function on all squads (due to short circuit evaluation). This is used for checking if ALL or ANY items in a group match a given predicate. (eg. Are all items in a group choas marines)
This functions iterates over spawned squads only.

 

Boolean  SGroup_ForEachAllOrAnyEx( SGroupID sgroup, Boolean all, LuaBinding::StackVarFunction f, Boolean spawned, Boolean despawned )
 

Same as SGroup_ForEachAllOrAny except you have a choice to iterate over spawned squads, despawned squads, or both. 

 

Boolean  SGroup_ForEachEx( SGroupID sgroup, LuaBinding::StackVarFunction f, Boolean spawned, Boolean despawned )
 

Same as SGroup_ForEach except you have a choice to iterate over spawned squads, despawned squads, or both. 

 

SGroupID  SGroup_FromName( String name )
 

Find an squadron group with a given name. 

 

Real  SGroup_GetAvgHealth( SGroupID sgroup )
 

Returns the average health of all units in a squad group. 

It now uses the same health measure that's used by the UI, so it does take into account fallen members of a squad

 

Real  SGroup_GetAvgLoadout( SGroup sgroup )
 

Returns the average loadout of all squads in a group as a percent [0.0, 1.0]. 

Example: A group of squads with loadouts of 4/8 and 1/1 would return 0.75

 

SquadID  SGroup_GetDeSpawnedSquadAt( SGroupID group, Real index )
 

Returns the despawned squad at a certain position in the group. 

This is a one-based index (use index 1 to get the first squad in the group.) It is an error if index > SGroup_GetDeSpawnedCount().

 

EntityID  SGroup_GetGarrisonedBuildingEntity( SGroupID groupid )
 

Get the entity id of the building that any squad of the sgroup is garrisoned in 

 

Void  SGroup_GetHoldEGroup( SGroupID sgroup, EGroup EGroupHold )
 

Gets all the entities that an SGroup may occupy and adds them to the EGroupHold 

 

Void  SGroup_GetHoldSGroup( SGroupID sgroup, SGroup SGroupHold )
 

Gets all the squads that an SGroup may occupy and adds them to the SGroupHold 

 

Boolean  SGroup_GetInvulnerable( SGroupID sgroup, Boolean all )
 

Check invulnerablity state for ALL or ANY squads in a squad group. 

Set all param to true to check for ALL or set to false to check for ANY.

 

Void  SGroup_GetLastAttacker( SGroup SGroupVictim, SGroup SGroupAttacker )
 

Gets the last attacker(s) for all the squads in an SGroup Gets the last attacker for all the squads in an SGroup and stores that in SGroupAttacker 

 

SquadID  SGroup_GetLoadedVehicleSquad( SGroupID groupid )
 

Get the squad id of the vehicle squad that any squad of the sgroup is loaded in 

 

String  SGroup_GetName( SGroupID sgroup )
 

Returns the name of a given squad group. 

 

Int  SGroup_GetNumSlotItem( SGroupID group, Int itemID )
 

Get the number of slot items with the same ID that the squads in the sgroup own 

 

Position  SGroup_GetOffsetPosition( SGroupID sgroup, Real offset, Real value )
 

Returns a position (a certain distance away) relative to a squad's current position/orientation. see LuaConsts.scar for explanation of 'offset' parameter 

 

Position  SGroup_GetPosition( SGroupID group )
 

Returns the center position of a squad group. 

Despawned squads are ignored.

 

SquadID  SGroup_GetRandomSpawnedSquad( SGroup sgroupid )
 

Get a random spawned squad from sgroup 

 

Table  SGroup_GetSequence( String name )
 

Builds a table of SGroupIDs that are named in a sequence. i.e. a name of "sg_killer" will find groups "sg_killer1", "sg_killer2" and so on, up until it looks for a group that isn't there. 

 

SquadID  SGroup_GetSpawnedSquadAt( SGroupID group, Real index )
 

Returns the spawned squad at a certain position in the group. 

This is a one-based index (use index 1 to get the first squad in the group.) It is an error if index > SGroup_GetSpawnedCount().

 

Real  SGroup_GetSpread( SGroupID sgroup )
 

Returns the distance from the centre of the group of the unit that furthest out.  

 

Void  SGroup_GetSquadsHeld( SGroupID sgroup, SGroupID sgroupRecipient )
 

Returns an sgroup containing all squads held by any squad in an sgroup 

 

Float  SGroup_GetSuppression( SGroupID groupid )
 

Get the suppression level for the first squad in the sgroup 

 

Float  SGroup_GetVeterancyExperience( SGroupID groupid )
 

Get the veterancy experience value for the first squad in the sgroup 

 

Int  SGroup_GetVeterancyRank( SGroupID groupid )
 

Get the veterancy rank for the first squad in the sgroup 

 

Boolean  SGroup_HasCritical( SGroupID group, CriticalID critical, Boolean all )
 

Returns true if ANY or ALL of the squads in the SGroup have the specified critical 

 

Boolean  SGroup_HasLeader( SGroupID sgroup, Boolean all )
 

Check if ALL or ANY squads in a sgroup have a leader 

Set all param to true to check for ALL or set to false to check for ANY.

 

Boolean  SGroup_HasTeamWeapon( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the squads in an SGroup are carrying some kind of team weapon 

 

Boolean  SGroup_HasUpgrade( SGroupID sgroup, UpgradeID upgrade, Boolean all )
 

Returns whether ANY or ALL squads in an SGroup have the specified upgrade 

 

Void  SGroup_Hide( SGroupID sgroup, Bool hide )
 

Hide or show all entities in all squads in an SGroup 

Bool should be true to hide, false to show

 

Void  SGroup_IncreaseVeterancyExperience( SGroupID groupid, Float experience[, Boolean silent, Boolean applyModifiers] )
 

Increase squad veterancy experience for all squads in the sgroup. Can do silent promotion (no sound/UI). Can skip modifiers, giving you direct control of experience gained. 

 

Void  SGroup_IncreaseVeterancyRank( SGroupID groupid[, Real numranks, Boolean silent] )
 

Increase squad veterancy rank for all squads in the sgroup. By default, increases rank by 1. Can do silent promotion (no sound/UI. ex: mass rank insrease at mission start) 

 

Void  SGroup_Intersection( SGroupID group, SGroupID grouptointersect )
 

Same as EGroup_Intersection. Note: You cannot mix squad groups and entity groups. 

Only squads that are in both groups will be added to 'group'.
The contents of 'grouptointersect' will not be changed.
Example: group = (1,2,3,4,5,6) grouptointersect = (2,4,6,8,10) --> group will now equal (2,4,6)

 

Boolean  SGroup_IsAttackMoving( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL squads in an SGroup are attack moving. 

 

Boolean  SGroup_IsCamouflaged( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the squads in an SGroup are camouflaged 

 

Boolean  SGroup_IsCapturing( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are capturing 

 

Boolean  SGroup_IsConstructingBuilding( SGroup sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are currently constructing a building. 

Set all to true to check for ALL or set to false to check for ANY

 

Boolean  SGroup_IsDoingAbility( SGroupID sgroupid, AbilityID ability, Boolean all )
 

Returns if ANY or ALL members of an SGroup are doing an ability 

 

Boolean  SGroup_IsDoingAttack( SGroupID sgroup, Boolean all, Float time )
 

Returns true if ALL or ANY squads are attacking within the time. 

 

Boolean  SGroup_IsDugIn( SGroupID group, Boolean all )
 

Returns true if ANY or ALL of the squads in the SGroup is dug in (or in the process of digging in) 

 

Boolean  SGroup_IsEmpty( SGroupID sgroup )
 

Returns true if a named squad group is empty 

 

Void  SGroup_IsHoldingAny( SGroupID sgroup )
 

Returns whether any entity in an SGroup has a hold on anything 

 

Boolean  SGroup_IsIdle( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are idle 

 

Real/Boolean  SGroup_IsInCover( SGroupID sgroup[, Boolean all] )
 

Returns the percentage of the SGroup members that are in cover. Alternatively, specify ANY or ALL as a second parameter to return true/false. 

 

Boolean  SGroup_IsInfiltrated( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are infiltrated 

 

Boolean  SGroup_IsInHoldEntity( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are garrisoned in an entity (building)  

 

Boolean  SGroup_IsInHoldSquad( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are garrisoned in a squad (transport vehicle)  

 

Boolean  SGroup_IsMoving( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL squads in an SGroup are moving. 

 

Bool  SGroup_IsOnScreen( PlayerID player, SGroupID group, Bool all[, Float percent] )
 

Returns true if ANY or ALL (use those keywords) of the squads in the group are present onscreen. You can pass in a percentage of the screen to check, so 0.8 would be a centered rectangle occupying 80% of the screen. 

 

Boolean  SGroup_IsPinned( SGroupID group, Boolean all )
 

Returns true if ANY or ALL of a group is pinned 

 

Boolean  SGroup_IsReinforcing( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are currently calling for reinforcments. 

Set all to true to check for ALL or set to false to check for ANY

 

Boolean  SGroup_IsRetreating( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the squads in an SGroup are currently retreating 

 

Boolean  SGroup_IsSettingDemolitions( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL squads are setting demolitions 

 

Boolean  SGroup_IsSuppressed( SGroupID group, Boolean all )
 

Returns true is ANY or ALL of a group is suppressed 

 

Boolean  SGroup_IsUnderAttack( SGroupID sgroup, Boolean all, Float time )
 

Returns true if ALL or ANY squads are under attack within the time. 

 

Bool  SGroup_IsUnderAttackByPlayer( SGroupID group, PlayerID attackerplayer, Float duration )
 

Check if the squads are attacked by the player 

 

Boolean  SGroup_IsUnderAttackFromDirection( SGroupID sgroup, Boolean all, Real offset, Float time )
 

Returns true if ALL or ANY squads are under attack from a direction within the time. see LuaConsts.scar for types of directions. you can pass in a table of directions 

 

Boolean  SGroup_IsUpgrading( SGroupID sgroup, UpgradeBlueprint blueprint, Boolean all )
 

Returns true if ALL or ANY squads in a group are currently upgrading. You can pass in nil for upgradeid if it doesn't matter what is being upgraded. 

Set all to true to check for ALL or set to false to check for ANY

 

Boolean  SGroup_IsUsingAbility( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are using an ability 

Does not check WHAT ability a squad is using.

 

Void  SGroup_Kill( SGroupID sgroup )
 

Kills all squads in an SGroup. This kills them 'naturally', as opposed to SGroup_DestroyAllSquads() which makes them blink out of existance. 

 

Void  SGroup_MergeFirstSquad( SGroup sgroupid1, SGroup sgroupid2 )
 

Merge first squads in the SGroups. The resulting squad will be in both SGroups 

Merging only works on squads with the same blueprint type. Squad loadout limit is ignored.

 

Void  SGroup_Remove( SGroupID group, SquadID squadron )
 

Removes an squadron from a group. 

 

Void  SGroup_RemoveGroup( SGroupID group, SGroupID grouptoremove )
 

Remove from the first SGroup all squads contained in the second SGroup. SGroup2 remains untouched. 

 

Void  SGroup_RemoveUpgrade( SGroupID sgroup, UpgradeBlueprint/Table upgrade )
 

Removes upgrade(s) from an sgroup 

 

Void  SGroup_ReSpawn( SGroupID groupid )
 

Respawn all despawned squads in a group. 

 

Void  SGroup_RestoreCombatPlans( SGroupID sgroupID )
 

Restore all current combat plans for the squads in the sgroup 

 

Void  SGroup_RewardActionPoints( SGroupID sgroup, Float actionpoint )
 

Give action points to the squad 

 

Void  SGroup_SetAnimatorState( SGroupID sgroupid, String stateMachineName, String stateName )
 

Set animation state of a state machine for an SGroup. Please only use this for simple animations 

 

Void  SGroup_SetAutoTargetting( SGroupID group, String hardpoint, Bool enable )
 

Sets whether a weapon to auto-target things or not 

 

Real  SGroup_SetAvgHealth( SGroupID sgroup, Real healthpercent )
 

Sets the health of each squad in a squad group to a given percent [0.0, 1.0]. 

 

Real  SGroup_SetAvgMorale( SGroup sgroup, Real moralepercent )
 

Sets the moral of each squad in a squad group to a given percent [0.0, 1.0]. 

 

Void  SGroup_SetCrushable( SGroupID sgroup, Boolean crushable )
 

Overrides crushable behavior for an sgroup 

 

Void  SGroup_SetInvulnerable( SGroupID sgroup, Boolean/Real enabled[, Float reset_time] )
 

Enable/Disable invulnerablity for an entire SGroup. Use true and false for simple on/off, or use a number between 0.0 and 1.0 for more precise control on how much damage a squad can take before it takes no more. 

The optional reset_time is used to automatically remove invulnerability after a set time. If invulnerable, both health and critical damage are disabled.

 

Void  SGroup_SetMoodMode( SGroupID group, Real mode )
 

Set soldier mood mode. Mode could be MM_Auto, MM_ForceCalm or MM_ForceTense 

 

Void  SGroup_SetMoveType( SGroupID group, MoveTypeBlueprint movetype )
 

Set the move type for an SGroup - find the move types in the MOVETYPE table in LuaConsts.scar 

 

Void  SGroup_SetPlayerOwner( SGroupID sgroup, PlayerID owner )
 

Changes the player owner of spawned and despawned squads in an SGroup. 

 

Void  SGroup_SetSelectable( SGroup sgroupid, bool selectable )
 

Set player selectable state of squads in the sgroup 

 

Void  SGroup_SetSharedProductionQueue( SGroupID egroup, Boolean enable )
 

Enables shared team production on a building (teammates can build using THEIR resources) 

 

Void  SGroup_SetSuppression( SGroupID groupid, Float suppression )
 

Set the suppression level for all squads in the sgroup 

 

Void  SGroup_SetTeamWeaponCapturable( SGroupID group, Boolean enable )
 

Set team weapon in the squads to be capturable or not 

 

Void  SGroup_SetWorldOwned( SGroupID sgroup )
 

Makes an sgroup neutral 

 

SGroupID  SGroup_Single( SGroupID groupID, squadID squad )
 

Creates a squad group containing a single squad 

Creates an SGroup containing just one squad, creating the group if it doesn't exist and clearing it if it does. It returns the name of the SGroup.

 

Void  SGroup_SnapFaceEachOther( SGroupID sgroup1, SGroupID sgroup2 )
 

Makes two SGroups face each other at no time 

 

SquadID  SGroup_SplitFirstSquad( SGroup sgroupid1, INT num )
 

Split first squad into a new squad with size "num" 

The new squad would not have any upgrads or modifiers from the original squad

 

Void  SGroup_SuggestPosture( SGroupID sgroup, unsigned posture, Real duration )
 

Suggests a posture to an SGroup, lasting the passed duration 

Posture of 0 is prone, 1 is kneel/crouch, and 2 is standing. Duration is in seconds, negative means indefinate.

 

Real  SGroup_TotalMembersCount( SGroupID sgroup )
 

Returns the total count of all members of all the squads in a given SGroup. 

 

Void  SGroup_WarpToMarker( SGroupID sgroup, MarkerID marker )
 

Warps all members of an SGroup immediately to a marker 

 

Void  SGroup_WarpToPos( SGroupID sgroup, Position pos )
 

Warps all members of an SGroup immediately to a new position 

 

Position  Squad_GetOffsetPosition( SquadID squad, Real offset, Real distance )
 

Returns a position relative to a squad's current position and orientation. see LuaConsts.scar for explanation of 'offset' parameter. 

 

Boolean  Squad_IsCamouflaged( SquadID squad )
 

Returns whether ANY entity in the squad is camouflaged 

 

Void  Squad_SetAnimatorState( SquadID squadid, String stateMachineName, String stateName )
 

Set animation state of a state machine for a squad Please only use this for simple animations 

 

 

 

Sound
Functions

Void  Sound_DisableSpeechEvent( Real event )
 

Disables certain speech events. 

 

Void  Sound_PreCacheSinglePlayerSpeech( String mission )
 

pre-caches single player speech. For instance pre-caching mission 1 speech is done like: Sound_PreCacheSinglePlayerSpeech( "mission01" ) 

 

Void  Speech_SetGlobalStealthRead( Real sunlightThreshold )
 

Overrides default stealth speech auto-detect mechanism. Stealth speech will play when sunlight brightness is below the threshold, with 0 being total darkness and 1 being full brightness. Set to -1 to use the default behavior. 

 

 

 

Squad
Functions

Void  SGroup_FacePosition( SGroupID sgroup, Position pos )
 

Works like Squad_FacePosition. All Squads will face the same direction, with the squad the closest to the center determining the direction. 

This function works on spawned squads only.

 

Void  SGroup_SnapFacePosition( SGroupID sgroup, Position pos )
 

Works like SGroup_FacePosition except with no interpolation. All Squads will face the same direction, with the squad the closest to the center determining the direction. 

This function works on spawned squads only.

 

Void  Squad_AddSlotItemToDropOnDeath( SquadID squad, SlotItemBlueprint pbg, Real dropChance, Boolean exclusive )
 

Add to the list of slot items to drop when this squad is wiped out 

Squad_AddSlotItemToDropOnDeath( squadid, item, false )

 

Boolean  Squad_CanCaptureStrategicPoint( SquadID squad, EntityID entity )
 

Returns true if squad can capture stategic point 

 

Boolean  Squad_CanCaptureTeamWeapon( SquadID pSquad, EntityID pEntity )
 

True if the squad can capture the entity sync weapon 

 

Boolean  Squad_CanHold( SquadID squad )
 

Checks whether a squad can hold any squad 

 

Boolean  Squad_CanInstantReinforceNow( SquadID squad )
 

Returns true if the squad is available to be reinforced 

 

Boolean  Squad_CanLoadSGroup( SquadID squad, SGroupID loadthis, Boolean bCheckSquadState, Boolean bOverload )
 

Checks whether a squad can load an entire sgroup 

 

Boolean  Squad_CanLoadSquad( SquadID squad, SquadID loadthis, Boolean bCheckSquadState, Boolean bOverload )
 

Checks whether a squad can load another squad 

 

Boolean  Squad_CanSeeEntity( SquadID squad, EntityID entity )
 

Returns true if a given entity is in the squads sight radius 

 

Boolean  Squad_CanSeeSquad( SquadID squad, SquadID target )
 

Returns true if a target squad is in the squads sight radius 

 

Void  Squad_ClearPostureSuggestion( SquadID squad )
 

Clears any previous posture suggestions made to a squad 

 

Real  Squad_Count( SquadID squad )
 

Returns the number of units currently in a squad (spawned AND despawned!!) 

 

SquadID  Squad_CreateAndSpawnToward( SquadBlueprint sbp, PlayerID player, Real loadoutCount, Position pos, Position toward )
 

Create a squad, spawn it and assign it to a player.  

This will create a squad of size 'loadoutCount' and of unit type 'unit_base' (from squad blueprint)
Note: loadoutCount will be clipped to loadoutMin and loadoutMax from the squad blueprint. A loudoutCount of zero means create the whole squad as is.

 

SquadID  Squad_CreateHeroAndSpawnToward( SquadBlueprint sbp, EntityBlueprint spawnerPBG, PlayerID player, Real loadoutCount, Position pos, Position toward )
 

Create a hero, spawn it and assign it to the player 

 

Void  Squad_DeSpawn( SquadID squad )
 

Despawn the entire squad at its current position. 

 

Void  Squad_Destroy( SquadID squad )
 

Remove an squad from the world and destroy it. 

 

Void  Squad_EnableProductionQueue( SquadID squad, Boolean enable )
 

Sets whether a squad can produce anything (including upgrades) 

 

Void  Squad_EnableSurprise( SquadID squad, Boolean enable )
 

Enables or disables the surprise feature on thie given squad 

 

Void  Squad_FacePosition( SquadID squad, Position pos )
 

Set the rotation of all troopers in a squad to face the position. 

The center of the squad will face the position and all other troops will use the same rotation as the from center vector.

This function works on spawned squads only.

 

Void  Squad_FaceSquad( SquadID squad1, SquadID squad2 )
 

Get 2 squads to face each other. This function works on spawned squads only. 

 

Position  Squad_FindCover( SquadID squad, Position pos, Real coverSearchRadius )
 

Tries to find cover within a certain radius of a position. If no cover is found, it returns the position used for the search. 

 

Position  Squad_FindCoverCompareCurrent( SquadID squad, Position pos, Real coverSearchRadius, Real maxPathDistanceFromGoal, Boolean compareToCurrentCover )
 

Tries to find cover within a certain radius of a position, traveling a max distance to get there, and possibly comparing against current position's cover. If no cover is found, it returns the position used for the search. 

 

SquadID  Squad_FromWorldID( Real id )
 

Get a squad from a mission editor ID. 

 

Real  Squad_GetActiveCommand( SquadID squad )
 

Returns the active squad command. Valid squad commands are SQUADSTATEID_Idle, SQUADSTATEID_Move, SQUADSTATEID_Stop, SQUADSTATEID_Combat, SQUADSTATEID_Capture, SQUADSTATEID_Ability, SQUADSTATEID_Construction, SQUADSTATEID_CombatStance, SQUADSTATEID_Load, SQUADSTATEID_Unload, SQUADSTATEID_HoldUnload, SQUADSTATEID_Retreat, SQUADSTATEID_WeaponTransition, SQUADSTATEID_AttackMove, SQUADSTATEID_CaptureTeamWeapon, SQUADSTATEID_Defuse, SQUADSTATEID_PlaceCharges, SQUADSTATEID_DefuseMine, SQUADSTATEID_PickUpSlotItem, SQUADSTATEID_Plan, SQUADSTATEID_Patrol, SQUADSTATEID_RevertFieldSupport. 

 

String  Squad_GetAttackPlan( SquadID squad )
 

Get name of current Squad AI attack plan 

 

Void  Squad_GetAttackTargets( SquadID squad, SGroupID group )
 

Find the squad member current or forced targets. If found, the targets squads are added to the sgroup. Entity targets like buildings are ignored 

 

String  Squad_GetBaseUnitName( SquadID squad )
 

Returns a string containing the base unit name for the current squadron 

 

SquadBlueprint  Squad_GetBlueprint( SquadID squad )
 

Returns the name of the squad blueprint (from the attribute editor) 

 

Position  Squad_GetDestination( SquadID squad )
 

Returns the squad's destination, if it's moving. IMPORTANT: you must only call this function if Squad_HasDestination has returned true. 

 

Real  Squad_GetGameID( SquadID squad )
 

Returns an Real containing the unqiue squad ID for this squad. 

 

Position  Squad_GetHeading( SquadID squad )
 

Returns the average heading of the spawned units in the squad. The heading is currently a lua table with three entries (x, y, z) 

 

Real  Squad_GetHealth( SquadID squad )
 

Returns the current health of a squad. 

The current health of the squad is the total health of each entity in that squad.

 

Real  Squad_GetHealthMax( SquadID squad )
 

Returns the max health of the squad. 

The max health of a squad is the max health of each entity in that squad. This means that the max health of a squad may change when entities are added or removed from the squad.

 

Real  Squad_GetHealthPercentage( SquadID squad )
 

Returns how much of an original squad's health is left, accounting for deaths (ex: a squad of 3 riflemen would be at 50% health, since they started with 6 members) Note: This is the same percentage that the UI uses. 

 

Real  Squad_GetHeroIDFromHeroSquad( SquadID p_Squad )
 

Get the hero id from a hero squad (-1 if not valid) 

 

EntityID  Squad_GetHoldEntity( SquadID squad )
 

Get which building (entity) is the squad garrisoned 

Please use Squad_IsInHold() to check first

 

SquadID  Squad_GetHoldSquad( SquadID squad )
 

Get which vehicle (squad) is the squad garrisoned 

Please use Squad_IsInHold() to check first

 

Bool  Squad_GetInvulnerable( SquadID squad )
 

Check if the squad is invulnerable or not 

 

Real  Squad_GetInvulnerableMinCap( SquadID squad )
 

Returns the highest invulnerable min cap percentage from members of the squad. 

 

Void  Squad_GetLastAttacker( SquadID squad, SGroupID group )
 

Find the last squad attacker on this squad. If found, the squad is added to the sgroup 

 

Void  Squad_GetLastAttackers( SquadID squad, SGroupID group, Real timeSeconds )
 

Find the squad attackers on this squad from the last seconds specified. If found, the squads are added to the sgroup. Building attackers are ignored 

 

Void  Squad_GetLastEntityAttacker( SquadID pSquad, EGroupID pEGroup )
 

Find the last entity attacker on this squad. If found, the entity added to egroup 

 

Real  Squad_GetMax( SquadID squad )
 

Returns the max number of units allowed in the squadron (from squad_loadout_ext) 

 

Real  Squad_GetNumSlotItem( SquadID squad, SlotItemBlueprint pbg )
 

Get the number of slot items with the same ID that the squad has 

Squad_GetNumSlotItem( squadid, item )

 

String  Squad_GetPinnedPlan( SquadID squad )
 

Get name of current Squad AI reaction plan 

 

PlayerID  Squad_GetPlayerOwner( SquadID squad )
 

Returns the Player owner of the given squad. Squad MUST NOT be owned by the world. 

 

Position  Squad_GetPosition( SquadID squad )
 

Returns the average position of the spawned units in the squad. The position is currently a lua table with three entries (x, y, z) 

 

Position  Squad_GetPositionDeSpawned( SquadID squad )
 

Returns the average position of the despawned AND spawned units in the squad. 

 

Blueprint  Squad_GetProductionQueueItem( SquadID squad, Real index )
 

Returns the blueprint for a production queue item with index. 

 

Real  Squad_GetProductionQueueItemType( SquadID squad, Real index )
 

Returns the production type (PITEM_Upgrade, PITEM_Spawn, PITEM_SquadUpgrade, PITEM_SquadReinforce, PITEM_PlayerUpgrade) for a production queue item with index. 

 

Real  Squad_GetProductionQueueSize( SquadID squad )
 

Returns the number of items in the squad's production queue. 

It is an error to call this function on a squad that does not have a production queue.
Use Squad_HasProductionQueue to check that the squad has a queue.

 

String  Squad_GetReactionPlan( SquadID squad )
 

Get name of current Squad AI reaction plan 

 

String  Squad_GetRetaliationPlan( SquadID squad )
 

Get name of current Squad AI retaliation plan 

 

Real  Squad_GetSlotItemAt( SquadID squad, Real index )
 

Returns the ID of the slot item. Use Squad_GetSlotItemCount to determine how many slot items the squad has. The first index is 1 

 

Real  Squad_GetSlotItemCount( SquadID squad )
 

Returns how many slot items this squad has 

 

LuaTable  Squad_GetSlotItemsTable( SquadID squadid )
 

Returns a table of SlotItem ID's that this squad currently owns 

 

Boolean  Squad_GetSquadsHeld( SquadID squad, SGroupID sgroup )
 

Adds all squads held by 'squad' to an sgroup 

 

Real  Squad_GetSuppression( SquadID squad )
 

Check current squad suppresion level. Return value from 0 to 1 

 

Real  Squad_GetVeterancyExperience( SquadID squad )
 

Get current squad veterancy experience 

 

Real  Squad_GetVeterancyRank( SquadID squad )
 

Get current squad veterancy rank. 

 

Void  Squad_GiveSlotItem( SquadID squad, SlotItemBlueprint pbg )
 

Gives a slot item to the squad. Can fail due to not enough slots left 

 

Void  Squad_GiveSlotItemsFromTable( SquadID squadid, LuaTable itemTable )
 

Gives all slot items in a table to the squad. The table should come from Squad_GetSlotItemsTable 

 

Boolean  Squad_HasActiveCommand( SquadID squad )
 

Returns true if there's an active command currently for the squad 

 

Bool  Squad_HasCritical( SquadID squad, CriticalID critical )
 

Check if a squad has a critical or not 

 

Boolean  Squad_HasDestination( SquadID squad )
 

Returns whether this squad is moving and has a destination 

 

Boolean  Squad_HasProductionQueue( SquadID squad )
 

Returns true if a squad has a production queue. 

 

Boolean  Squad_HasTeamWeapon( SquadID squad )
 

Returns true if the squad is carrying some kind of team weapon 

 

Boolean  Squad_HasUpgrade( SquadID squad, UpgradeBlueprint pbg )
 

Return true if the squad has purchased the specified upgrade. 

 

Void  Squad_IncreaseHeroLevel( SquadID squad, Real numLevels )
 

Increase the level of a hero squad 

 

Void  Squad_IncreaseVeterancyExperience( SquadID squad, Real experience, Boolean silent, Boolean applyModifiers )
 

Increase current squad veterancy experience 

 

Void  Squad_IncreaseVeterancyRank( SquadID squad, Real numranks, Boolean silent )
 

Increase current squad veterancy rank 

 

Void  Squad_InstantSetupTeamWeapon( SquadID squad )
 

Stops current squads activity and instant setup the team weapon if they have one 

 

Boolean  Squad_IsAttacking( SquadID squad, Real time )
 

Returns true if any unit in the squad is attacking within the time 

Time is in seconds

 

Boolean  Squad_IsDirectFireActive( SquadID squad )
 

Returns true if requested squad is in direct fire mode 

 

Boolean  Squad_IsDoingAbility( SquadID squad, AbilityBlueprint pbg )
 

True if squad is currently performing the given ability 

 

Boolean  Squad_IsVehicle( SquadID squad)
 

True if squad has a vehicle EBP as one of their entities.
This function is only available in CoH:EF

 

Boolean  Squad_IsHoldingAny( SquadID squad )
 

Check if the squad has a hold on anything (use this on vehicles) 

 

Boolean  Squad_IsInCover( SquadID squadId, Boolean all )
 

Returns true if ALL or ANY troopers in a squad are in cover. 

Set all to true to check if all troopers are in cover or set to false to check if any.

 

Boolean  Squad_IsInHoldEntity( SquadID squad )
 

Check if the squad is garrisoned in entity (building) 

 

Boolean  Squad_IsInHoldSquad( SquadID squad )
 

Check if the squad is loaded in squad (vehicle 

 

Boolean  Squad_IsMoving( SquadID squad )
 

Returns whether any entity in the squad is moving 

 

Boolean  Squad_IsPinned( SquadID squad )
 

True if squad is currently pinned 

 

Boolean  Squad_IsReinforcing( SquadID squad )
 

Returns true if the squad is currently reinforcing. This function will return false if the squad does not have a reinforce ext. 

 

Boolean  Squad_IsRetreating( SquadID squadid )
 

Returns true if the squad is currently retreating 

 

Boolean  Squad_IsSuppressed( SquadID squad )
 

True if squad is currently suppressed 

 

Boolean  Squad_IsUnderAttack( SquadID squad, Real time )
 

Returns true if any unit in the squad is under attack within the time 

Time is in seconds

 

Boolean  Squad_IsUnderAttackByPlayer( SquadID squad, PlayerID pAttackerOwner, Real time )
 

Returns true if squad is under attack by enemy from a particular player 

Time is in seconds

 

Boolean  Squad_IsUnderAttackFromDirection( SquadID squad, Real offset, Real timeSeconds )
 

Returns true if the squad was under attack from a certain direction (8 offset types, see LuaConsts.scar) 

 

Boolean  Squad_IsUpgrading( SquadID squad, UpgradeBlueprint upgrade )
 

Returns true if the squad is currently upgrading something specific. 

 

Boolean  Squad_IsUpgradingAny( SquadID squad )
 

Returns true if the squad is currently upgrading anything. 

 

Boolean  Squad_IsValid( Real id )
 

Check if a squad with the given ID can be found in the world 

 

Void  Squad_Kill( SquadID squad )
 

Kill whole squad. Sets health to 0, and triggers death effects. 

 

Void  Squad_Merge( SquadID dest, SquadID source )
 

Merge source squad into destination squad. 

The source squad will become invalid after the merge

 

Void  Squad_RemoveUpgrade( SquadID squad, UpgradeBlueprint upgrade )
 

Removes an upgrade from a squad 

 

Void  Squad_RewardActionPoints( SquadID squad, Real actionPoint )
 

Give squad action points 

 

Void  Squad_SetAttackPlan( SquadID squad, String planName )
 

Set overriding Squad AI attack plan  

 

Void  Squad_SetHealth( SquadID squad, Real healthPercent )
 

Set the health of all units in a squad. Health must be in range [0.0, 1.0] 

 

Void  Squad_SetInvulnerable( SquadID squad, Bool enable, Float reset_time )
 

Set invulnerability on the squad. Reset time is in seconds. If it it set, the invulnerability will expire after this time. 

 

Void  Squad_SetInvulnerableMinCap( SquadID squad, Real minHealthPercentage, Real resetTime )
 

Make a squad invulnerable to physical damage. 

resetTime is the time in seconds that vulnerability will be restored.; zero time for reset time means the buff will last forever

 

Void  Squad_SetMoodMode( SquadID squad, Real mode )
 

Set soldier mood mode. Can be MM_Auto, MM_ForceCalm and MM_ForceTense 

 

Void  Squad_SetMoveType( SquadID squad, MoveTypeBlueprint movetypePBG )
 

Sets the squad's move type 

 

Void  Squad_SetPinnedPlan( SquadID squad, String planName )
 

Set overriding Squad AI pinned plan 

 

Void  Squad_SetPlayerOwner( SquadID squad, PlayerID owner )
 

Changes the owner of the given squad. 

 

Void  Squad_SetPosition( SquadID squad, Position pos, Position toward )
 

Moves the squad to an arbitrary new position 

 

Void  Squad_SetReactionPlan( SquadID squad, String planName )
 

Set overriding Squad AI reaction plan 

 

Void  Squad_SetRetaliationPlan( SquadID squad, String planName )
 

Set overriding Squad AI idle retaliation plan 

 

Void  Squad_SetSharedProductionQueue( SquadID squad, Boolean shared )
 

Enables shared team production on a building (teammates can build using THEIR resources) 

 

Void  Squad_SetSuppression( SquadID squad, Real percentage )
 

Set current squad suppresion level. Suppression value value from 0 to 1 

 

Void  Squad_SetTeamWeaponCapturable( SquadID squad, Boolean capturable )
 

Set team weapon entity inside the squad to be capturable or not when it becomes neutral 

 

Void  Squad_SetWorldOwned( SquadID squad )
 

Makes a squad neutral 

 

Boolean  Squad_Spawn( SquadID squad, Position pos )
 

Spawn the entire squad at a given position 

 

Boolean  Squad_SpawnToward( SquadID squad, Position pos, Position toward )
 

Spawn the entire squad at a given position 

 

SquadID  Squad_Split( SquadID squad, Real num )
 

Split the squad into 2. The new squad size is specified by the number passed in 

The new squad size is specified by the number passed in.

 

Void  Squad_StopAbility( SquadID squad, AbilityBlueprint ability, Boolean bEarlyExit )
 

Abruptly stops an active ability 

 

Void  Squad_SuggestPosture( SquadID squad, unsigned posture, Real duration )
 

Suggests a posture to a squad, lasting the passed duration 

Posture of 0 is prone, 1 is kneel/crouch, and 2 is standing. Duration is in seconds, negative means indefinate.

 

Void  Squad_WarpToPos( SquadID squad, Position pos )
 

Warps a squad immediately to a new position 

 

 

 

State Machine
Functions

StateMachineId  StateMachine_AddTable( Table states )
 

Adds a table of states to the state machine table, and returns the state machine ID. 

 

String/Real  StateMachine_GetLastState( StateMachineId id )
 

Returns the last state that ran on the state machine. Can be checked while the current state is being executed. 

Type of return value depends on type of data being used to represent current state (recommended data type is string or Real)

 

String  StateMachine_GetState( StateMachineId id )
 

Returns the current state that the state machine is executing 

 

Void  StateMachine_RemoveAll( Void  )
 

Removes all currently running state machines. 

 

Void  StateMachine_RemoveTable( StateMachineId id )
 

Removes a set of states from the State Machine Manager. 

 

 

 

Stats
Functions

Real  Stats_BuildingsLost( PlayerID player )
 

Returns how many buildings a player has lost 

 

Real  Stats_EntitiesKilled( PlayerID player )
 

Returns how many entities a player has killed 

 

Real  Stats_InfantryLost( PlayerID player )
 

Returns how many infantry a player has lost 

 

Real  Stats_KillsTotal( PlayerID player )
 

Returns a player's total kills 

 

Real  Stats_PlayerAt( Real index )
 

Returns player id at given index 

 

Real  Stats_PlayerCount( Void  )
 

Returns how many players in the game 

 

ResourceAmount  Stats_ResGathered( PlayerID player )
 

Returns how many resources a player has gathered 

 

ResourceAmount  Stats_ResSpent( PlayerID player )
 

Returns how many resources a player has spent 

 

Real  Stats_SoldiersKilled( PlayerID player )
 

Returns how many soldiers a player has killed 

 

Real  Stats_StructuresKilled( PlayerID player )
 

Returns how many structures a player has killed 

 

Real  Stats_TeamTally( Real teamindex, Function statfunction )
 

Takes a statistic function and totals up the results for all the players on a given team 

 

Real  Stats_TotalDuration( Void  )
 

Returns game time, in seconds 

 

Real  Stats_TotalSquadsLost( PlayerID player )
 

Returns how many squads a playe has lost 

 

Real  Stats_UnitSoldierKills( PlayerID player, SquadBlueprint sbp )
 

Returns how many soldiers an SBP have killed. ex: how many soldiers did player2's riflemen kill? 

 

Real  Stats_UnitStructureKills( PlayerID player, SquadBlueprint sbp )
 

Returns how many structures an SBP have killed. ex: how many structures did player2's riflemen kill? 

 

Real  Stats_UnitTotalKills( PlayerID player, SquadBlueprint sbp )
 

Returns how many entities an SBP have killed. ex: how many entities did player2's riflemen kill? 

 

Real  Stats_UnitVehicleKills( PlayerID player, SquadBlueprint sbp )
 

Returns how many vehicles an SBP have killed. ex: how many vehicles did player2's riflemen kill? 

 

Real  Stats_VehiclesKilled( PlayerID player )
 

Returns how many vehicles a playe has killed 

 

Real  Stats_VehiclesLost( PlayerID player )
 

Returns how many vehicles a player has lost 

 

 

 

Stinger
Functions

Void  Stinger_AddEvent( PlayerID player, MarkerID marker, EVENT eventname )
 

Add a stinger to trigger at a specific location 

You must remember to set Stinger_Manager going as a rule with a regular interval

 

Void  Stinger_AddFunction( PlayerID player, MarkerID marker, LuaFunction functionname )
 

Add a stinger to trigger at a specific location 

You must remember to set Stinger_Manager going as a rule with a regular interval

 

Void  Stinger_Remove( PlayerID player, MarkerID marker )
 

Remove all stingers triggered from a specific location 

 

 

 

Tanks
Functions

Real  TankCombat_AddGroup( LuaTable SGroups, SGroup/EGroup/Position/Marker AttackTarget, [Position Retreat, Real RoleGroupId]) )
 

Adds a group of sgroups (that should be vehicles), that will attempt to attack the designated object -- returns id of tank group 

Optional RoleGroupID is the idea of group of roles that have already been defined that will be used instead of default roles.

Void  TankCombat_AddRole( Real RoleGroupID, Real OffsetDefault, Real OffsetDefense, Real OffsetRetreat, Real OffsetDistance, Real Role )
 

Adds an additional role to an already existing role group 

the RoleGroupId is an id generated by TankCombat_CreateRoleGroup function. OffsetDefault defines the position of the tank in relation to the center tank during non-combative movement. OffsetDefense defines the position of the tank in relation to the chosen TARGET when any of the tanks are under attack. OffsetRetreat defines the position of the tank in relation to the center tank when the tanks are retreating. OffsetDistance defines the distance that the tank should be from the center tank for all offsets.

Void  TankCombat_AddThreatArrows( Real TankCombatId, Table Blueprints )
 

Checks whether a group of tanks is retreating. 

Real  TankCombat_CreateRoleGroup( )
 

Creates a new Role Group which can be customized to determine the formation/position of the tanks in battle, and the number of tanks battling 

see documentation for more information: Need HTML Link here

Void  TankCombat_EnableFormUp( Real TankGroupId, Boolean enabled )
 

Enables or disables the ability for tanks within a group to occasionally ensure that they are in formation while moving. 

Void  TankCombat_EnableRetreat( Real TankGroupId, Boolean enabled )
 

Enables or disables the ability for the TankCombat manager to retreat its group 

Void  TankCombat_GetAttackTarget( Real TankCombatId )
 

Gets the attack target of an existing combat group. 

the TankCombatId is the id of the group of tanks

Boolean  TankCombat_GroupExists( Real TankCombatId )
 

Determines whether or not a TankCombat Group still exists  

A TankCombat group is removed when it reaches its target.

Boolean  TankCombat_IsRetreating( Real TankCombatId )
 

Checks whether a group of tanks is retreating. 

Void  TankCombat_RemoveAll( Void  )
 

Removes all groups from control of the Tank Combat Manager. 

Void  TankCombat_RemoveGroup( Real TankCombatId )
 

Removes a group from control of the Tank Combat Manager. 

Void  TankCombat_SetArrivalCallback( Real TankCombatId, Function FuncationName )
 

Calls the specified function when the tanks arrive at the location dictated by the AddGroup function 

Void  TankCombat_SetAttackTarget( Real TankCombatId, SGroup/EGroup/Marker/Position AttackTarget )
 

Sets the attack target of an existing combat group. 

the TankCombatId is the id of the group of tanks, AttackTarget is the object that the Tanks will attack.

Void  TankCombat_SetRetreatPercent( Real TankGroupId, Real value )
 

Sets the percent of health at which the group of tanks will retreat from battle 

Percent value must be a number between 0.0 and 1.0

Void  TankCombat_SetRetreatPos( Real TankCombatId, Position Retreat )
 

Sets the retreat position of an existing combat group. 

the TankCombatId is the id of the group of tanks, Retreat is the position that the Tanks will retreat to.

 

Void  TankCombat_SetThreats( LuaTable SBPs/SBP )
 

Sets the table of threats that the the Tank Combat Manager will use to determine which squads to attack while in combat 

The table of threats should contain a list of SBPs from first to last in order of priority (i.e. first item is highest priority)

 

 

 

Timer
Functions

Void  Timer_Add( Real timerID, Real period )
 

Add the amount of time to the specified timer 

 

Void  Timer_Advance( Real timerID, Real period )
 

Advances the timer by the specified amount of time 

 

Void  Timer_Display( Real timerID )
 

Display (in the console) the amount of time remaining in the specified timer. 

 

Void  Timer_DisplayOnScreen( Real timerID )
 

Displays a timer on the screen - You need to call this regularly (i.e. every second) to update the onscreen display. THIS IS A TEMPORARY FUNCTION - WELL GET PROPER UI SUPPORT LATER ON 

 

Void  Timer_End( Real timerID )
 

Stop the specified timer. 

 

Boolean  Timer_Exists( Real timerID )
 

Returns whether the timer with this ID exists 

 

Real  Timer_GetElapsed( Real timerID )
 

Returns how much time has elapsed since this timer has been started 

 

Void  Timer_GetMinutesAndSeconds( Luafunction getTimeFunction, Real TimerID )
 

Returns TWO values: minutes and seconds. Provide it a function like Timer_GetRemaining or Timer_GetElapsed 

 

Real  Timer_GetRemaining( Real timerID )
 

Get the remaining time for the specified timer. 

 

Void  Timer_Pause( Real timerID )
 

Pause the specified timer. 

 

Void  Timer_Resume( Real timerID )
 

Resume the specified timer. 

 

Void  Timer_Start( Real timerID, Real period )
 

Start a timer with the specified id, taking the required period ( in seconds ) 

 

 

 

UI
Functions

Real  Entity_GetKillCount( EntityID pEntity, Real killType )
 

Get the unit kill count for entities. Possible kill types are VS_Infantry, VS_LightArmor, VS_HeavyArmor, VS_Building 

 

Void  Entity_OverrideCriticalDisplay( EntityID entity, Real type, Boolean override, Boolean on )
 

Overrides whether to display a critical or not. types are: CT_VehicleFront, CT_VehicleBack, CT_VehicleLeft, CT_VehicleRight, CT_VehicleEngineGreen, CT_VehicleEngineYellow, CT_VehicleEngineRed, CT_VehiclePrimaryWeapon, CT_VehicleSecondaryWeapon 

 

event cue ID  EventCue_Create( CueStyleID style, LocString title, LocString description, Marker/Pos/EGroup/SGroup cameratarget[, LocString hintpointtext, LuaFunction function, Float lifetime, Boolean dismissOnClick] )
 

Creates an Event Cue message which automatically sends the camera to a specified point when clicked on.  

Can optionally create a 5-second hintpoint at the location when clicked on, and/or call a specified function for you, too. Both of these only activate the first time you click on the event cue to avoid stacking.

 

Void  FOW_Enable( Boolean enable )
 

Enables or disables the FOW, including out of bound areas and all entities on the map 

 

Void  Game_EndCurrentSpeech( Void  )
 

DEPRECATED 

Use Subtitle_EndCurrentSpeech

 

Real  Game_GetCinematicAspectRatio( Void  )
 

Returns the aspect ratio used when in cinematic mode. width / height 

 

PlayerID  Game_GetLocalPlayer( Void  )
 

Get the local player. (should only be used for UI purpose) 

 

Real  Game_GetMode( Void  )
 

Returns UIM_Normal, UIM_Fullscreen, or UIM_Cinematic 

 

Boolean  Game_HasLocalPlayer( Void  )
 

Determine if there is a valid local player. (UI only -- nondeterminstic) 

 

Boolean  Game_IsLetterboxed( Void  )
 

Returns true if the ui is in letterbox mode 

 

Void  Game_Letterbox( Boolean on, Real timeSecs )
 

Enters/Exits letterbox mode in amount of time specified by timeSecs. 

Letterbox mode disables input

 

Void  Game_PlaySpeech( String icon, Real locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean lockCursorToContinueButton, Boolean stickySubtitle, String additionalPath )
 

DEPRECATED 

Use Subtitle_PlaySpeech

 

Void  Game_PlaySquadSpeech( SquadID squad, String icon, Real locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean lockCursorToContinueButton, Boolean stickySubtitle, String additionalPath )
 

DEPRECATED 

Use Subtitle_PlaySquadSpeech

 

Void  Game_SetCinematicAspectRatio( Real ratio )
 

Sets the aspect ratio used when in cinematic mode. Expects width / height. 

 

Void  Game_SetLocalPlayer( PlayerID player )
 

Sets the local player. 

 

Void  Game_SetMode( Real mode )
 

Set the game screen mode 

UI_Normal is the regular screen with taskbar UI_Fullscreen is the mode without any 2D UI UI_Cinematic is the same as letter box mode

 

Void  Game_SetSelectionAlphaScale( Real alphaScale )
 

A scale value for selection circle alpha 

 

Void  Game_SkipAllEvents( Boolean bDeleteQueued )
 

Skips all events. Can either delete or skip queued events. 

 

Void  Game_SkipEvent( Void  )
 

Skips the currently playing event (and stops current sound) 

 

Void  Game_SubTextFade( LocString location, LocString time, LocString detail, Real in, Real lifetime, Real out )
 

Fade in and out two or three lines of subtext. 

This function has to support two lines, for backwards compatibility. The 'detail' line is therefore optional.

 

Void  Game_SubTextFadeEx( Real x, Real y, LocString text, Real in, Real lifetime, Real out, LuaBinding::StackVarTable textParams )
 

Shows a line of text on screen with specific text parameters 

 

Void  Game_UnlockInputOnLetterBox( Void  )
 

Unlocks user/camera input during letterbox. This should be used for debug only 

 

Void  Ghost_DisableSpotting( Void  )
 

Disable the spotting of enemy entities that may become ghosts in the FoW 

 

Void  Ghost_EnableSpotting( Void  )
 

Enable the spotting of enemy entities that may become ghosts in the FoW 

 

Void  HintMouseover_Add( LocString hintText, Marker/Position/Egroup/Sgroup hintTarget, Real targetRadius, Boolean looping )
 

Adds a Hint Point that will only appear on Mouseover of the target. 

 

Void  HintMouseover_Remove( LocString hintText, Marker/Egroup/Sgroup hintTarget )
 

Removes a Mouseover Hint Point from the managing function. 

 

HintPointID  HintPoint_Add( StackVar where, Boolean bVisible, LocString hintText[, number height] )
 

Creates a hintpoint attached to a Marker, EGroup, SGroup or position 

If range is set to 0, then the hintpoint is rangeless, see the design document for rangeless features.

 

Real  HintPoint_AddToAbilityButton( AbilityBlueprint ability, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to an ability button 

 

Real  HintPoint_AddToCommandButton( Real command, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a command button 

 

Real  HintPoint_AddToCommanderBranchUpgrade( UpgradeBlueprint pbg, LocString hint )
 

Adds a hintpoint to an upgrade on the company commander branch 

 

Real  HintPoint_AddToCommanderTreeUpgrade( UpgradeBlueprint pbg, LocString hint )
 

Adds a hintpoint to an upgrade on the company commander branch 

 

Real  HintPoint_AddToConstructionButton( EntityBlueprint ebp, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a construction button 

 

Real  HintPoint_AddToConstructionMenu( String menuName, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a construction menu 

 

Real  HintPoint_AddToEventCue( Real eventCueID, LocString hint, Boolean removeOnClick )
 

Adds a hintpoint to an event cue that was created from SCAR 

 

Real  HintPoint_AddToObjectiveIcon( Real objectiveID, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to an objective icon 

 

Real  HintPoint_AddToProductionButton( Real type, Blueprint pbg, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a production button 

 

Real  HintPoint_AddToProductionQueueItem( Real index, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to an item in the production queue 

 

Real  HintPoint_AddToSquadBadge( SquadID squad, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a squad's badge in the selection area, using the squad as the lookup 

 

Real  HintPoint_AddToSquadBadgeByIndex( Real displayIndex, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a squad's badge in the selection area, using the display index (from 0 to 9) as the lookup 

 

Real  HintPoint_AddToSquadControlGroup( Real controlGroupIndex, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to a squad control group (hotkey) 

 

Real  HintPoint_AddToTacticalMap( Position position, LocString hint )
 

Adds a hintpoint to the tactical map, in world coordinates. 

 

Real  HintPoint_AddToTaskbarBinding( String bindingName, LocString hint, Boolean removeOnClick )
 

Adds a taskbar hintpoint to any binding, provided its name 

 

Void  HintPoint_Remove( Real HintPointID )
 

Removes a hintpoint. 

 

Void  HintPoint_RemoveAll( Void  )
 

Removes all hintpoints. 

 

Void  HintPoint_SetDisplayOffset( Real hintpointID, Real x, Real y[, Real z] )
 

Sets a hintpoint's display offset, which is 3D for world hintpoints and 2D for taskbar binding hintpoints (ignore z) 

 

Void  HintPoint_SetVisible( Real HintPointID, Boolean bVisible )
 

Sets a hintpoint's visibility. Currently, FOW is not accounted for. 

 

Boolean  Misc_AreDefaultCommandsEnabled( Void  )
 

Returns the enabled/disabled state of the right-click command input. 

 

Void  Misc_DoWeaponHitEffectOnEntity( EntityID entity, Position pos, WeaponBlueprint weaponPBG, Boolean penetrated )
 

Do weapon hit effect on the entity from the view camera origin 

WeaponID is the property bag group id; if penetrated is set to false, deflection effect would be played instead

 

Void  Misc_DoWeaponHitEffectOnPosition( Position pos, WeaponBlueprint weaponPBG, Boolean penetrated )
 

Do weapon hit effect on the ground 

WeaponID is the property bag group id; if penetrated is set to false, deflection effect would be played instead

 

Void  Misc_GetAllPlayerEntitiesOnScreen( PlayerID player, EGroupID egroup )
 

Returns the list of all entities that's not part of a squad from the player on the screen 

 

Void  Misc_GetAllPlayerSquadsOnScreen( PlayerID player, SGroupID sgroup )
 

Returns the list of all squads from the player on screen 

 

Void  Misc_GetControlGroupContents( Real groupIndex, SGroupID squads, EGroupID nonSquadEntities )
 

Returns contents of a control group (0 to 9). Squads are put into an sgroup, and non-squad entities are put into an egroup. 

 

Real  Misc_GetEntityControlGroup( EntityID entity )
 

Returns the control group index that this entity belongs to, from 0 to 9, or -1 if none 

 

Position  Misc_GetHiddenPositionOnPath( Real checkType, Position origin, Position dest, EntityBlueprint ebp, Real stepDistance, Real cameraPadding, PlayerID FOWPlayer, Boolean debugDisplay )
 

Returns a hidden position on path from origin to destination. If there's none, it returns the origin position 

Possible check types are CheckHiddenFromCamera, CheckHiddenInFOW and CheckHiddenBothCameraFOW Camera check determined by the camera frustum. use cameraPadding to increase the area around the camera when doing the check FOW check requires a valid player ID passed in stepDistance is the interval along the path that the hidden points will be checked ( min is 1 metre ) If no hidden position is found, position ( 0, 0, 0 ) is returned Don't use this for multi-player SCAR script!!

 

Position  Misc_GetMouseOnTerrain( Void  )
 

Returns the world position of the mouse on the terrain 

 

EntityID  Misc_GetMouseOverEntity( Void  )
 

Returns the entity under the mouse (if any) 

 

Void  Misc_GetSelectedEntities( EGroupID group, Boolean subSelection )
 

Clears a given egroup and adds the current selection to the group 

 

Void  Misc_GetSelectedSquads( SGroupID group, Boolean subSelection )
 

Clears a given sgroup and adds the current selection to the group 

 

Real  Misc_GetSquadControlGroup( SquadID squad )
 

Returns the control group index that this squad belongs to, from 0 to 9, or -1 if none 

 

Real  Misc_GetTerrainHeight( Position p )
 

Returns the terrain height at the top-down co-ordinate specified (for terrain entities can walk on only) 

 

Boolean  Misc_IsEGroupSelected( EGroupID egroup, Boolean all )
 

Returns true if ANY or ALL of the EGroup is selected 

 

Boolean  Misc_IsEntityOnScreen( EntityID entity, Real pct )
 

Check if the entity is on screen currently 

 

Boolean  Misc_IsEntitySelected( EntityID entity )
 

Returns true if an entity is currently selected 

 

Boolean  Misc_IsMouseOverEntity( Void  )
 

Returns true if the mouse is over an entity 

 

Boolean  Misc_IsSelectionInputEnabled( Void  )
 

Returns the enabled/disabled state of the selection input. 

 

Boolean  Misc_IsSGroupSelected( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the SGroup is selected 

 

Boolean  Misc_IsSquadOnScreen( SquadID squad, Real pct )
 

Check if the squad is on screen currently 

 

Boolean  Misc_IsSquadSelected( SquadID squad )
 

Returns true if a squad is currently selected 

 

Void  Misc_RemoveCommandRestriction( Void  )
 

Can issue commands anywhere 

 

Void  Misc_RestrictCommandsToMarker( MarkerID marker )
 

Can only issue commands inside this marker 

 

Void  Misc_SelectEntity( EntityID pEntity )
 

Select the entity as if you had clicked it. 

 

Void  Misc_SelectSquad( SquadID squad, Boolean bSelected )
 

Add or remove squad members from the current selection 

 

Void  Misc_SetDefaultCommandsEnabled( Boolean enabled )
 

Enables / Disables right-click command input. 

 

Boolean  Misc_SetEntityControlGroup( EntityID entity, Real groupIndex )
 

Makes a squad belong to a specific control group. If it already belongs to another control group, it's removed from that one before being added to the new one. 

 

Void  Misc_SetSelectionInputEnabled( Boolean enabled )
 

Enables / Disables selection input. 

 

Boolean  Misc_SetSquadControlGroup( SquadID squad, Real groupIndex )
 

Makes a squad belong to a specific control group. If it already belongs to another control group, it's removed from that one before being added to the new one. 

 

Void  Misc_ToggleEntities( Void  )
 

Hide all world entities for NIS performance debugging 

 

Void  NIS_PlaySpeech( Real locID, Real speechTime )
 

Plays subtitle during NISes. 

 

Void  SitRep_PlaySpeech( String icon, Real locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath )
 

Plays a global speech with subtitle and actor icon in the overlay 

please make sure that the the speech file is 2D

 

Real  Squad_GetKillCount( SquadID pSquad, Real killType )
 

Get the unit kill count for squads. Possible kill types are VS_Infantry, VS_LightArmor, VS_HeavyArmor, VS_Building 

 

Void  Subtitle_EndCurrentSpeech( Void  )
 

Prematurely finish currently playing speech and advance the next one in queue 

This is useful for skipping speech events

 

Void  Subtitle_PlaySpeech( String icon, Real locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath )
 

Plays a global speech with subtitle and actor icon in the overlay 

please make sure that the the speech file is 2D

 

Void  Subtitle_PlaySpeechAt( Real locID, Real x, Real y, Boolean stickySubtitle, String additionalPath )
 

Plays a subtitle at a position on screen. 

please make sure that the the speech file is 2D

 

Void  Subtitle_PlaySquadSpeech( SquadID squad, String icon, Real locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath )
 

Plays 3D speech on one of guys in the squad with subtitle and actor icon in the overlay 

please make sure that the the speech file is 3D. Playing 2D sample will not work.

 

Void  Subtitle_UnstickCurrentSpeech( Void  )
 

Removes "sticky" state from currently playing speech (if any) 

 

Real  TacticalMap_AddArrow( Real objectiveID, Real fnType, Position from, Position to )
 

Add arrpw display to tactical map at specific vector. fnType are FN_OnShow, FN_OnSelect and FN_OnActivate 

This function should not be used inside a SitRep event!

 

Real  TacticalMap_AddMessage( Real objectiveID, Real fnType, Position pos, LocString message )
 

Add message display to tactical map at specific location. fnType are FN_OnShow, FN_OnSelect and FN_OnActivate 

This function should not be used inside a SitRep event! Use SitRep_AddMessage instead

 

blipID  TacticalMap_AddPing( StackVar where, Real lifetime, Real blipType )
 

Add pings to tactical map. 

Be careful to remove your ping if needed! The following blipTypes are available: BT_GeneralPing, BT_CombatPing, BT_FuelPing BT_MunitionsPing, BT_SelectionPing, BT_BuildingBoomPing, BT_AbilityPing, BT_ObjectivePrimary, BT_ObjectiveSecondary, BT_ObjectiveMedal, BT_AttackHerePing, BT_DefendHerePing, BT_CaptureHerePing,

 

Real  TacticalMap_AddPointer( Real objectiveID, Real fnType, Position to )
 

Add pointer to tactical map 

 

Void  TacticalMap_FlashTerritory( Real sectorID )
 

Makes a territory flash (overrides any other flashing behavior) 

 

Void  TacticalMap_RemoveElement( Real elementID )
 

Removes a tactical map element (created via the TacticalMap_Addxxx functions) 

 

Void  TacticalMap_StopFlashingTerritory( Real sectorID )
 

Returns a territory to default flashing behavior 

 

Boolean  Taskbar_IsVisible( Void  )
 

Returns whether the taskbar is visible 

 

Void  Taskbar_SetVisibility( Boolean visible )
 

sets taskbar visibility! 

 

Void  ThreatArrow_Add( Real GroupID, entity/squad/egroup/sgroup/position/marker Threat[, String icon] )
 

Adds a threat to an existing group 

 

Real (ID)  ThreatArrow_CreateGroup( variable!argument!list: threats )
 

Creates a group of threats that are represented by a single arrow. Threats can be entities, squads, egroups, sgroups, positions or markers 

 

Void  ThreatArrow_DestroyAllGroups( Void  )
 

Destroy all threat groups 

 

Void  ThreatArrow_DestroyGroup( Real GroupID )
 

Destroy a threat group 

 

Void  ThreatArrow_Remove( Real GroupID, entity/squad/egroup/sgroup/position/marker Threat )
 

Removes a threat from an existing group 

 

Void  UI_AddHintAndFlashAbility( PlayerID playerid, AbilityID abilityID, LocString text, Real length, [Table/Blueprint blueprint_filter] )
 

Creates and flashes an ability button on the taskbar if the unit is selected 

Length parameter determines how long to flash the item, and the blueprint filter is used if certain squad types need to be selected before flashing the button.

 

Void  UI_AlwaysFlashCompanyCommanderButton( Boolean alwaysFlash, Boolean stopWhenClicked )
 

If set to true, the button always flashes. If set to false, the default flashing behavior resumes. 

 

Void  UI_BindingSetEnabled( String binding, Boolean enabled )
 

Enables or disables a named segment of the taskbar. 

The binding name is a string set in taskbar.lua. If enabled is false, then the UI is not validated/or updated and should not appear onscreen. It can be turned back on if enabled is true.

 

Void  UI_ClearBuildingPlacementCallback( Void  )
 

Clears the building placement callback. 

 

Void  UI_ClearConstructionMenuCallback( Void  )
 

Clears the construction menu navigation callback. 

 

Void  UI_ClearEventCues( Void  )
 

Clears all active event cues 

 

Void  UI_ClearModalAbilityPhaseCallback( Void  )
 

Clears the ability phase callback 

 

Void  UI_ClearOptionOverride( String name )
 

Clears the override on an option. See LuaConsts.scar for list of available options. 

 

Void  UI_ClearSubmenuNavigationCallback( Void  )
 

Clears the submenu navigation callback. 

 

Void  UI_CoverPreviewHide( Void  )
 

Toggle off cover preview. Each call to UI_CoverPreviewHide must be matched by a call to UI_CoverPreviewShow 

 

Void  UI_CoverPreviewShow( Void  )
 

Toggle on cover preview. Each call to UI_CoverPreviewShow must be matched by a call to UI_CoverPreviewHide 

 

Void  UI_CreateColouredEntityKickerMessage( PlayerID player, EntityID entity, LocString message, Real red, Real green, Real blue, Real alpha )
 

Create a Coloured custom kicker message on the entity and display to the player, rgb values are 0-255

 

Void  UI_CreateColouredPositionKickerMessage( PlayerID player, Position position, LocString message, Real red, Real green, Real blue, Real alpha )
 

Create a custom coloured kicker message on position and display to the player, rgb values are 0-255 

 

Void  UI_CreateColouredSquadKickerMessage( PlayerID player, SquadID squad, LocString message, Real red, Real green, Real blue, Real alpha )
 

Create a coloured custom kicker message on the squad and display to the player, rgb values are 0-255 

 

Void  UI_CreateEntityKickerMessage( PlayerID player, EntityID entity, LocString message )
 

Create a custom kicker message on the entity and display to the player 

 

ID  UI_CreateEventCue( String iconPath, String soundPath, LocString title, LocString description[, Float lifetime, Boolean dismissOnClick] )
 

Creates an event cue without a callback (you won't know when it's clicked) 

 

Real  UI_CreateEventCueClickable( String iconPath, String soundPath, LocString title, LocString description, LuaFunction f, Real lifetime, Boolean dismissOnClick )
 

Creates a event cue with custom lua callback function when icon is clicked. Lifetime of -1 means use the default. The return value is an event cue ID. The callback receives one parameter: the ID of the event cue that was clicked. 

the lua function is executed when the event cue icon is pressed example: UI_CreateEventCueClickable( "event_cue_icons/icon_player_attacked", "General_alert", 42761, 42762, prt, -1 )

 

blipID  UI_CreateMinimapBlip( StackVar where, Real lifetime, Real blipType )
 

Creates a blip on the minimap; return the ID of the blip. 

'where' can be an entity, marker, position, egroup, sgroup, or squad. The following blipTypes are available: BT_GeneralPing, BT_CombatPing, BT_FuelPing BT_MunitionsPing, BT_SelectionPing, BT_BuildingBoomPing, BT_AbilityPing, BT_ObjectivePrimary, BT_ObjectiveSecondary, BT_ObjectiveMedal, BT_AttackHerePing, BT_DefendHerePing, BT_CaptureHerePing,

 

Void  UI_CreatePositionKickerMessage( PlayerID player, Position position, LocString message )
 

Create a custom kicker message on position and display to the player using default colour 

 

Void  UI_CreateSGroupKickerMessage( PlayerID player, SGroup sgroup, LocString message )
 

Create a custom kicker message on the squad and display to the player. 

 

Void  UI_CreateSquadKickerMessage( PlayerID player, SquadID squad, LocString message )
 

Create a custom kicker message on the squad and display to the player 

 

Void  UI_DeleteMinimapBlip( Real blipID )
 

Removes a blip already created on the minimap 

 

Void  UI_DisplayCommanderTreeSelect( Void  )
 

ForceDisplayCommandScreenSelect, if player hasn't already selected a commander tree 

 

Void  UI_EnableEntityMinimapIndicator( EntityID entity, Boolean enabled )
 

Turn on or off entity minimap indicator. The default is enabled 

 

Void  UI_EnableEventCueType( Real gameEventType, Boolean enable )
 

Enable or disable event cues of a game event type to be displayed in the UI 

Some examples of game event types are GE_ConstructionComplete, GE_BuildItemComplete, etc

 

Void  UI_EnableResourceTypeKicker( Real resourceType, Boolean enable )
 

Enables or disables resource kickers. Possible resource types are RT_Manpower, RT_Fuel, RT_Munition, RT_Action, RT_Command. 

 

Void  UI_EnableSquadDecorator( SquadID squad, Boolean enabled )
 

Turn on or off squad decorator. The default is decorator enabled 

 

Void  UI_EnableSquadMinimapIndicator( SquadID squad, Boolean enabled )
 

Turn on or off squad minimap indicator. The default is enabled 

 

Real  UI_FlashAbilityButton( AbilityBlueprint ability, Boolean bStopOnClick, Real blipType )
 

Begins flashing an ability widget. 

Flashes a taskbar binding associated with a specific ability ID.

 

Real  UI_FlashBinding( String name, Boolean bStopOnClick, Real blipType )
 

Begins flashing of a binding widget. 

Flashes a taskbar binding with the given name.

 

Real  UI_FlashCommandButton( Real command, Boolean bStopOnClick, Real blipType )
 

Flashes a command button associated with a particular squad command 

 

Real  UI_FlashCommanderBranchUpgrade( UpgradeBlueprint pbg, Real blipType )
 

Flashes one of the 6 upgrades on the commander branch 

 

Real  UI_FlashCommanderTreeUpgrade( UpgradeBlueprint pbg, Real blipType )
 

Flashes one of the 3 upgrades on the main commander tree 

 

Real  UI_FlashConstructionButton( EntityBlueprint ebp, Boolean bStopOnClick, Real blipType )
 

Flashes a construction button associated to a building EBP. 

 

Real  UI_FlashConstructionMenu( String menuName, Boolean bStopOnClick, Real blipType )
 

Flashes a construction menu. 

 

Void  UI_FlashEntity( EntityID entity, String actionOnName )
 

Flashes the entity using attributes from [tuning][ui] 

 

Real  UI_FlashEventCue( Real eventCueID, Boolean bStopOnClick, Real blipType )
 

Flashes an event cue icon 

 

Real  UI_FlashHeroButton( Real heroID, Boolean bStopOnClick, Real blipType )
 

Begins flashing a the actual hero button inside of the hero menu 

 

Real  UI_FlashHeroMenuButton( Boolean bStopOnClick, Real blipType )
 

Begins flashing a the hero menu button inside of the building that can build it 

 

Real  UI_FlashObjectiveCounter( Real objectiveID, Real blipType )
 

Flashes an objective counter 

 

Real  UI_FlashObjectiveIcon( Real objectiveID, Boolean bStopOnClick, Real blipType )
 

Flashes an objective icon 

 

Real  UI_FlashProductionButton( Real pType, Blueprint pbg, Boolean bStopOnClick, Real blipType )
 

Begins flashing a production widget. 

Flashes a taskbar binding associated with a production type and PBG id. Use PGB id of -1 if you only care about the production type. Type may be one of PITEM_Spawn, PITEM_SquadUpgrade, PITEM_Reinforce

 

Real  UI_FlashProductionQueueIcon( Real index, Boolean bStopOnClick, Real blipType )
 

Flashes a production queue item, from 0 to n. Be careful - the icon will continue to flash regardless of what's in that slot... 

 

Real  UI_FlashSquadBadge( SquadID squad, Boolean bStopOnClick, Real blipType )
 

Flashes a squad's badge in the selection area, using the squad as the lookup 

 

Real  UI_FlashSquadBadgeByIndex( Real displayIndex, Boolean bStopOnClick, Real blipType )
 

Flashes a squad's badge in the selection area, using the display index (from 0 to 9) as the lookup 

 

Real  UI_FlashSquadControlGroupIcon( Real controlGroupIndex, Boolean bStopOnClick, Real blipType )
 

Flashes a squad control group icon. You can use Misc_GetSquadControlGroup to find out which group to flash. 

 

Real  UI_FlashTacticalMapWidget( String widgetName, Real blipType )
 

Flashes a widget on the tactical map 

 

Void  UI_ForceCommanderTreeChoice( PlayerID player, UpgradeBlueprint upg )
 

Picks a commander tree for the player. If he already picked one, does nothing. upg is the upgrade that unlocks the tree. requires tree is available in AE and upgrade is available 

 

Boolean  UI_GetDecoratorsEnabled( Void  )
 

Returns whether all decorators are enabled or not 

 

Boolean  UI_HasSelectedCommanderTree( Void  )
 

returns true if player has selected a commander tree 

 

Void  UI_HideSquadControlGroupBindings( Boolean hide )
 

Hides/unhides the squad control group UI on the right side of the screen 

 

Void  UI_HideTacticalMap( Void  )
 

Hides the tactical map 

 

Void  UI_HideTeamWeaponConeOfFire( Real id )
 

Removes a team weapon "cone of fire" UI. You got the ID from UI_ShowTeamWeaponConeOfFire 

 

Void  UI_HighlightSGroup( SGroupID sgroup, Real duration )
 

Highlights an SGroup in the UI for the given duration 

 

Void  UI_HighlightSquad( SquadID squad, Real duration )
 

Turn on squad highlight UI feature for the duration 

 

Boolean  UI_IsCommanderTreeBranchShown( Void  )
 

Returns whether a branch of the commander tree is up (once you've already selected an upgrade path) 

 

Boolean  UI_IsCommanderTreeShown( Void  )
 

Returns whether the main commander tree is up (where you select your upgrade path) 

 

Boolean  UI_IsTacticalMapShown( Void  )
 

Returns whether the tactical map is being shown 

 

Void  UI_MessageBoxHide( Real btn )
 

If the message box is activated, close it. The callback will receive the button parameter given. 

 

Void  UI_MessageBoxSetButton( Real btn, LocString text, LocString tooltip, Boolean bEnabled )
 

Set the text/tooltip/enabled state of a button on the dialog. 

 

Void  UI_MessageBoxSetText( LocString title, LocString msg )
 

Set the title and message body of the dialog. 

 

Void  UI_MessageBoxShow( LuaFunction f )
 

Show the message box. The callback will be called when deactivated, with the button that was pressed. 

 

Void  UI_RestrictBuildingPlacement( MarkerID mkr )
 

Only allow buildings to be placed inside a marker 

 

Void  UI_ScreenFade( Real r, Real g, Real b, Real a, Real duration, Boolean bKeepBlockingInput )
 

Fades the screen to a given RGBA colour over a number of seconds. mouse input is blocked during the fade, and you can control whether the input keeps being blocked after the fade has ended (be careful!) 

 

Void  UI_SetAlliedBandBoxSelection( Boolean allow )
 

Sets the game to allow allied squads to be selected at the same time as your own squads 

 

Void  UI_SetBuildingPlacementCallback( LuaFunction f )
 

Sets a function to be called when the player clicks a building on the taskbar and gets a selection UI. Your function will have 2 arguments: [Blueprint] building blueprint, [Real] phase: CP_Selected, CP_StartedPlacing (only applicable to fields, fences and buildings that let you set facing), or CP_FinishedPlacing  

 

Void  UI_SetConstructionMenuCallback( LuaFunction f )
 

Sets a function to be called when the player clicks a construction menu on the taskbar. Your function will have 2 arguments: [String] menu name, [Boolean] whether this menu is being activated (true) or deactivated (false) 

 

Void  UI_SetDecoratorsEnabled( Boolean enabled )
 

Enables or disables all decorators 

 

Void  UI_SetDisplayIngameScore( Boolean single, Boolean dual )
 

enables/disables single ingame score system 

 

Void  UI_SetModalAbilityPhaseCallback( LuaFunction f )
 

Sets a function to be called when the player clicks an ability and gets a targetting UI. Your function will have 2 arguments: [Blueprint] ability blueprint, [Real] phase: MAP_Placing, MAP_Facing (only if ability requires facing) or MAP_Confirmed 

 

Void  UI_SetOptionOverride( String name, Real value )
 

Overrides an option. See LuaConsts.scar for list of available options. 

 

Void  UI_SetScoreLeft( LocString title, LocString score )
 

sets dual score left value 

 

Void  UI_SetScoreRight( LocString title, LocString score )
 

sets dual score right value 

 

Void  UI_SetScoreSingle( LocString title, LocString score )
 

sets single score value 

 

Void  UI_SetSGroupSpecialLevel( SGroup sgroup, Int level )
 

Sets a level decorator that's defined in all of the squads squad_ui_ext in the target SGroup 

if level value is -1 it will hide the special decorator, if no level is defined -1 is default

 

Void  UI_SetSquadSpecialLevel( Squad *squad, Real level )
 

Sets Squads special level on thier decorator 

 

Void  UI_SetSubmenuNavigationCallback( LuaFunction f )
 

Sets a function to be called when the player clicks a submenu on the taskbar. Your function will have 2 arguments: [String] menu name, [Boolean] whether this menu is being activated (true) or deactivated (false) 

 

Void  UI_SetSubtitleBackgroundAlpha( Real alpha )
 

Sets the alpha value of the subtitle background. Value from 0 to 1 

 

Void  UI_ShowMinimapBlip( Boolean show )
 

 

 

Void  UI_ShowTacticalMap( Void  )
 

Shows the tactical map 

 

Real  UI_ShowTeamWeaponConeOfFire( SquadID squad )
 

Shows a team weapon's "cone of fire" UI. The position and orientation is not updated, so don't let this stay on screen for too long. Returns an ID for use with UI_HideTeamWeaponConeOfFire. 

 

Void  UI_StopFlashing( Real updaterID )
 

Stops a flash handler of a given id. 

If the given flash handler doesn't exist, then there is no effect.

 

Void  UI_StopFlashingCommanderBranchUpgrade( Real flashID )
 

Stops flashing one of the 6 commander branch upgrades 

 

Void  UI_StopFlashingCommanderTreeUpgrade( Real flashID )
 

Stops flashing one of the 3 commander tree upgrades 

 

Void  UI_StopFlashingTacticalMapWidget( Real id )
 

Stops flashing a widget on the tactical map 

 

Void  UI_SwapDisplayedCommanderTree( PlayerID player, String treeName, Real index )
 

Swaps a displayed commander tree for a given player 

 

Void  UI_TerritoryHide( Void  )
 

Toggle off territory lines. Each call to UI_TerritoryHide must be matched by a call to UI_TerritoryShow 

 

Void  UI_TerritoryShow( Void  )
 

Toggle on territory lines. Each call to UI_TerritoryShow must be matched by a call to UI_TerritoryHide 

 

Void  UI_ToggleDecorators( Void  )
 

Toggles all decorators on or off. 

 

Void  UI_UnrestrictBuildingPlacement( Void  )
 

Removes the restriction on building placement 

 

Void  UIWarning_Show( LocString locText )
 

Displays a breif UI warning in the critical alert message area. 

 

Void  WinWarning_Add( String name, PlayerID player, String icon, WString wWinConditionName, LocString wHelpTip )
 

Create win/lose warning. You can use the name to reference the warning later. 

String name - The name of the win warning. Each win warning needs a unique name so you have a way of changing its text at a later time.
PlayerID player - The player that this win warning applies to. This isnt used right now, but its good to have in case we want to make the text the same color as the player or something.
String icon - The name of the icon. Again, this is not used right now, but it may be in the future.
LocString wWinConditionName - This is a localized string containing the name of the win condition that this win warning applies to. This text is used for the title of the win warnings help tip.
LocString wHelpTip - This is a localized string containing the help tip description.

 

Boolean  WinWarning_Exists( String name )
 

Returns true if the named win warning exists. 

 

Void  WinWarning_PublishLoseReminder( PlayerID player, Real warningLevel )
 

Triggers a UI event cue and an audio cue that the player is about to lose the game. 

The lower the warningLevel, the closer the player is to losing and the more intense the warning is

 

Void  WinWarning_Remove( String name )
 

Removes an added win/lose warning 

 

Void  WinWarning_SetText( String name, LocString locText )
 

Set the text for a win warning. 

Designers: PLEASE be careful how you use this. Use Loc_FormatText where nesc. for localization.

 

 

 

Util
Functions

Boolean  Event_IsAnyRunning( [Real priority_threshold] )
 

Returns true if any event is currently running [at or below (more important than) the priority threshold. If not specified, ignores threshold.] 

 

Void  Game_EndSP( Boolean win[, LocString message, Boolean nis, Boolean sandmap] )
 

Ends the single player game (win/lose). You can optionally specify a message that will show up in the gameover dialog box 

 

Void  Game_FadeToBlack( Bool direction, Real length )
 

Fades the screen to black - FADE_OUT to fade to black, FADE_IN to fade back in 

 

LocString  Loc_FormatText( Real FormatID )
 

Returns a formatted localized string. 

Use this function to format localized text. ie %1PLAYERNAME% is going to win.

 

EGroup  Player_GetEntityConcentration( PlayerID player[, Boolean popcapOnly, Table includeBlueprints, Table excludeBlueprints, Boolean bLeastConcentrated, MarkerID/Table onlyInThisMarker] )
 

Finds the greatest (or least) concentration of entities owned by a player. 

This function is slow, so don't call it very often

 

SGroup  Player_GetSquadConcentration( PlayerID player[, Boolean popcapOnly, Table includeBlueprints, Table excludeBlueprints, Boolean bLeastConcentrated, MarkerID/Table onlyInThisMarker] )
 

Finds the greatest (or least) concentration of squads owned by a player. 

This function is slow, so don't call it very often

 

Void  Sound_PlayOnSquad( String soundpathname, SGroupID sgroupid )
 

Play sound on the first entity of the squad in sgroup 

 

SGroupID  Util_AddMouseoverSquadToSGroup( [Boolean clearGroup] )
 

If there's a squad under the mouse cursor, this adds it to a unique SGroup. Return value is the SGroup it was added to, or nil if there was no squad under the mouse cursor. Pass in true for 'clearGroup' to clear the sgroup before adding the squad. 

 

ModID  Util_ApplyModifier( SGroupID/EGroupID/Player groupid, String modifier, Real scalefactor, Real mathtype[, Real applytype, Bool exclusive, String targetname] )
 

Applies any modifier to the target SGroup, EGroup, or Player 

Valid applytypes are MAT_...(Entity, Squad etc.), if left default assumption is default type for the target Cases you want to define applytype: Weapon Modifiers, Enable Modifiers, or a player modifier for all entity or squad types Valid mathtypes are MUT...(Addition, Multiplication, etc.) Exclusive modifiers will replace all pre-existing modifiers of that modifier type on the target

 

Void  Util_AutoAmbient( Table intelEventTable )
 

Auto-generate an Ambient Event. These are Low priority, and will hopefully interrupt nothing. 

Takes a table of Actors and LOC numbers

 

Void  Util_AutoIntel( Table intelEventTable )
 

Auto-generate an Intel Event. These are medium priority, and will interrupt a Stinger, but not an NIS. 

Takes a table of parameters defining speaker(s) and line(s)

 

Void  Util_AutoNISlet( Real nisletType, Table intelEventTable, [boolean bFOWvisible] )
 

Auto-generate an NISlet Event, a simple NIS meant to convey mission location. These are high priority, and will interrupt a Stinger and Intel Events. 

Takes an NISLET type and a table of parameters defining speaker(s) and line(s) NISLET_BLACK2GAME = 1 -- starts in black and fades up, ends in gamplay NISLET_GAME2GAME = 2 -- transitions from game play to letterbox and backto gameplay NISLET_GAME2BLACK = 3 -- starts in gameplay and ends in black NISLET_GAME2LETTER = 4 -- starts in gameplay and ends in letterbox mode (for transition to sitrep) NISLET_TIME = 1 -- use seconds to wait on camera movements NISLET_VO = 2 -- use voice to wait on camera movements t_eventes.nislet_start = { {camPos = pos1, waitType = NISLET_TIME, waitValue = 5}, {camPos = pos2, waitType = NISLET_VO, waitValue = {ACTOR.GenericAlly, 000000}}, }

 

Void  Util_ClearWrecksFromMarker( MarkerID/Pos/SectorID position[, Real range] )
 

Clears any vehicle wrecks from a given area 

Area can be a marker (with or without a range override), a position and range combo, or a territory sector ID

 

Void  Util_DespawnAll( Boolean despawn, Boolean!allPlayers![or!Int playerNum], Boolean egroups )
 

ReSpawns or DeSpawns sgroups (and egroups) for all players or the indicated player. 

examples: Util_DespawnAll(true, true, false) or Util_DespawnAll(true, 1, false) or Util_DespawnAll(false, true, false)

 

Variable  Util_DifVar( Table difficultyVariables[, Real difficulty] )
 

Takes in a table and chooses the right variable for the difficulty setting. 1-4 elements. Acquires current difficulty by default. 

 

Boolean  Util_EntityLimit( [Real entityLimit] )
 

Checks the entity count for the world and returns true or false depending on the result. A specific value can be passed in to override the default amount. 

 

EntityID  Util_FallBackToGarrisonBuilding( SGroupID sgroupid, Int radius )
 

Try to garrison a loadable building within radius that is closer to the first squad of the sgroup than enemy 

The squad suppression would be resetted before fallling back so that they would not succumb to pinned state

 

EntityID  Util_GarrisonNearbyBuilding( SGroupID sgroup, Position pos, Real radius[, Boolean occupied, SGroup/Table filter] )
 

Finds a nearby building to garrison. can ignore occupied [friendly] buildings. return ID of entity it found, or nil if not found 

Can also filter out groups not to occupy

 

SquadID  Util_GarrisonNearbyVehicle( SGroupID sgroup, Position pos, Real radius[, Boolean occupied, SGroup/Table filter] )
 

Finds a nearby vehicle to garrison. can ignore occupied [friendly] vehicles. return ID of vehicle it found, or nil if not found, 

Can also filter out groups not to occupy

 

MarkerID  Util_GetClosestMarker( Variable var, Table markers )
 

Returns the closest MarkerID to the entity/marker/pos/egroup/sgroup/squad from the table of markers provided 

 

Boolean  Util_GetCommonwealthHQMobility( SGroupID group )
 

Gets the mobility of a commonwealth HQ - returns true if it's mobile, false if it's static 

 

Void  Util_GetEntitiesByBP( EGroupID sourcegroup, EGroupID destgroup, EntityBlueprint ebp )
 

Find all the entities with a given blueprint in sourcegroup and add them to destgroup. 

See also: EGroup_Filter()

 

Void  Util_GetMouseoverSGroup( Void  )
 

Returns a unique SGroup used to hold mouseover squads obtained from Util_AddMouseoverSquadToSGroup 

 

Position  Util_GetPosition( Variable var )
 

Returns a position from entity/marker/pos/egroup/sgroup/squad 

 

Position  Util_GetPositionFromAtoB( MarkerID/Pos a, MarkerID/Pos b, Real distance )
 

Returns a position that is distance metres from point A, headed in the direction of point B. 

You can also pass in a percentage (0.0 to 1.0) instead of a distance in metres.

 

Pos  Util_GetRandomPosition( MarkerID/ScarPos [, Real range] )
 

Returns a random position either within the marker's proximity or with a pos and range provided. Range is ignored for rectangular markers 

 

Void  Util_GetSquadsByBP( SGroupID sourcegroup, SGroupID destgroup, SquadBlueprint sbp )
 

Find all the squads with a given blueprint in sourcegroup and add them to destgroup. 

See also: SGroup_Filter()

 

Number  Util_GetTrailingNumber( String val )
 

Returns trailing numbers from a string, if it exists, nil otherwise. E.G. "marker23" would return 23. 

 

Void  Util_HidePlayerForNIS( PlayerID player, Bool hide )
 

Hides all of a player's squads and/or buildings 

Doesn't hide buildings a player is in, or any base structures. Only items like sandbags, tanktraps, mg nests, etc. Put multiple playerIDs in a table to hide many players together, or use ALL for the playerID to apply to all players at once.

 

void  Util_MarkerFX( String markername, String eventfile )
 

Play an events file at a given markers location 

 

Void  Util_MissionTitle( LocString title )
 

Play the mission title fade. 

 

Void  Util_MuteAmbientSound( Boolean enable, [Real fade] )
 

Enabling this function will mute the ambient sound (NOT all sound). 

 

Void  Util_PlayMusic( String name, Real fade, Real delay )
 

Plays music from the Data:Sound folder, and stores the music track so it can be resumed after a save/load 

 

Void  Util_PrintObject( Object obj[, Int max_depth, String data_type, Function print_func] )
 

Prints out the entire contents of an Object 

Objects can be anything (Player, SGroup, Int, Table, String, etc.), but this is most useful for Tables

 

Void  Util_ReinforceEvent( SGroupID sgroupName[, LocID custumTitle, LocID customDescript] )
 

Creates an Event Cue for an SGroup and repeats it until the SGroup is killed or selected. 

Additionally, a map ping and custome loc strings for the Title and Description can be used.

 

Void  Util_ReloadScript( Void  )
 

Reloads the running scar script. Current running rules would also be updated to the redefined functioin. 

 

Void  Util_RestoreMusic( )
 

Resumes playing the music track that was last triggered i.e. after a save/load 

 

Void  Util_SetCommonwealthHQMobility( SGroupID group, Boolean mobile[, Boolean instant] )
 

Sets the mobility of a commonwealth HQ. Can be done instantly (default) or with the progress bar as normal. 

 

Void  Util_SetStartingResources( Real missionNumber )
 

Trigger function immediately after the opening NIS to set starting resources for the player 

Features values for Easy, Normal, and Hard/Expert

 

Void  Util_StartAmbient( LuaFunction func )
 

Play a Speech Stinger. These are the lowest priority, and will be bumped by Intel Events or NIS's. 

This function should used instead of Event_Start because it handles priorities.

 

Void  Util_StartIntel( LuaFunction func )
 

Play an Intel Event. These are medium priority, and will interrupt a Stinger, but not an NIS. 

This function should used instead of Event_Start because it handles priorities.

 

Boolean  Util_TableContains( Table targetTable, Object obj )
 

Checks the first layer of a table and looks for a specified Object, returns true if found. 

Objects can be anything (Player, SGroup, Int, Table, String, etc.)

 

Void  Util_TriggerEvent( PlayerID playerid, Marker/EGroup/SGroup/ScarPos position, Int range, LuaFunction func, Boolean non_combat, Boolean onscreen_only, Int onscreen_duration )
 

Library function to trigger NIS event under a certain sets of conditions. NOTE: if checking against a marker DO NOT specify a range. The range of the marker set in the WorldBuilder will be used. 

onscreen_only set to TRUE means the squad must be onscreen if the event is to be triggered.

 

Void  Util_UMSAbilityRemove( )
 

Removes commander tree abilities from UMS maps in CoHo 

Use this to make sure that players don't have their commander tree abilities during a UMS in CoHo.

 

Lua Table  Util_UnitCounts( Boolean!world!OR!playerID player )
 

Returns a table containing either the total or a specific player's squad count, entity count, and vehicle count. 

table can be accessed as scene below Get Player Example:
local t = Util_UnitCounts(player1)
print(t.squad)
print(t.entity)
print(t.vehicle)
Get World Example:
local t = Util_UnitCounts(true)
print(t.squad)
print(t.entity)
print(t.vehicle)
Alternate Format:
print(Util_UnitCounts(true).squad)

 

Void  World_KillAllNeutralEntitesNearMarker( MarkerID marker )
 

Kills ALL world entities near a marker 

 

 

 

Various
Functions

Void  Anim_PlayEntityAnim( EntityID entity, String animname )
 

Plays an animation from an entity. 

This function can be called through a CTRL object in NISlets to wait on the animation.

 

AbilityBlueprint  BP_GetAbilityBlueprint( String pbgPath )
 

Returns an ability property bag group. 

 

CamouflageStanceBlueprint  BP_GetCamouflageStanceBlueprint( String pbgPath )
 

Returns a camouflage stance property bag group. 

 

CriticalBlueprint  BP_GetCriticalBlueprint( String pbgPath )
 

Returns a critical property bag group. 

 

DamageBlueprint  BP_GetDamageBlueprint( String pbgPath )
 

Returns a damage property bag group. 

 

MoveTypeBlueprint  BP_GetMoveTypeBlueprint( String pbgPath )
 

Returns a move type property bag group. 

 

SlotItemBlueprint  BP_GetSlotItemBlueprint( String pbgPath )
 

Returns a slot item property bag group. 

 

UpgradeBlueprint  BP_GetUpgradeBlueprint( String pbgPath )
 

Returns an upgrade property bag group. 

 

WeaponBlueprint  BP_GetWeaponBlueprint( String pbgPath )
 

Returns a weapon property bag group. 

 

Void  bug( ErrorMessage errormessage )
 

E-mails a warning out with logfiles at the end of the game. 

Example: bug( "This shouldn't happen, fix "..problem.here)

 

Void  EGroup_CallEntityFunction( EGroupID egroup, Function entityFunction, variable!argument list )
 

Calls an Entity_ function on every entity in an egroup 

The first parameter of the supplied function must be EntityID

 

Void  EGroup_CallEntityFunctionAllOrAny( EGroupID egroup, Boolean all, Function entityFunction, variable!argument list )
 

Returns whether ALL or ANY entities in an egroup satisfy a condition, using an Entity_ function to perform the query on each entity 

The first parameter of the supplied function must be EntityID

 

Void  FallBack_AddLocation( PlayerID player, String marker, Table markerlist )
 

Add a fallback location to the manager. 

Add a fallback location to the manager, where if the enemy get close enough to the spot, the units within the vicinity will automatically fall back to one of the locations listed.

 

Void  FallBack_RemoveDestination( PlayerID player, String destination )
 

Remove a destination from all fall backs for a player. 

Remove a destination from all fall backs listed for a particular player.

 

Void  FallBack_RemoveLocation( PlayerID player, String marker )
 

Remove a fallback location from the manager. 

Remove a fallback location from the manager.

 

Real  fatal( lua_State* state )
 

Throws an error to lua and print out the error message 

 

Void  Game_EnableInput( Boolean enabled )
 

Enables/Disables all input EXCEPT for ESC and F10. 

 

Real  Game_GetSPDifficulty( Void  )
 

Returns current single player difficulty. Values are GD_EASY, GD_NORMAL, GD_HARD, GD_EXPERT. 

 

Void  Game_HideSystemMessage( LocString msg )
 

Removes a message added by Game_ShowSystemMessage. 

 

Boolean  Game_IsRTM( Void  )
 

Use to test whether the game is running in RTM mode or not. Using -rtm from the command line will cause this function to also return true in non-RTM builds. 

 

Void  Game_LoadAtmosphere( String filename, Real transitionTime )
 

Transitions to another atmosphere. Overwrites current transitions. 

 

Void  Game_LockRandom( Void  )
 

If you are running something that is non-deterministic like a getlocalplayer conditional, you can lock the random to make sure no one down the callstack will throw the game random index out of sync and cause a sync error. REMEMBER TO UNLOCK WHEN YOU ARE DONE 

 

Void  Game_QuitApp( Void  )
 

Quits the app immediately 

 

Void  Game_ScreenFade( Real r, Real g, Real b, Real a, Real timeSecs )
 

Fades the screen to a given RGBA colour over a number of seconds 

 

Void  Game_ShowPauseMenu( Void  )
 

Brings up the pause menu. The game does not get paused until the end of the current sim tick, so anything that comes after Game_ShowPauseMenu in your function will still get executed, as well as any rules set to run during that frame. 

 

Void  Game_ShowSystemMessage( LocString msg )
 

Shows a system message in the area where Game Paused text appears/ 

Call Game_HideSystemMessage to remove the message.

 

Void  Game_TriggerLightning( Void  )
 

Triggers lightning on the next frame 

 

Void  Game_UnLockRandom( Void  )
 

unlock the random from a previous lockrandom call only 

 

Void  GarrisonManager_AddGroup( Real garrisonmin, Real abandonmin, Real searchradius, Real!regarrison ] )
 

Add a squad to the Building Manager. Will order them to garrison nearby buildings, take cover in a structure if they're under attack, move out of buildings to safer ones and generally act more intelligently 

EMPTY.

Void  GarrisonManager_RemoveGroup( SGroupID/EGroupID/SyncWeaponID gun )
 

Remove a squad from the garrison manager. 

Boolean  License_CanPlayRace( String raceName )
 

Returns whether the installed version of the game allows the player to play this race 

 

LocString  LOC( String text )
 

DEV ONLY: Converts ansi text to localized text. 

Your text will have to get localized properly at some point before final. When converting text with this function you will get LOC: prefixed to your text

 

LocString  Loc_ConvertNumber( Real number )
 

Returns a localized string containing the number. 

 

LocString  Loc_Empty( Void  )
 

Empty string. 

This will create an empty localized string.

 

LocString  Loc_FormatTime( Real secs, Boolean show_hours, Boolean leading_zeroes )
 

Returns a formatted time string. can omit hours and leading zeroes (for example, 4:57 instead of 00:04:57) 

 

Void  Misc_AbortToFE( Void  )
 

Abort straight out of the game to the frontend, without asking the user 

 

Boolean  Misc_AIControlLocalPlayer( Void  )
 

Let AI take over local player 

 

Boolean  Misc_DetectKeyboardInput( Void  )
 

Returns true if the app has had any keyboard input in the last second 

 

Boolean  Misc_DetectMouseInput( Void  )
 

Returns true if the app has had any mouse input in the last second 

 

Void  Misc_EnablePerformanceTest( Boolean toEnable )
 

Turn on or off the performance test monitoring 

 

String  Misc_GetCommandLineString( String option )
 

Returns the string argument for a command line option. ex: for "-init test.lua" it would return "test.lua" 

 

Boolean  Misc_IsCommandLineOptionSet( String option )
 

Returns true if -option is specified on the command line 

 

Boolean  Misc_IsDevMode( Void  )
 

Returns whether the game is running in dev mode. The rules for dev mode are a bit complicated between builds, so we cannot simply check the command line. 

 

Boolean  Misc_IsPosOnScreen( Position pos )
 

Check if position is on screen 

 

Void  Misc_SetDesignerSplatsVisibility( Boolean bVisible )
 

Shows or hides designer splats, which are splats in the UI folder 

 

Real  Modifier_ApplyToEntity( ScarModifier modifier, EntityID entity )
 

Applies an entity modifier to an entity. 

 

Real  Modifier_ApplyToPlayer( ScarModifier modifier, PlayerID player )
 

Applies a player modifier to a player. 

 

Real  Modifier_ApplyToSquad( ScarModifier modifier, SquadID squad )
 

Applies a squad modifier to a squad. 

 

ScarModifier  Modifier_Create( Real applicationType, String modtype, Real usageType, Boolean exclusive, Real value, LuaBinding::StackVar v )
 

Returns a modifier that you can apply to stuff. 

applicationType : MAT_EntityType, MAT_Entity, MAT_Player, MAT_Squad, MAT_SquadType, or MAT_Weapon.
modtype : Name of modifier from the modifiers table in the attribute editor.
usageType : MUT_Addition, MUT_Multiplication, MUT_MultiplyAdd or MUT_Enable.
exclusive : This field is not currently used for modifiers created through script.
value : The value for the modifier.
extname : The name of the entity/squad blueprint for when the applicationType is MAT_EntityType or MAT_SquadType.

 

Void  Modifier_Destroy( ScarModifier modifier )
 

Todo. 

 

Boolean  Modifier_IsEnabled( EntityID pEntity, String modtype, Boolean bEnabledByDefault )
 

Checks whether the modifier is enabled (requires an Entity and an Entity enable/disable modifier) 

 

Void  Obj_AlertSitRep( PlayerID player, Real id )
 

Create an on screen event cue to alert new sit rep 

 

Real  Obj_Create( PlayerID player, LocString title, LocString desc, String icon, Real type, MedalBlueprint medalPBG )
 

Create an objective and returns the unique ID for it 

type could either be OT_Primary, OT_Secondary or OT_Medal

 

Real  Obj_GetState( Real objectiveID )
 

Get objective state ( OS_Off, OS_Incomplete, OS_Complete, OS_Failed ) 

 

Boolean  Obj_GetVisible( Real objectiveID )
 

Get objective visibility 

 

Void  Obj_SetDescription( Real objectiveID, LocString desc )
 

Set description text localization ID for the objective 

 

Void  Obj_SetIcon( Real objectiveID, String icon )
 

Set icon path for the objective 

 

Void  Obj_SetObjectiveFunction( Real id, Real fnType, LuaFunction f )
 

Set callback functions for the objective.  

FN_OnActivate is for triggering situation report. FN_OnShow is used to assign UI element when tactical map is open. FN_OnSelect is used to assign UI element when the objective is highlighted

 

Void  Obj_SetState( Real objectiveID, Real state )
 

Set objective state ( OS_Off, OS_Incomplete, OS_Complete, OS_Failed ) 

 

Void  Obj_SetTitle( Real objectiveID, LocString title )
 

Set title text localization ID for the objective 

 

Void  Obj_SetVisible( Real objectiveID, Boolean visible )
 

Set objective visibility 

 

String  PlayerProfile_GetVar( String varname )
 

Retrieve a custom value in current player profile. Returns an empty string if value does not exist 

 

Void  PlayerProfile_SetVar( String varname, String value )
 

Save a custom value in current player profile. 

 

Void  PrintOnScreen( String text )
 

Prints a message on the screen 

Prints the given message on the screen. It will stay there until you call PrintOnScreen_RemoveFromScreen() or print another message on the screen to replace it.

 

Void  PrintOnScreen_RemoveFromScreen( )
 

Remove any messages from the screen 

Removes from the screen any messages put there with PrintOnScreen()

 

ResourceAmount  ResourceAmount_Add( ResourceAmount amt1, ResourceAmount amt2 )
 

Add each element of the two passed in ResourceAmounts together 

 

ResourceAmount  ResourceAmount_ClampToZero( ResourceAmount amt )
 

Clamps the passed in resource to zero if it has any negative numbers 

 

Boolean  ResourceAmount_Has( ResourceAmount amt1, ResourceAmount amt2 )
 

Returns true if the first amount has enough resources for the second amount (amt2) 

 

ResourceAmount  ResourceAmount_Mult( ResourceAmount amt1, Real mult )
 

Take a resource amount and multiply each value inside of it by mult 

 

ResourceAmount  ResourceAmount_Subtract( ResourceAmount amt1, ResourceAmount amt2 )
 

Subtract the second amount from the first and return the new ResourceAmount 

 

Real  ResourceAmount_Sum( ResourceAmount amt1 )
 

Add up all the numbers in the resource and return a single value 

 

ResourceAmount  ResourceAmount_Zero( Void  )
 

Creates a new ResourceAmount all set to zero 

 

Void  Scar_Autosave( LocString checkpoint )
 

Saves the game. the savegame name is built using the abbreviated mission name + checkpoint. 

 

Void  Scar_AwardMedal( MedalBlueprint medal )
 

Awards a medal to the current player. The campaign must be set up to allow that medal to be awarded during this mission, or you will get a fatal SCAR error. 

 

Void  Scar_DebugConsoleExecute( String command )
 

execute console command string. Will only work if dev mode is enabled! (it's OFF by default in RTM builds) 

 

Boolean  Scar_PlayerHasMedal( MedalBlueprint medal )
 

Returns whether the player has a medal that can be awarded during this mission. 

 

Void  Scar_PlayNIS( String filename )
 

Play NIS through SCAR. Should only be used inside a event function 

 

Void  Scar_PlayNIS2( String filename1, String filename2 )
 

Play 2 NISs through SCAR. Should only be used inside a event function 

 

Real  scartype( LuaBinding::StackVar v )
 

Returns ST_NIL,ST_BOOLEAN,ST_NUMBER,ST_STRING,ST_TABLE,ST_FUNCTION,ST_SCARPOS,ST_EGROUP,ST_ENTITY,ST_SGROUP,ST_SQUAD,ST_TEAM,ST_MARKER, ST_PBG, or ST_UNKNOWN 

 

String  scartype_tostring( LuaBinding::StackVar v )
 

Returns a string representing the scartype 

 

Real  Setup_GetVictoryPointTickerOption( Void  )
 

Get the victory point ticker option selected 

 

Void  Setup_SetPlayerName( PlayerID player, LocString name )
 

Set the UI name of a given player. 

 

Void  Setup_SetPlayerRace( PlayerID player, Real raceIndex )
 

Set the race for a given player. Use World_GetRaceIndex() to get the race index from the ME name. 

 

Void  Setup_SetPlayerTeam( PlayerID p, Real team_id )
 

Put a player in a team. Use TEAM_NEUTRAL as the team_id to set the player as neutral 

 

Void  SGroup_CallEntityFunction( SGroupID sgroup, Function entityFunction )
 

Calls an Entity_ function on every entity in an sgroup 

The first parameter of the supplied function must be EntityID

 

Void  SGroup_CallSquadFunction( SGroupID sgroup, Function squadFunction, variable!argument list )
 

Calls a Squad_ function on every squad in an sgroup 

The first parameter of the supplied function must be SquadID

 

Void  SGroup_CallSquadFunctionAllOrAny( SGroupID sgroup, Boolean all, Function squadFunction, variable!argument list )
 

Returns whether ALL or ANY squads in an sgroup satisfy a condition, using a Squad_ function to perform the query on each squad 

The first parameter of the supplied function must be SquadID

 

Void  Sound_ContainerDebug( Void  )
 

Turns container debugging on/off 

Example:

\Sound_ContainerDebug()

 

Real  Sound_Play2D( String name )
 

Plays a 2D sound from the Data:Sound folder. Use the path relative to Sound folder without the file extension. Returns handle to the sound container 

The sound needs to be 2D Example:

 Sound_Play( "Blah/Mysound" )

 

Real  Sound_Play3D( String name, EntityID actor )
 

Plays a 3D sound from the Data:Sound folder on the entity. Use the path relative to Sound folder without the file extension. Returns handle to the sound container 

The sound needs to be 3D Example:

 Sound_Play( "Speech/SpaceMarine/AddOnComplete", TheActor )

 

Void  Sound_PlayMusic( String name, Real fade, Real delay )
 

Plays music from the Data:Sound folder. 

The new music will phase out the old one. There can only be one music playing at anytime besides the transition fade is the time to fade in the music; delay is the time in seconds to wait until the new music is started Example:

 Sound_PlayMusic( "Music/GreatMusic", 0.0, 0.0 )

 

Real  Sound_PlayStreamed( String name )
 

Plays a streaming sound from the Data:Sound folder. Use the path relative to Sound folder without the file extension. Returns handle to the sound container 

The sound needs to be 2D Example:

 Sound_PlayStreamed( "Blah/Mysound" )

 

Void  Sound_PreCacheSound( String name )
 

pre-caches a sound 

Example:

 Sound_PreCacheSound("nis/m02_n01_full")

 

Void  Sound_SetGlobalControlSource( String name, Real value )
 

Sets the value for a global control source. 

Example:

\Sound_SetGlobalControlSource("GameType", 2)

 

Void  Sound_SetVolume( String name, Real volume, Real time )
 

Sets a new volume for the group. 

Example:

 Sound_Volume("Weapons", 0.5, 2)

 

Void  Sound_SetVolumeDefault( String name, Real time )
 

Sets the default volume for the group. 

Example:

 Sound_SetVolumeDefault("Weapons", 2)

 

Void  Sound_SetVolumeInv( String name, Real volume, Real time )
 

Sets the volume for all groups except the one specified. 

Example:

 Sound_VolumeInv("NIS", 0.5, 2)

 

Void  Sound_StartRecording( String name )
 

Starts recording the sound driver output 

Example:

 Sound_StartRecording("Recordings/MyRecording.wav")

 

Void  Sound_Stop( Real handle )
 

Stops sound associated with the container handle 

 

Void  Sound_StopMusic( Real fade, Real delay )
 

Stop current playing music 

Currently playing music would be stopped. If nothing is playing, nothing will happen fade is the time to fade out the music; delay is the time in seconds wait until the new music is stopped Example:

 Sound_StopMusic( "Music/GreatMusic", 0.0 )

 

Void  Sound_StopRecording( Void  )
 

Stops recording the sound driver output 

Example:

 Sound_StopRecording()

 

Boolean  SyncWeapon_CanAttackNow( SyncWeaponID weapon, egroup/sgroup/pos/marker target )
 

Checks whether a sync weapon can attack a target without moving or turning. 

 

Boolean  SyncWeapon_Exists( SyncWeaponID weapon )
 

Returns true if a sync weapon still exists in the game world 

 

EntityID  SyncWeapon_GetEntity( SyncWeaponID weapon )
 

Returns the EntityID of a sync weapon, or nil if it's been destroyed 

 

SyncWeaponID  SyncWeapon_GetFromEGroup( EGroupID egroup )
 

Registers the sync weapon in the egroup and returns a SyncWeaponID you can use to keep track of it 

 

SyncWeaponID  SyncWeapon_GetFromSGroup( SGroupID sgroup )
 

Registers the sync weapon in the sgroup and returns a SyncWeaponID you can use to keep track of it 

 

Position  SyncWeapon_GetPosition( SyncWeaponID weapon )
 

Returns the position of a sync weapon, or nil if it's been destroyed 

 

Boolean  SyncWeapon_IsAttacking( SyncWeaponID weapon, Real time )
 

Checks whether or not the actual sync weapon in a squad attacking. 

 

Boolean  SyncWeapon_IsOwnedByPlayer( SyncWeaponID weapon, [PlayerID player] )
 

Returns true if the specified player owns the sync weapon. Use a playerid of nil to see if it's unonwed. 

If player is not specified, then the code will check to see if the SyncWeapon is owned by the world.

 

Void  SyncWeapon_SetAutoTargetting( SyncWeaponID weapon, String hardpoint, Bool enable )
 

Sets whether a weapon to auto-target things or not 

 

Void  Team_CallPlayerFunction( TeamID team, Function playerFunction, variable!argument list )
 

Calls an existing Player_ function on every player on a team 

The first parameter of the supplied function must be PlayerID

 

Void  Team_CallPlayerFunctionAllOrAny( TeamID team, Boolean all, Function playerFunction, variable!argument list )
 

Returns whether ALL or ANY players on a team satisfy a condition, using a Player_ function to perform the query on each player 

restriction: the first parameter of the supplied function must be PlayerID

 

Void  Team_CallUIFunction( TeamID team, Function UI_Function, variable!argument list )
 

Calls a UI related function for the local player if he is on the team. NOTE: this is non-deterministic, so only use this for UI functions, otherwise your game may go out of sync (don't use this to spawn squads or anything affecting the simulation) 

will call EventCue_Create(CUE.ATTACKED, 123, 456, point) for the local player if he's on the allies team. In other words, every player on the team will see the event cue, but the enemies will not.

 

TeamID  Team_FindByRace( String race[, String race2 )
 

Returns the TeamID for a given race. See LuaConsts for constants to use. 

You can pass in multiple races, for example: allies and commonwealth.

 

Void  Team_ForEach( TeamID team, LuaFunction function )
 

Calls your function on each player on a team. Parameters of your function are: (TeamID, player index, PlayerID). You can return true to stop the loop 

 

Boolean  Team_ForEachAllOrAny( TeamID team, Boolean all, LuaFunction function )
 

Tests a condition on teams. Calls your function for each player. Parameters of your function: (TeamID, player index, PlayerID). Your function must return true or false to indicate whether the player meets the condition. 

 

TeamID  Team_GetEnemyTeam( TeamID team )
 

Returns a team's enemy 

 

Table  Team_GetPlayers( TeamID team )
 

Returns a table containing all the players on a team 

 

Boolean  Team_IsPlayerOnTeam( PlayerID player, TeamID team )
 

Returns whether a player is on that team 

 

Void  TutorialMenu_EnableResumeButton( Boolean enable )
 

Enables or disables the Resume button in the tutorial menu. Can be called at any time. 

 

Void  TutorialMenu_SetButtonInfo( Real index, Boolean enabled, LocString text, LocString tooltip, String icon, LuaFunction callback )
 

Sets up a button on the tutorial menu. 

 

Void  Util_CreateEntities( PlayerID player, EGroupID egroup, Real blueprintID, MarkerID/Pos location, Real numentities[, MarkerID/Pos toward] )
 

Creates a given number of entities at a location and adds them to an egroup. A PlayerID of nil will create the entities as world objects. 

 

Void  Util_CreateSquads( PlayerID player, SGroupID sgroup, SquadBlueprint/Table sbp, Marker/Pos/SGroup/EGroup spawn_point[, Position destination, Real numsquads, Real loadout, Boolean attackmove, Position dest_facing, UpgradeBlueprint/Table upgrades, Position spawn_facing] )
 

High level function to create squads and give them basic orders upon spawning. detailed explanation found in Confluence 

Position  Util_GetOffsetPosition( entity/squad/egroup/sgroup/marker/position pos, Real offset, Real distance )
 

Returns a position relative to a entity/squad/egroup/sgroup/marker/position's current position and orientation. see LuaConsts.scar for explanation of 'offset' parameter. 

 

PlayerID  Util_GetPlayerOwner( entity/squad/egroup/sgroup/player Object )
 

Returns the player owner for any of: entity, squad, egroup, sgroup, player. for groups, the first item is used. Returns nil for world owned or empty groups 

 

Real --> R_ENEMY, R_ALLY, R_NEUTRAL, R_UNDEFINED, or nil (if world owned or invalid parameters)  Util_GetRelationship( entity/squad/egroup/sgroup/player Object_1, entity/squad/egroup/sgroup/player Object_2 )
 

Gets the relationship between two of: entity, squad, egroup, sgroup, player. for groups, the first item is used. 

 

Void  Util_Paradrop( PlayerID player, SGroupID sgroup, StackVar blueprint, Position location, Real numsquads[, Real loadout] )
 

Paradrops in a given number of squads at a location and adds them to an sgroup. You can optionally also specify the loadout (it will default to the min loadout if left off)  

The squad is not created right away (it waits for the plane to be over the dropzone) so be careful using the sgroup right after calling this function.

 

Position, if y-height is nil, y-height = ground height, terrain ground or walkable  Util_ScarPos( Real xpos, Real zpos, Real ypos )
 

Converts a 2D top down position to a 3D ScarPosition. 

3D ScarPositions have the x axis left to right, the z axis in to out, and the y axis down to up (y axis represents the height of the terrain). Use this function to convert a top-down 2D position to a 3D world position.

Note: (0,0) is in the center of the map.

 

Void  Util_SetPlayerOwner( entity/squad/egroup/sgroup Object, PlayerID owner[, Boolean bApplyToSquadsHeld=true] )
 

Sets the player owner for an entity, squad, egroup or sgroup. Also sets player owner of whatever is garrisoned inside them 

 

Void  Util_SpawnGlider( PlayerID player, ScarEntityPBG gliderEBP, Position start, Position land[, SGroupID sgroup] )
 

Spawns a glider and puts the squads in an sgroup when they spawn 

 

Void  Util_StartNIS( String/Real/LuaFunction NIS[, LuaFunction onComplete, egroup/sgroup/Player/Table hide, LuaFunction preNIS, LuaFunction postNIS] )
 

Play an NIS. See confluence link below for more info. 

Void  VIS_OccCullToggleOBB( Void  )
 

toggle the visibility of occlusion culling OBB 

 

Boolean  WC_CheckOneTeamLeft( String win_condition )
 

If only one team is alive, players on that team win. Returns true if one team left. 

 

 

 

World
Functions

Void  Weather_SetType( String weatherLevelName )
 

changes the weather state of all objects (options: sunny,lightrain,mediumrain, heavyrain) 

 

Void  World_CleanUpTheDead( PlayerID player )
 

Kill off a specific player's dead bodies (enter ALL to clean them all up) 

 

Void  World_ClearCasualties( Void  )
 
 

LuaTable  World_CopyTable( LuaTable OriginalTable )
 

Copies the contents of the original table returns a new table with the contents of that table  

 

Void  World_DestroyWallsNearMarker( MarkerID marker )
 

Destroys walls (entities with a wall_ext) near a marker 

 

Real  World_DistanceEGroupToPoint( EGroupID egroup, Position p1, Boolean closest )
 

Get the distance between a squad group and a point. 

Pass in true for 3rd parameter to get the closest point and pass in false to get the furthest point. The closest/furthest point is calculated on a per entity basis. So the closest distance would be that of the closest entity.
Also note, it is an error to call this function with an empty group.

 

Real  World_DistancePointToPoint( Position p1, Position p2 )
 

Get the distance between two points. 

 

Real  World_DistanceSGroupToPoint( SGroupID sgroup, Position p1, Boolean closest )
 

Get the distance between a squad group and a point. 

Pass in true for 3rd parameter to get the closest point and pass in false to get the furthest point. The closest/furthest point is calculated on a per squadron basis. So the closest distance would be that of the closest squadron.
It is an error to call this function with an empty group. Check the group size with SquadGroup_Count( ) first.

 

Real  World_DistanceSquaredPointToPoint( Position p1, Position p2 )
 

Get the distance squared between two points. 

 

Void  World_EnablePlayerToPlayerFOW( PlayerID p0, PlayerID p1, Boolean enable )
 

Enables or disables the fog of war between these two players 

 

Void  World_EnableReplacementObjectForEmptyPlayers( Boolean enable )
 

*** You must call this from OnGameSetup, otherwise it's too late *** Determines whether empty players get converted to null resource points. 

see Attribute Editor under tuning/player/empty_player_replacement_object

 

Void  World_EndSP( Boolean win )
 

Wins/loses a single team mission for the local teams 

 

Variable  World_GetClosest( Variable var, LuaTable items )
 

Returns the closest object from the table of marker/pos/egroup/sgroup to the closest marker/pos/egroup/sgroup specified 

The table may mix together objects of different types.

 

Real  World_GetEntitiesNearMarker( PlayerID player, EGroupID egroup, MarkerID marker, Real ownerType )
 

Find and add entities near the marker to the egroup 

Entities belonging to a squad would not be added to the egroup

 

Real  World_GetEntitiesNearPoint( PlayerID player, EGroupID egroup, Position pos, Real radius, Real ownerType )
 

Find and add entities near the point to the egroup 

Entities belonging to a squad would not be added to the egroup

 

Real  World_GetEntitiesWithinTerritorySector( PlayerID player, EGroupID egroup, Real sectorID, Real ownerType )
 

Find and add entities within the territory sector to the egroup 

Entities belonging to a squad would not be added to the egroup

 

EntityID  World_GetEntity( Real index )
 

Returns the EntityID at given index, use with World_GetNumEntities() to iterate through all the entities in the world 

 

Variable  World_GetFurthest( Variable var, LuaTable items )
 

Returns the furthest object from the table of marker/pos/egroup/sgroup to the furthest marker/pos/egroup/sgroup specified. 

The table may mix together objects of different types.

 

Real  World_GetGameTime( Void  )
 

Return the total game time in seconds. 

 

Real  World_GetHeightAt( Real x, Real y )
 

returns the height of ground at 2D pos x,y 

 

Position  World_GetHiddenPositionOnPath( PlayerID player, MarkerID/Pos origin, MarkerID/Pos destination, Real checktype )
 

Find a position on a path hidden from view, as close to the destination as possible whilst still satisfying your hidden checktype. Checktype can be either CHECK_IN_FOW, CHECK_OFFCAMERA or CHECK_BOTH. 

The path is always calculated as if it were plain infantry. This function returns nil if it can't find a suitable position, so you can do a backup plan.

 

Real  World_GetLength( Void  )
 

Returns the total playable length of the game world (z coordinate) 

Since the center of the map is 0,0 the world z range is (-l/2 -> l/2)

 

Real  World_GetNeutralEntitiesNearMarker( EGroupID egroup, MarkerID marker )
 

Find and add neutral entities near the marker to the egroup 

Entities belonging to a squad would not be added to the egroup

 

Real  World_GetNeutralEntitiesNearPoint( EGroupID egroup, Position pos, Real radius )
 

Find and add neutral entities near the point to the egroup 

Entities belonging to a squad would not be added to the egroup

 

Real  World_GetNeutralEntitiesWithinTerritorySector( EGroupID egroup, Real sectorID )
 

Find and add neutral entities within the territory sector to the egroup 

Entities belonging to a squad would not be added to the egroup

 

Real  World_GetNumEntities( Void  )
 

Returns the number of spawned entities in the entire world (use sparingly and never at runtime) 

 

Real  World_GetNumEntitiesNearPoint( EntityBlueprint ebp, Position pos, Real radius )
 

Return the number of entities of the same ebp in the sphere volume 

 

Real  World_GetNumStrategicPoints( Void  )
 

Returns the number of strategic points on this map (does not count strat. objectives) 

 

Real  World_GetNumVictoryPoints( Void  )
 

Returns the number of strategic objectives on this map 

 

Position  World_GetOffsetPosition( Position position, Position heading, Real offset, Real distance )
 

Returns a position that is offset a certain distance from the position/heading passed in. see LuaConsts.scar for explanation of 'offset' parameter. 

 

PlayerID  World_GetPlayerAt( Real index )
 

- Returns the player at a given index, numbers start at one 

 

Real  World_GetPlayerCount( Void  )
 

Return the total number of players in the world 

 

Real  World_GetPlayerIndex( PlayerID player )
 

- Returns the player index given the Player* 

 

EntityBlueprint  World_GetPossibleBuildingsBlueprint( Real race_index, Real building_index )
 

Returns the blueprint of a chosen building for a race 

 

Real  World_GetPossibleBuildingsCount( Real race_index )
 

Returns the number of types of buildings a race can build 

 

SquadBlueprint  World_GetPossibleSquadsBlueprint( Real race_index, Real squad_index )
 

Returns the blueprint of a chosen squad for a race 

 

Real  World_GetPossibleSquadsCount( Real race_index )
 

Returns the number of types of squads a race can build 

 

Real  World_GetRaceIndex( String racename )
 

Returns the race index of a race, given its name (from the ME). 

Valid race names for COH are "allies" and "axis"

 

Real  World_GetRand( Real min, Real max )
 

Returns a random Real with range [min, max] 

It is recomended you use this instead of luas math.random function

 

Position  World_GetSpawnablePosition( Position around, EntityID entity )
 

Given any position in the world, this function will return position safe for spawning a given entity 

 

Real  World_GetSquadsNearMarker( PlayerID player, SGroupID sgroup, MarkerID marker, Real ownerType )
 

Find and add squads near the marker to the sgroup 

This function is faster if radius is small and/or number of squads to search for is large

 

Real  World_GetSquadsNearPoint( PlayerID player, SGroupID sgroup, Position pos, Real radius, Real ownerType )
 

Find and add squads near the point to the sgroup 

This function is faster if radius is small and/or number of squads to search for is large

 

Real  World_GetSquadsWithinTerritorySector( PlayerID player, SGroupID sgroup, Real sectorID, Real ownerType )
 

Find and add squads within territory sector identified by sector ID 

Owner type could be OT_Player, OT_Ally, OT_Enemy or OT_Neutral

 

Real  World_GetTeamsSuppliedTerritoryArea( Real team_index )
 

Returns the area in square meters of supplied territory this team has 

 

Real  World_GetTeamSuppliedTerritoryPercentage( Real team_index )
 

Returns the percentage (0-1) of supplied territory this team has 

 

Boolean  World_GetTeamTerritoryGaps( Real sectorid1, Real sectorid2, LuaBinding::StackVarTable results )
 

Returns one or more sector IDs that would connect two unconnected pieces of territory. return value is through a table (since there can be more than one way to connect territory) - each entry in this table is a table of sector IDs. 

Currently only finds single gaps - i.e. if two territories are 'almost' connected.

 

Real  World_GetTerritorySectorID( Position pos )
 

Return the sector ID from the position 

 

Position  World_GetTerritorySectorPosition( Real sectorID )
 

Returns the position of a sector based on the capture entity (ex: the fuel point's position) 

 

Real  World_GetWidth( Void  )
 

Returns the total playable width of the game world (x coordinate) 

Since the center of the map is 0,0 the world x range is (-w/2 -> w/2)

 

Boolean  World_IsGameOver( Void  )
 

- to document 

 

Boolean  World_IsInSupply( PlayerID player, Position pos )
 

Returns true if position is in-supply for the given player 

 

Boolean  World_IsPointInPlayerTerritory( PlayerID player, Position position )
 

Returns true if position if part of the entity territory 

Note that this does not care if territory is in supply or not

 

Boolean  World_IsTerritorySectorOwnedByPlayer( PlayerID player, Real sectorID )
 

Find if player has ownership to this territory sector. 

Other players on the same team would also have the ownership to the sector

 

Boolean  World_OwnsEGroup( EGroupID egroup, Boolean all )
 

Returns whether ANY or ALL of the entities in the group are owned by the world (i.e. neutral) 

 

Boolean  World_OwnsEntity( EntityID entity )
 

Returns true if the squad is owned by the world 

 

Boolean  World_OwnsSGroup( SGroupID sgroup, Boolean all )
 

Returns whether ANY or ALL of the squads in the group are owned by the world (i.e. neutral) 

 

Boolean  World_OwnsSquad( SquadID squad )
 

Returns true if the squad is owned by the world 

 

Boolean  World_PointPointProx( Position p1, Position p2, Real prox )
 

Returns true if two world positions are in proximity to each other 

 

Position  World_Pos( Real x, Real y, Real z )
 

Creates a new Position object. 

A position object is basically a table with an x, y, and z attribute. You can directly access the individual components in the same way that you would access a field in a table.

Example:
--* lua script snip
local pos = World_Pos(2, 0, 0)
pos.x = pos.x + 1
print pos.x -- this will print 3
--* lua script snip

 

Void  World_RemoveAllResourcePoints( Void  )
 

Removes all resource and strategic points but not entities with a supply ext NOTE: this could eventually be written as - RemoveAllOfType( type ) which would be more flexible. 

 

Void  World_SetDesignerSupply( Position point, Boolean bSupply )
 

Sets a particular sector in the world as a supply provider (or not) 

 

Void  World_SetGameOver( Void  )
 

- to document 

 

Void  World_SetPlayerLose( PlayerID player, String identifier, Boolean endgame )
 

Sets the player to a lose state, with a reason for losing, and kills the player 

 

Void  World_SetPlayerWin( PlayerID player, String identifier )
 

Sets the player and all the members allied to player to a win state, with a reason for winning. Also sets all other players to a lose state, and kills them (if they're not already dead) 

 

Void  World_SetTeamWin( Real team, String identifier )
 

Sets every player on a team to a win state, with a reason for winning. Also sets all other players to a lose state, and kills them (if they're not already dead) 

 

Boolean  World_TeamTerritoryPointsConnected( Real team_index, Position p1, Position p2 )
 

Returns true if the two points are in the same territory region, and owned by the specified territory team, Returns false otherwise.