Function List

AIInterface
Functions

Void  AI_ClearAllBudgetTotals( PlayerID pPlayer )
 

Clears all the resources for each budget and recalculate their values 

  Source: [LuaAI.cpp (647)]  

Void  AI_ClearAllBudgetWeight( PlayerID pPlayer )
 

Clears all the budget weights that have been previously added 

  Source: [LuaAI.cpp (628)]  

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" )

  Source: [LuaAI.cpp (668)]  

Void  AI_ClearBuildDemand( PlayerID pPlayer )
 

Clear the build demand table 

  Source: [LuaAI.cpp (170)]  

Void  AI_ClearClassPreference( PlayerID pPlayer )
 

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

  Source: [LuaAI.cpp (233)]  

Void  AI_ClearImportance( PlayerID pPlayer, EntityID pEntity )
 

This clears the importance override on this military point 

  Source: [LuaAI.cpp (362)]  

Void  AI_ClearProductionLimits( PlayerID pPlayer )
 

Clears all PBG limits that were previously set 

  Source: [LuaAI.cpp (465)]  

Void  AI_ClearTargetPlayer( PlayerID pPlayer )
 

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

  Source: [LuaAI.cpp (545)]  

Void  AI_DoString( PlayerID pPlayer, String s )
 

Run this string in the AI of player 

  Source: [LuaAI.cpp (110)]  

Void  AI_Enable( PlayerID pPlayer, Boolean enable )
 

Enables/Disables an AI player 

  Source: [LuaAI.cpp (77)]  

Void  AI_EnableAll( Boolean enable )
 

Enables/Disables all AI players 

  Source: [LuaAI.cpp (97)]  

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

Enables/disables a component of the AI 

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

  Source: [LuaAI.cpp (393)]  

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 

  Source: [LuaAI.cpp (559)]  

Boolean  AI_IsAIPlayer( PlayerID pPlayer )
 

Returns true if player is an AI player 

  Source: [LuaAI.cpp (122)]  

Boolean  AI_IsComponentEnabled( PlayerID pPlayer, Integer ct )
 

Enables/disables a component of the AI 

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

  Source: [LuaAI.cpp (425)]  

Boolean  AI_IsEnabled( PlayerID pPlayer )
 

Returns true if player is a AIPlayer and is enabled 

  Source: [LuaAI.cpp (87)]  

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 

  Source: [LuaAI.cpp (252)]  

Void  AI_LockSGroup( PlayerID ai_player, SGroup sgroup )
 

Lock an SGroup from the ai_player 

  Source: [CpuPlayerUtil.scar (31)]  

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 

  Source: [LuaAI.cpp (291)]  

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

  Source: [LuaAI.cpp (212)]  

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 )

  Source: [LuaAI.cpp (609)]  

Void  AI_SetBuildDemand( PlayerID pPlayer, Integer pbgID, Real start, Real increment )
 

Sets the demand for this squadasd 

  Source: [LuaAI.cpp (128)]  

Void  AI_SetBuildDemandPBG( PlayerID pPlayer, PropertyBagGroup pbg, Real start, Real increment )
 

Sets the demand for this squadasd 

  Source: [LuaAI.cpp (150)]  

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.UNIT_NAME1, 1, 5},
{SBP.UNIT_NAME2, 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

  Source: [CpuPlayerUtil.scar (20)]  

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

  Source: [LuaAI.cpp (190)]  

Void  AI_SetDifficulty( PlayerID pPlayer, Integer difficultyLevel )
 

Set the difficulty level of this AI player 

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

  Source: [LuaAI.cpp (480)]  

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

This overrides the default importance of the given military point 

  Source: [LuaAI.cpp (344)]  

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.UNIT_NAME1, PBGTYPE_Squad, 2},
{EBP.UNIT_NAME2, PBGTYPE_Entity, 0}
}
The first argument is the table is the PBG name, the second the PBG Type, and third: the number of those items the AI can build

  Source: [CpuPlayerUtil.scar (65)]  

Void  AI_SetProduductionLimits( PlayerID pPlayer, Integer pbgtype, Integer pbgID, Integer limit )
 

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

pbgtype has to be PBGTYPE_Squad, PBGTYPE_Entity, PBGTYPE_Upgrade

  Source: [LuaAI.cpp (447)]  

Void  AI_SetTargetPlayer( PlayerID pPlayer, Integer playerID )
 

Tells the AI to attack only the given player. 

  Source: [LuaAI.cpp (514)]  

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. 

  Source: [LuaAI.cpp (586)]  

Void  AI_UnlockAll( PlayerID pPlayer )
 

 

  Source: [LuaAI.cpp (330)]  

Void  AI_UnlockEntity( PlayerID pPlayer, EntityID pEntity )
 

Unlocks this entity so that AI can use it again 

  Source: [LuaAI.cpp (272)]  

Void  AI_UnlockSGroup( PlayerID ai_player, SGroup sgroup )
 

Unlock an SGroup from the ai_player 

  Source: [CpuPlayerUtil.scar (44)]  

Void  AI_UnlockSquad( PlayerID pPlayer, SquadID pSquad )
 

Unlocks the given squad so the AI can use it again 

  Source: [LuaAI.cpp (311)]  

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) 

  Source: [LuaAI.cpp (780)]  

 

 

Camera
Functions

Void  Camera_ClampToMarker( MarkerID marker )
 

Restricts the camera to a marker 

  Source: [LuaCamera.cpp (461)]  

Void  Camera_EnableDebugMode( Boolean enable )
 

Enables or disables debug camera mode 

  Source: [LuaCamera.cpp (379)]  

Void  Camera_GenerateCameraMesh( Real smoothRadius, Real maximizeRadiusReduction )
 

Generates a new camera mesh (for debug purposes only) 

  Source: [LuaCamera.cpp (206)]  

Real  Camera_GetGameplayCameraTuningValue( Integer tuningType )
 

Gets a gameplay camera tuning value. 

Returns 0 if tuningType isn't a valid tuning type. See Assets/Config/camera.lua for descriptions of what the different tuning types do. Acceptable tuning types are: CGTT_PanSpeed, CGTT_GrabPanSpeed, CGTT_PanAccelerationTime, CGTT_MouseZoomSpeed, CGTT_ScrollZoomSpeed, CGTT_MaximumZoomSpeed, CGTT_ZoomAccelerationTime, CGTT_DefaultDeclination, CGTT_MinimumDeclination, CGTT_MaximumDeclination, CGTT_DefaultOrbit, CGTT_PositionTransitionSpeed, CGTT_DefaultDistance, CGTT_MinimumDistance, CGTT_MaximumDistance, CGTT_DistanceExponent, CGTT_DistanceMultiplier, CGTT_FieldOfView, CGTT_NearClipDistance, CGTT_FarClipDistance

  Source: [LuaCamera.cpp (260)]  

Void  Camera_HideCameraMesh( Void  )
 

Hides the camera mesh (for debug purposes only) 

  Source: [LuaCamera.cpp (200)]  

Void  Camera_MoveToDefaultAngle( [Boolean smooth, Real!transitionSpeedOverride ] )
 

Moves the camera to its default viewing angle. The optional smooth flag should be true if you want the camera to smoothly transition to the new location. The optional transitionSpeedOverride can be set to override the speed that the camera will transition at for this transition only. 

Setting smooth to true will make the camera smoothly transition. Setting smooth to false will make the camera instantly snap

  Source: [Camera.scar (96)]  

Void  Camera_ResetAllGameplayCameraTuningValues( Void  )
 

Resets all gameplay camera tuning values to those specified in Assets/Config/camera.lua 

  Source: [LuaCamera.cpp (356)]  

Void  Camera_ResetAllGameplayCameraTuningValuesAndMoveToDefault( [Boolean smooth, Real!transitionSpeedOverride ] )
 

Resets the camera's tuning values to original defaults and moves it to the default position 

Setting smooth to true will make the camera smoothly transition. Setting smooth to false will make the camera instantly snap

  Source: [Camera.scar (32)]  

Void  Camera_ResetGameplayCameraTuningValue( Integer tuningType )
 

Resets a gameplay camera tuning value to the default specified in Assets/Config/camera.lua 

See Assets/Config/camera.lua for descriptions of what the different tuning types do. Acceptable tuning types are: CGTT_PanSpeed, CGTT_GrabPanSpeed, CGTT_PanAccelerationTime, CGTT_MouseZoomSpeed, CGTT_ScrollZoomSpeed, CGTT_MaximumZoomSpeed, CGTT_ZoomAccelerationTime, CGTT_DefaultDeclination, CGTT_MinimumDeclination, CGTT_MaximumDeclination, CGTT_DefaultOrbit, CGTT_PositionTransitionSpeed, CGTT_DefaultDistance, CGTT_MinimumDistance, CGTT_MaximumDistance, CGTT_DistanceExponent, CGTT_DistanceMultiplier, CGTT_FieldOfView, CGTT_NearClipDistance, CGTT_FarClipDistance

  Source: [LuaCamera.cpp (322)]  

Void  Camera_SetDebugDisplay( Boolean enable )
 

Enables or disables display of camera position, and other parameters 

  Source: [LuaCamera.cpp (428)]  

Void  Camera_SetGameplayCameraTuningValue( Integer tuningType, Real tuningValue )
 

Sets a gameplay camera tuning value. 

See Assets/Config/camera.lua for descriptions of what the different tuning types do. Acceptable tuning types are: CGTT_PanSpeed, CGTT_GrabPanSpeed, CGTT_PanAccelerationTime, CGTT_MouseZoomSpeed, CGTT_ScrollZoomSpeed, CGTT_MaximumZoomSpeed, CGTT_ZoomAccelerationTime, CGTT_DefaultDeclination, CGTT_MinimumDeclination, CGTT_MaximumDeclination, CGTT_DefaultOrbit, CGTT_PositionTransitionSpeed, CGTT_DefaultDistance, CGTT_MinimumDistance, CGTT_MaximumDistance, CGTT_DistanceExponent, CGTT_DistanceMultiplier, CGTT_FieldOfView, CGTT_NearClipDistance, CGTT_FarClipDistance

  Source: [LuaCamera.cpp (279)]  

Void  Camera_SetInputEnabled( Boolean enabled )
 

Enables / Disables camera input. 

  Source: [LuaUI.cpp (804)]  

Void  Camera_SetTarget( MarkerID/ScarPosition/SGroup/EGroup/Squad/Entity target[, Boolean smooth, Real transitionSpeedOverride, Boolean resetCameraAngleToDefault] )
 

Set the desired camera target. The optional pan flag should be true if you want the camera to smoothly pan to the new location. The optional transitionSpeedOverride can be set to override the speed that the camera will transition at for this transition only. The optional resetCameraAngleToDefault can be set to have the camera transition its viewing angle to the default orbit, declination and distance while moving to the new target. If target is an EGroup, then the camera will target the first spawned entity in the group. If target is an SGroup then the camera will target the first spawned squad in the group. 

  Source: [Camera.scar (43)]  

  Camera_SetTargetAndViewpoint( MarkerID/ScarPosition/SGroup/EGroup/Squad/Entity target, Real declination, Real orbit, Real distance[, Boolean smooth, Real transitionSpeedOverride] )
 

Executes a camera transition to a desired target, viewing angle and distance Setting smooth to true will make the camera smoothly transition. Setting smooth to false will make the camera instantly snap The optional transitionSpeedOverride can be set to override the speed that the camera will transition at for this transition only. If target is an EGroup, then the camera will target the first spawned entity in the group. If target is an SGroup then the camera will target the first spawned squad in the group. 

  Source: [Camera.scar (15)]  

Void  Camera_ShowCameraMeshInWorld( Void  )
 

Shows the camera mesh in the world (for debug purposes only) 

  Source: [LuaCamera.cpp (188)]  

Void  Camera_ShowCameraMeshOverWorld( Void  )
 

Shows the camera mesh over the world (for debug purposes only) 

  Source: [LuaCamera.cpp (194)]  

Void  Camera_ToggleDebugMode( Void  )
 

Enables or disables debug camera mode 

  Source: [LuaCamera.cpp (406)]  

Void  Camera_Unclamp( Void  )
 

Frees the camera (not clamped to a marker) 

  Source: [LuaCamera.cpp (511)]  

 

 

Campaign
Functions

String  Campaign_GetCurrentMissionMapPath( Void  )
 

Get the filepath to the map you are playing on 

  Source: [CampaignScar.cpp (496)]  

Integer  Campaign_GetDeployedLocationDeployCount( Void  )
 

How many times you've deployed to this location in the current campaign, ever 

  Source: [CampaignScar.cpp (543)]  

LuaBinding::StackVarTable  Campaign_GetDeployedMissionData( Void  )
 

Returns a table containing Campaign Mission information from the currently-deployed mission 

  Source: [CampaignScar.cpp (147)]  

Integer  Campaign_GetDeployedMissionLevelOffset( Void  )
 

Returns the current mission's level offset for generating enemies,  

  Source: [CampaignScar.cpp (559)]  

LuaBinding::StackVarTable  Campaign_GetDeployedMissionStratagems( Void  )
 

Returns a table containing all the Stratagems in the location the currently deployed mission is taking place on The owner property is set to OWNER_SELF, OWNER_NEUTRAL or OWNER_ENEMY, and is to be used to set the team alignment for the appropriate ebp instanced in the mission. 

  Source: [CampaignScar.cpp (300)]  

Integer  Campaign_GetDeployedMissionTyranidLevel( Void  )
 

Will return TYRANID_WEATHER_NONE, TYRANID_WEATHER_LIGHT, or TYRANID_WEATHER_HEAVY 

  Source: [CampaignScar.cpp (204)]  

Integer  Campaign_GetMaxOwnedStratagems( String ebp )
 

Returns the max amount of stratagems the player has ever owned across all planets 

  Source: [CampaignScar.cpp (429)]  

Integer  Campaign_GetMissionTypePlayCount( Integer missionType )
 

Returns times we've played(deployed to) a particular mission type. type = Mission_Scripted, Mission_Assassinate, Mission_Defend, Mission_Invalid (any) 

  Source: [CampaignScar.cpp (653)]  

LocString  Campaign_GetName( Void  )
 

Returns the name of the campaign (i.e. the name that was entered when the campaign was created). 

  Source: [CampaignScar.cpp (707)]  

Integer  Campaign_GetNumCompletedMissions( Integer missionType, String planet, Integer sinceDay )
 

Returns how many missions have been completed. type = Mission_Scripted, Mission_Assassinate, Mission_Defend, Mission_Invalid (any). use planet "" for any planet 

  Source: [CampaignScar.cpp (617)]  

Integer  Campaign_GetOwnedStratagemCount( String ebp )
 

Returns the total number of player-owned stratagems of the given type for the entire system 

  Source: [CampaignScar.cpp (575)]  

LuaBinding::StackVarTable  Campaign_GetPlanetStratagemsPlayerOwns( Void  )
 

Returns a table containing all the Stratagems on the planet the player currently owns 

  Source: [CampaignScar.cpp (337)]  

PlayerID  Campaign_GetPlayerByName( Integer locStringID )
 

Returns a player by a locstring ID, this is used to get non-human players 

  Source: [CampaignScar.cpp (271)]  

LuaBinding::StackVarTable  Campaign_GetSquadAt( Integer index )
 

Returns a table containing Campaign Squad Information 

  Source: [CampaignScar.cpp (124)]  

Integer  Campaign_GetSquadCount( Void  )
 

How many squads are currently in the campaign. 

  Source: [CampaignScar.cpp (111)]  

LuaBinding::StackVarTable  Campaign_GetStratagems( Void  )
 

Returns table containing entries for each stratagem in the campaign 

  Source: [CampaignScar.cpp (672)]  

Boolean  Campaign_HasWargearInInventory( PropertyBagGroup pbg, Boolean includeEquipped )
 

Returns whether the PropertyBagGroup (id) of the wargear is in the inventory (picked up), and optionally if it is equipped by a squad. 

  Source: [CampaignScar.cpp (442)]  

Void  Campaign_ModifyPotentialEnemyCount( Integer delta )
 

Modify the potential enemy count (count of enemy entities) for zeal scoring (kill %) 

  Source: [CampaignScar.cpp (515)]  

Void  Campaign_SetComplete( Void  )
 

Set the current campaign to be "complete" so that it alters postgame UI flow and prevents re-entry from the campaign select form 

  Source: [CampaignScar.cpp (720)]  

Void  Campaign_SetDeployedMissionComplete( Void  )
 

Flags this mission as being complete, according to the campaign system 

  Source: [CampaignScar.cpp (178)]  

Void  Campaign_SetPotentialEnemyCount( Integer count )
 

Set the potential enemy count (count of enemy entities) for zeal scoring (kill %) 

  Source: [CampaignScar.cpp (529)]  

Void  Campaign_SetSquadLocked( String pbgDir, Boolean locked )
 

Set a particular squad to being unlocked or locked. 

  Source: [CampaignScar.cpp (730)]  

Void  Campaign_SetStratagemThreatened( String ebp, Boolean threatened )
 

Sets a given Stratagem as threatened or not (to be used if you successfully or unsuccessfully defend a threatened stratagem) 

  Source: [CampaignScar.cpp (390)]  

Void  Campaign_SetupPlayers( Void  )
 

This sets up the local player and the co-op player (sets name, team) as well as any non-human players defined in the mission 

  Source: [CampaignScar.cpp (217)]  

 

 

Command
Functions

Void  Cmd_Ability( SGroupID sgroup, AbilityID!abilityid [, target] [, Bool skipCostPrereq] )
 

Cast an ability on an object in the game 

  Source: [Command.scar (1936)]  

Void  Cmd_AttachSquads( SGroupID sgroup, SGroupID sgroupAttachee )
 

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

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2152)]  

Void  Cmd_Attack( SGroupID sourcesgroup, Object target, [Boolean queued] )
 

Order a squad group to attack an object (SGroup, EGroup, Squad, Pos, etc). This function should track the target squad groups position.  

  Source: [Command.scar (631)]  

Void  Cmd_AttackEGroup( SGroupID sourcesgroup, EGroupID targetegroup, [Boolean queued] )
 

Order a squad group to attack another squad group. This function should track the target squad groups position.  

The source squads will not stop moving until they reach the targeted squad group. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (709)]  

Void  Cmd_AttackMeleeEGroup( SGroupID sourcesgroup, EGroupID targetegroup, [Boolean queued] )
 

Order a squad group to attack an entity group using melee. 

  Source: [Command.scar (827)]  

Void  Cmd_AttackMeleeSGroup( SGroupID sourcesgroup, SGroupID targetsgroup, [Boolean queued] )
 

Order a squad group to attack another squad group using melee. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (808)]  

Void  Cmd_AttackMove( SGroupID sourcesgroup, Object target, [Boolean queued] )
 

Order a squad group to attack move to an object (SGroup, EGroup, Squad, Pos, etc). This function should track the target squad groups position.  

  Source: [Command.scar (656)]  

Void  Cmd_AttackMoveEGroup( SGroupID sgroup, EGroupID targetegroup )
 

Order a squad group to ground move to an egroup's position.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (963)]  

Void  Cmd_AttackMoveEGroupQueued( SGroupID sgroup, EGroupID targetegroup )
 

Order a squad group to ground move to an egroup's position only after other queued commands are done.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (971)]  

Void  Cmd_AttackMoveMarker( SGroupID sgroup, MarkerID marker )
 

Order a squad group to ground move to a marker position.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (923)]  

Void  Cmd_AttackMoveMarkerQueued( SGroupID sgroup, MarkerID marker )
 

Order a squad group to ground move to a marker position only after other queued commands are done.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (935)]  

Void  Cmd_AttackMovePos( SGroupID sgroup, Position targetposition )
 

Order a squad group to attack move to a position.  

targetposition accepts a Position, sgroup, or marker

  Source: [Command.scar (851)]  

Void  Cmd_AttackMovePosQueued( SGroupID sgroup, Position targetposition )
 

Order a squad group to attack move to a position only after other queued commands are done. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (876)]  

Void  Cmd_AttackMoveSGroup( SGroupID sgroup, SGroupID targetsgroup )
 

Order a squad group to ground move to a sgroup's position.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (945)]  

Void  Cmd_AttackMoveSGroupQueued( SGroupID sgroup, SGroupID targetsgroup )
 

Order a squad group to ground move to a sgroup's position only after other queued commands are done.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (953)]  

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 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2372)]  

Void  Cmd_AttackMoveToCover( SGroupID sgroup, Position targetposition, Float searchRadius )
 

Order a squad group to attack move to cover that's close to a position.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (901)]  

Void  Cmd_AttackMoveToCoverQueued( SGroupID sgroup, Position targetposition, Float searchRadius )
 

Order a squad group to attack move to cover that's close to a position, only after other queued commands are done.  

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (912)]  

Void  Cmd_AttackSGroup( SGroupID sourcesgroup, SGroupID targetsgroup, [Boolean queued] )
 

Order a squad group to attack another squad group. This function should track the target squad groups position.  

The source squads will not stop moving until they reach the targeted squad group. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (685)]  

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

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

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1008)]  

Void  Cmd_DigOut( SGroupID sgroup )
 

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

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1060)]  

Void  Cmd_EntityUpgrade( EGroupID egroup, UpgradeID upgradeid[, Integer count] )
 

Sends an upgrade command to all entities in a group. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1832)]  

EntityID id of the destination entity  Cmd_Garrison( SGroupID fromsgroupid, EGroupID toegroupid, [Bool overload, Bool queued] )
 

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

overload is a flag that will allow the hold entity to ignore maximum slot check. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1381)]  

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. Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1026)]  

Void  Cmd_InstantDigOut( SGroupID sgroup )
 

Order a squad group to dig out instantly 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1043)]  

Void  Cmd_InstantEntityUpgrade( EGroupID egroup, UpgradeID upgradeid[, Integer count] )
 

Sends an instant upgrade command to all entities in a group. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1860)]  

EntityID id of the destination entity  Cmd_InstantGarrison( SGroupID fromsgroupid, EGroupID toegroupid, [Bool overload, Bool queued] )
 

Order a squad group to garrison instantly at an random entity (mostly buildings) of the entity group 

This order should only be used in the beginning of missions since it skips all the garrisoning animation. overload is a flag that will allow the hold entity to ignore maximum slot check. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1320)]  

SquadID id of the destination squad  Cmd_InstantLoad( SGroupID fromsgroupid, SGroupID tosgroupid, [Bool overload, Bool queued] )
 

Order a squad group to load instantly at an random squad of the second squad group 

This order should only be used in the beginning of missions since it skips all the loading animation. overload is a flag that will allow the hold entity to ignore maximum slot check. Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1214)]  

Void  Cmd_InstantPlayerUpgrade( PlayerID playerid, UpgradeID upgradeid[, Integer count] )
 

Sends an instant upgrade command to the player. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1911)]  

Void  Cmd_InstantReinforceUnit( SGroupID sgroup, Integer 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. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1698)]  

Void  Cmd_InstantReinforceUnitPos( SGroupID sgroup, Integer count, MarkerID/Pos spawnlocation[, Integer checktype[, Integer 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. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1720)]  

Void  Cmd_InstantSquadUpgrade( SGroupID sgroup, UpgradeID upgradeid[, Integer count] )
 

Sends an instant upgrade command to all squads in a group. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1810)]  

Boolean  Cmd_IsCapturing( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are currently capturing something. 

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

  Source: [Command.scar (2110)]  

Boolean  Cmd_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

  Source: [Command.scar (2124)]  

Boolean  Cmd_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

  Source: [Command.scar (2138)]  

Boolean  Cmd_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

  Source: [Command.scar (2078)]  

Boolean  Cmd_IsUpgrading( SGroupID sgroup, UpgradeID upgradeid, 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

  Source: [Command.scar (2092)]  

Void  Cmd_JumpToPosition( SGroupID sgroup, Pos/MarkerID targetposition[, Boolean queued] )
 

Order a squad group to jump to a position 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (979)]  

SquadID id of the destination squad  Cmd_Load( SGroupID fromsgroupid, SGroupID tosgroupid, [Bool overload, Bool queued] )
 

Order a squad group to load at an random squad of the second squad group 

overload is a flag that will allow the hold entity to ignore maximum slot check. Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1267)]  

Void  Cmd_Move( SGroupID sgroup, Pos/SGroupID/EGroupID/MarkerID position, [Boolean queued, MarkerID deleteWhenNearMarker, Position facing, Integer 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)

  Source: [Command.scar (77)]  

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. Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (391)]  

markerID  Cmd_MoveToClosestMarker( SGroupID sgroup, Table markertable )
 

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

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2229)]  

Void  Cmd_MoveToCover( SGroupID sgroup, Pos position, Float searchRadius[, Boolean queued] )
 

Move a squad group to cover that's close a given position. If cover cannot be found, it just moves to the target position. 

The move command will be issued by the player owner of the first item in the group. This function does nothing if the group is empty. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (347)]  

Void  Cmd_MoveToEGroup( SGroupID sgroup, EGroupID egroup, [Boolean queued] )
 

Move a squad group to the center of an entity group. 

The move command will be issued by the player owner of the first item in the group. This function does nothing if the group is empty. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (302)]  

Void  Cmd_MoveToMarker( SGroupID sgroup, MarkerID marker, [Boolean queued] )
 

Move a squad group to a given markers position. 

The move command will be issued by the player owner of the first item in the group. This function does nothing if the group is empty. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (142)]  

Void  Cmd_MoveToMarkerQueued( SGroupID sgroup, MarkerID marker )
 

Move a squad group to a given markers position only after other previously queued command is done 

The queued move command will be issued by the player owner of the first item in the group. This function does nothing if the group is empty. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (284)]  

Void  Cmd_MoveToPos( SGroupID sgroup, Pos position, [Boolean queued, MarkerID deleteWhenNearMarker] )
 

Move a squad group to a given position. The sgroup can be deleted when in proximity of a marker if you pass in the marker as the 4th argument. 

The move command will be issued by the player owner of the first item in the group. This function does nothing if the group is empty. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (164)]  

Void  Cmd_MoveToPosOffset( SGroupID source, ScarPosition position, Integer offset, Float distance[, Boolean queued] )
 

The offset is a number from 0 to 7 and indicates a location around 'position' as follows:
7 0 1
6 pos 2
5 4 3 Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (190)]  

Void  Cmd_MoveToSGroup( SGroupID sourcesgroup, SGroupID targetsgroup, [Boolean queued] )
 

Move a squad group to another squad group. This function should track the target squad groups position.  

The source squads will not stop moving until they reach the targeted squad group. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (325)]  

Void  Cmd_MoveToSGroupOffset( SGroupID source, SGroupID target, Integer offset, Float distance[, Boolean queued] )
 

The the target SGroup can only have one squad in it. The offset is a number from 0 to 7 and indicates a location around the target sgroup (oriented based on that group's orientation) as follows:
7 0 1
6 pos 2
5 4 3 Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (362)]  

Void  Cmd_PlayerAbility( PlayerID playerid, AbilityID abilityid, [Bool skipCostPrereq] )
 

Command player to do ability onto itself. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2274)]  

Void  Cmd_PlayerAbilityMarker( PlayerID playerid, AbilityID abilityid, MarkerID marker, [Bool skipCostPrereq] )
 

Command player to do ability on a marker position. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2343)]  

Void  Cmd_PlayerAbilityPos( PlayerID playerid, AbilityID abilityid, Position position, [Bool skipCostPrereq] )
 

Command player to do ability on a position. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2296)]  

Void  Cmd_PlayerAbilityPosDir( PlayerID playerid, AbilityID abilityid, Position position, Position direction, [Bool skipCostPrereq] )
 

Command player to do ability on a position with direction 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2319)]  

Void  Cmd_PlayerUpgrade( PlayerID playerid, UpgradeID upgradeid[, Integer count] )
 

Sends an upgrade command to the player. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1888)]  

Void  Cmd_ReinforceUnit( SGroupID sgroup, Integer 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. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1611)]  

Void  Cmd_ReinforceUnitPos( SGroupID sgroup, Integer count, MarkerID/Pos spawnlocation[, Integer checktype[, Integer 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. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1633)]  

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) 

  Source: [Command.scar (1080)]  

Void  Cmd_RetreatToLocation( SGroupID sgroup, Position destination )
 

Order a squad group to retreat to a given destination 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1191)]  

Void  Cmd_SquadAbility( SGroupID sgroup, AbilityID abilityid, [Bool skipCostPrereq] )
 

Sends an ability command without additional target to all squads in a group. abilityid should be the number returned by Util_GetAbilityID( abilityname ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1979)]  

Void  Cmd_SquadAbilityEntity( SGroupID sgroupid, AbilityID abilityid, Entity to_entityid, [Bool skipCostPrereq] )
 

Command squad to do ability on an entity. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2029)]  

Void  Cmd_SquadAbilityPos( SGroupID sgroupid, AbilityID abilityid, Position position, [Bool skipCostPrereq] )
 

Command squad to do ability on a position. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2001)]  

Void  Cmd_SquadAbilitySquad( SGroupID sgroupid, AbilityID abilityid, SGroupID to_sgroupid, [Bool skipCostPrereq] )
 

Command squad to do ability on a squad. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2052)]  

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 ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1545)]  

Void  Cmd_SquadPath( SGroupID sgroup, String pathName, Boolean bFromClosest, Boolean bLoop, Boolean bAttackMove, Float pauseTime[, MarkerID deleteWhenNearMarker] )
 

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. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (450)]  

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

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (481)]  

Void  Cmd_SquadSetMeleeStance( SGroupID sgroup, [Bool queued] )
 

Sends a melee stance command to all squads in a group. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1563)]  

Void  Cmd_SquadSetRangedStance( SGroupID sgroup, [Bool queued] )
 

Sends a ranged stance command to all squads in a group. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1583)]  

  Cmd_SquadUnload( SGroupID sgroupid, MarkerID/Pos destination, [Bool queued] )
 

Order all squads in the SGroup to unload from vehicle or building that they are currently in 

DO NOT confuse this with other unload commands. This only works on the squads inside a hold while the other unload command is issued to BUILDINGS and VEHICLES!!! Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1514)]  

Void  Cmd_SquadUpgrade( SGroupID sgroup, UpgradeID upgradeid[, Integer count] )
 

Sends an upgrade command to all squads in a group. upgradeid should be the number returned by Util_GetUpgradeID( upgradename ) 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1788)]  

Void  Cmd_StationaryAttackEGroup( SGroupID sourcesgroup, EGroupID targetegroup, [Boolean queued] )
 

Order a squad group to attack another squad group without moving. This function should track the target squad groups position.  

The source squads will not execute any plan and it will not move to attack. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (757)]  

Void  Cmd_StationaryAttackPosition( SGroupID sourcesgroup, MarkerID/Pos target, [Boolean queued] )
 

Order a squad group to attack a position without moving. This function should track the target squad groups position.  

The source squads will not execute any plan and it will not move to attack. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (781)]  

Void  Cmd_StationaryAttackSGroup( SGroupID sourcesgroup, SGroupID targetsgroup, [Boolean queued] )
 

Order a squad group to attack another squad group without moving. This function should track the target squad groups position.  

The source squads will not execute any plan and it will not move to attack. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (733)]  

Void  Cmd_StopEntities( EGroupID egroup )
 

Command an egroup to stop. This is the same as issuing a stop from the taskbar 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2212)]  

Void  Cmd_StopSquads( SGroupID sgroup )
 

Command an sgroup to stop. This is the same as issuing a stop from the taskbar 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (2191)]  

  Cmd_Ungarrison( EGroupID egroupid, Position destination )
 

Order all squads from the building to ungarrison into destinated location 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running. Note also that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1433)]  

  Cmd_UngarrisonSquad( EGroupID egroupid, Position destination, SGroupID sgroupid )
 

Order first squad in the sgroup from the building to ungarrison into destinated location 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1465)]  

  Cmd_Unload( SGroupID sgroupid, MarkerID/Pos destination )
 

Order all squads from the vehicle in the SGroup to unload when the vehicle reaches the destination. 

Note that this command will do nothing if called from within scenario initialization. It will only work if the simulation is already running.

  Source: [Command.scar (1492)]  

Void  Command_Entity( PlayerID player, EGroupID egroup, Integer 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.

  Source: [LuaCommand.cpp (1125)]  

Void  Command_EntityEntity( PlayerID player, EGroupID egroup, Integer 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.

  Source: [LuaCommand.cpp (1189)]  

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

Send a squad command to a squad group with custom data 

  Source: [LuaCommand.cpp (1305)]  

Void  Command_EntityPos( PlayerID player, EGroupID egroup, Integer 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.

  Source: [LuaCommand.cpp (1155)]  

Void  Command_EntityPosSquad( PlayerID player, EGroupID egroup, Integer 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.

  Source: [LuaCommand.cpp (1267)]  

Void  Command_EntitySquad( PlayerID player, EGroupID egroup, Integer 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.

  Source: [LuaCommand.cpp (1228)]  

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

Send a player command to a player 

PCMD_Ability

  Source: [LuaCommand.cpp (242)]  

Void  Command_PlayerAbility( PlayerID player, PlayerID dest, Integer abilityBagID, Boolean skipCostPrereq )
 

Send a player ability command (PCMD_Ability) to a player 

  Source: [LuaCommand.cpp (315)]  

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

Send a player command to a player with a custom flag 

  Source: [LuaCommand.cpp (215)]  

Void  Command_PlayerPos( PlayerID player, PlayerID dest, Integer 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.

  Source: [LuaCommand.cpp (265)]  

Void  Command_PlayerPosAbility( PlayerID player, PlayerID dest, Position pos, Integer abilityBagID, 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

  Source: [LuaCommand.cpp (342)]  

Void  Command_PlayerPosDirAbility( PlayerID player, PlayerID dest, Position pos, Position dir, Integer abilityBagID, 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

  Source: [LuaCommand.cpp (370)]  

Void  Command_PlayerPosExt( PlayerID player, PlayerID dest, Integer playerCommand, Position pos, Integer 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.

  Source: [LuaCommand.cpp (291)]  

Void  Command_PlayerSquadConstructBuilding( PlayerID player, SGroupID sgroup, Integer structureBlueprintID, 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

  Source: [LuaCommand.cpp (1340)]  

Void  Command_PlayerSquadConstructFence( PlayerID player, SGroupID sgroup, Integer structureBlueprintID, 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

  Source: [LuaCommand.cpp (1430)]  

Void  Command_PlayerSquadConstructField( PlayerID player, SGroupID sgroup, Integer structureBlueprintID, 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

  Source: [LuaCommand.cpp (1514)]  

Void  Command_Squad( PlayerID player, SGroupID sgroup, Integer 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_SlotItemRemove, SCMD_InstantReinforceUnit, SCMD_InstantUpgrade

  Source: [LuaCommand.cpp (573)]  

Void  Command_SquadAbility( PlayerID player, SGroupID sgroup, Integer abilityBagID, Boolean skipCostPrereq )
 

Send a ability command (SCMD_Ability) to a squad 

  Source: [LuaCommand.cpp (400)]  

Void  Command_SquadAttackMovePos( PlayerID player, SGroupID sgroup, unsigned int { if ( sgroup->IsEmpty( )
 

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

  Source: [LuaCommand.cpp (851)]  

Void  Command_SquadEntity( PlayerID player, SGroupID sgroup, Integer 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

  Source: [LuaCommand.cpp (813)]  

Void  Command_SquadEntityAbility( PlayerID player, SGroupID sgroup, EntityID target, Integer abilityBagID, Boolean skipCostPrereq )
 

Send a entity ability command (SCMD_Ability) to a squad 

  Source: [LuaCommand.cpp (444)]  

Void  Command_SquadEntityAttack( PlayerID player, SGroupID sgroup, EGroupID target, Boolean bCheckFOW, Boolean bStationary, 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

  Source: [LuaCommand.cpp (938)]  

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

Send a entity command to a squad group with custom data 

  Source: [LuaCommand.cpp (773)]  

Void  Command_SquadEntityLoad( PlayerID player, SGroupID sgroup, Integer squadCommand, EGroupID target, Boolean bOverLoad, Boolean bQueued )
 

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)

  Source: [LuaCommand.cpp (1641)]  

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

Send a squad command to a squad group with custom data 

  Source: [LuaCommand.cpp (534)]  

Void  Command_SquadPos( PlayerID player, SGroupID sgroup, Integer 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.

  Source: [LuaCommand.cpp (635)]  

Void  Command_SquadPosAbility( PlayerID player, SGroupID sgroup, Position pos, Integer abilityBagID, Boolean skipCostPrereq )
 

Send a positional ability command (SCMD_Ability) to a squad 

  Source: [LuaCommand.cpp (433)]  

Void  Command_SquadPosDir( PlayerID player, SGroupID sgroup, Integer squadCommand, Position target, Position target2, Boolean queued )
 

Send a command to a squad group with 2 positional input where the second is interpreted as a direction 

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

  Source: [LuaCommand.cpp (741)]  

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

Send a position command to a squad group with custom data 

  Source: [LuaCommand.cpp (600)]  

Void  Command_SquadPositionAttack( PlayerID player, SGroupID sgroup, Position target, Boolean bCheckFOW, Boolean bStationary, 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

  Source: [LuaCommand.cpp (888)]  

Void  Command_SquadPosPos( PlayerID player, SGroupID sgroup, Integer squadCommand, Position target, Position target2, Boolean queued )
 

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 facing the given point)
See Command_Squad for a list of all the possible squadCommands.

  Source: [LuaCommand.cpp (706)]  

Void  Command_SquadSquad( PlayerID player, SGroupID sgroup, Integer 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

  Source: [LuaCommand.cpp (1028)]  

Void  Command_SquadSquadAbility( PlayerID player, SGroupID sgroup, SGroupID target, Integer abilityBagID, Boolean skipCostPrereq )
 

Send a squad ability command (SCMD_Ability) to a squad 

  Source: [LuaCommand.cpp (460)]  

Void  Command_SquadSquadAttack( PlayerID player, SGroupID sgroup, SGroupID target, Boolean bCheckFOW, Boolean bStationary, 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
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

  Source: [LuaCommand.cpp (1069)]  

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

Send a squad command to a squad group with custom data 

  Source: [LuaCommand.cpp (988)]  

Void  Command_SquadSquadLoad( PlayerID player, SGroupID sgroup, Integer squadCommand, SGroupID target, Boolean bOverLoad, Boolean bQueued )
 

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)

  Source: [LuaCommand.cpp (1602)]  

 

 

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.

  Source: [Scar.cpp (1317)]  

Boolean  Event_IsAnyRunning( Void  )
 

Returns true if any event is currently running or queued. 

  Source: [Scar.cpp (1304)]  

Boolean  Event_IsRunning( LuaFunction f )
 

Returns true if a given event is running 

  Source: [Scar.cpp (1310)]  

Void  Event_Skip( Void  )
 

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

  Source: [Scar.cpp (1298)]  

Void  Event_Start( LuaFunction eventFunction, Integer priority )
 

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

The only time you should need this function is to start playing a NISLet. If your NISLet is named NISLet01 you would call this function like so:

Event_Start( NISLets.NISLet01, 0 )

Events are run until a call to Wait() is hit. When the event reaches Wait() it will not continue it execution until all controllers it is waiting for are done.
To add a controller to the block simply call the controller through the CTRL object. For example, to call the Delay controller you should call CTRL.Delay(5). This will make the succesive call to Wait delay for 5 seconds.

Example: (NISLets are located in the .nis file for your mission)
NISLets = {
MyNISLet = function ( )

print("Yo")
CTRL.Event_Delay(3)
print("This will show up right after Yo, it will not wait for 3 seconds")
CTRL.Event_Delay(2)
Event_Wait() -- execution will now delay for 5 seconds (waiting for controllers)

print("Yo, 5 seconds later")

end

To trigger the above NISLet from a Rule or your mission script you would call Event_Start( NISLets.MyNISLet, 0 )

If you start an event that has higher priority then the current event playing, the current event will be cancelled.

If you start an event that has lower or equal priority then the current event playing, the event will be queued and it will play when the current event is complete.

Zero is the highest priority and Zero+N is lower priority.

  Source: [Scar.cpp (1289)]  

String  Misc_GetScarFullFilename( Void  )
 

Returns the full path name to the main SCAR script 

  Source: [Scar.cpp (1328)]  

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.

  Source: [Scar.cpp (1227)]  

Boolean  Scar_InitExists( LuaFunction f )
 

Returns true if an init function exists 

  Source: [Scar.cpp (1261)]  

Void  Scar_RemoveInit( LuaFunction f )
 

Unregister an init function that was registered from Scar_AddInit 

  Source: [Scar.cpp (1251)]  

Void  TimeRule_Add( LuaFunction f, Integer priority )
 

Add a rule to be executed every frame 

  Source: [LuaRuleSystem.cpp (478)]  

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

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

  Source: [LuaRuleSystem.cpp (502)]  

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

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

  Source: [LuaRuleSystem.cpp (490)]  

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

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

  Source: [LuaRuleSystem.cpp (514)]  

Void  TimeRule_ChangeInterval( LuaFunction f, Real interval )
 

Change 'interval' seconds of an existing rule 

  Source: [LuaRuleSystem.cpp (526)]  

Boolean  TimeRule_Exists( LuaFunction f )
 

Test if a rule is currently active 

  Source: [LuaRuleSystem.cpp (351)]  

Void  TimeRule_Remove( LuaFunction f )
 

Remove a currently active rule 

  Source: [LuaRuleSystem.cpp (388)]  

Void  TimeRule_RemoveAll( Integer maxpriority )
 

Kills all rules. 

  Source: [LuaRuleSystem.cpp (367)]  

Void  TimeRule_RemoveMe( Void  )
 

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

  Source: [LuaRuleSystem.cpp (411)]  

Void  TimeRule_Replace( LuaFunction oldf, LuaFunction newf )
 
  Source: [LuaRuleSystem.cpp (427)]  

 

 

DesignerLib
Functions

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

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

  Source: [DesignerLib.scar (508)]  

Void  AutoCharge_RemoveAll( )
 

Stops monitoring all squads from the auto-charge functions 

  Source: [DesignerLib.scar (568)]  

Void  AutoCharge_RemoveSGroup( SGroupID sgroup )
 

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

  Source: [DesignerLib.scar (545)]  

Void  AutoCinematic( Boolean in/out, Real seconds )
 

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

  Source: [DesignerLib.scar (50)]  

Void  AutoReinforce_RemoveAll( )
 

Stops monitoring all squads from the auto-reinforce functions 

  Source: [DesignerLib.scar (264)]  

Void  AutoReinforce_RemoveSGroup( SGroupID sgroup )
 

Removes an SGroup from the auto-reinforce functions 

  Source: [DesignerLib.scar (242)]  

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

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

  Source: [DesignerLib.scar (350)]  

Void  AutoRetreat_RemoveAll( )
 

Stops monitoring all squads from the auto-retreat functions 

  Source: [DesignerLib.scar (411)]  

Void  AutoRetreat_RemoveSGroup( SGroupID sgroup )
 

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

  Source: [DesignerLib.scar (388)]  

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. 

  Source: [DesignerLib.scar (756)]  

Void  AutoTerritory_RemoveAll( )
 

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

  Source: [DesignerLib.scar (828)]  

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. 

  Source: [DesignerLib.scar (792)]  

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)

  Source: [DesignerLib.scar (646)]  

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. 

  Source: [DesignerLib.scar (662)]  

Void  Game_DefaultGameRestore( )
 

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

  Source: [DesignerLib.scar (1315)]  

Void  Resources_Disable( )
 

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

  Source: [DesignerLib.scar (1253)]  

Void  Resources_Enable( )
 

Re-enables resource income.  

  Source: [DesignerLib.scar (1270)]  

Integer  Stats_TeamTally( Integer teamindex, Function statfunction )
 

Takes a statistic function and totals up the results for all the players on a given team 

  Source: [DesignerLib.scar (1292)]  

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

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

  Source: [DesignerLib.scar (1212)]  

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

  Source: [DesignerLib.scar (74)]  

 

 

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. 

  Source: [LuaGroup.cpp (172)]  

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)

  Source: [LuaGroup.cpp (150)]  

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. 

  Source: [Groups.scar (365)]  

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. 

  Source: [Groups.scar (377)]  

Void  EGroup_Clear( EGroupID egroup )
 

Removes all entities from a group 

  Source: [LuaGroup.cpp (139)]  

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. 

  Source: [LuaGroup.cpp (166)]  

Boolean  EGroup_ContainsBlueprints( EGroupID egroup, BlueprintTable blueprints, Boolean all )
 

Check if a group contains ALL or ANY of the items in a blueprint table. 

See SGroup_ContainsBlueprints for more info.

  Source: [Groups.scar (512)]  

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

Returns true if EGroup1 contains ANY or ALL of EGroup2 

  Source: [Groups.scar (744)]  

Boolean  EGroup_ContainsEntity( EGroupID egroup, EntityID entity )
 

Returns true if EGroup contains a particular EntityID 

  Source: [Groups.scar (726)]  

Boolean  EGroup_ContainsSecuredStrategicPoint( EGroupID egroup, Boolean all )
 

Use to check if an egroup contains a strategic point that has been secured 

  Source: [LuaGroup.cpp (366)]  

Boolean  EGroup_ContainsStrategicPointWithAddons( EGroupID egroup, Boolean all )
 

Use to check if an egroup contains a strategic point that has addons 

  Source: [LuaGroup.cpp (387)]  

Integer  EGroup_Count( EGroupID egroup )
 

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

  Source: [LuaGroup.cpp (121)]  

int  EGroup_CountAlive( EGroupID egroup )
 

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

  Source: [Groups.scar (606)]  

Integer  EGroup_CountDeSpawned( EGroupID egroup )
 

Returns the number of despawned entities in a group. 

  Source: [LuaGroup.cpp (133)]  

Integer  EGroup_CountSpawned( EGroupID egroup )
 

Returns the number of spawned entities in a group. 

  Source: [LuaGroup.cpp (127)]  

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.

  Source: [LuaGroup.cpp (80)]  

EGroupID  EGroup_CreateIfNotFound( String egroupname )
 

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

  Source: [Groups.scar (389)]  

Void  EGroup_CreateKickerMessage( EGroupID group, PlayerID player, LocString textid )
 

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

  Source: [Groups.scar (757)]  

Void  EGroup_CreateKickerMessageEx( EGroupID group, PlayerID player, LocString textid, Float duration, Float red, Float green, Float blue, Float alpha )
 

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

  Source: [Groups.scar (770)]  

Void  EGroup_DeSpawn( EGroupID egroup )
 

Despawn all spawned entities in a group. 

  Source: [Groups.scar (595)]  

Void  EGroup_Destroy( EGroupID egroup )
 

Manually destroy a group that you dont need anymore. 

  Source: [LuaGroup.cpp (100)]  

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

  Source: [Groups.scar (499)]  

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.

  Source: [Groups.scar (956)]  

Boolean  EGroup_Exists( String name )
 

Returns true if the entity group with the given name exists 

  Source: [LuaGroup.cpp (239)]  

Void  EGroup_Filter( EGroupID egroup, String/ID/Table blueprint, Integer filtertype[, EGroupID splitgroup] )
 

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, while FILTER_REMOVE will strip those same entities out and leave those that aren't of the types listed. If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (816)]  

Void  EGroup_FilterUnderConstruction( EGroupID egroup, Integer 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.

  Source: [Groups.scar (923)]  

  EGroup_FilterVisible( EGroupID egroup, PlayerID player, Int filtertype[, EGroupID splitgroup] )
 

Filters an EGroup depending on who's visible from a given player's point of view. Use a filtertype of FILTER_KEEP to keep the squads you can see and remove the ones you can't, or FILTER_REMOVE to remove the squads you can see and keep the rest. 

If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (876)]  

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.

  Source: [LuaGroup.cpp (360)]  

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.

  Source: [LuaGroup.cpp (346)]  

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. 

  Source: [LuaGroup.cpp (253)]  

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. 

  Source: [LuaGroup.cpp (299)]  

EGroupID  EGroup_FromName( String name )
 

Find an entity group with a given name. 

  Source: [LuaGroup.cpp (106)]  

Real  EGroup_GetAvgHealth( EGroupID egroup )
 

Returns the average health of all units in a entity group as a weighted percent [0.0, 1.0]. 

Example: A group of entities with health 20/100 and 100/1000 would return 120/1100 ( approx 11 % )

  Source: [Groups.scar (428)]  

EntityID  EGroup_GetDeSpawnedEntityAt( EGroupID group, Integer 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()

  Source: [LuaGroup.cpp (207)]  

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.

  Source: [Groups.scar (569)]  

String  EGroup_GetName( EGroupID egroup )
 

Returns the name of a given entity group. 

  Source: [LuaGroup.cpp (247)]  

Integer  EGroup_GetNumCombatSlots( EGroupID egroup, String holdTypeName )
 

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

  Source: [Groups.scar (985)]  

Position  EGroup_GetPosition( EGroupID group )
 

Returns the center position of an entity group. 

  Source: [LuaGroup.cpp (223)]  

EntityID  EGroup_GetRandomSpawnedEntity( EGroup egroupid )
 

Get a random spawned entity from egroup 

  Source: [Groups.scar (624)]  

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. 

  Source: [Groups.scar (1039)]  

EntityID  EGroup_GetSpawnedEntityAt( EGroupID group, Integer 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()

  Source: [LuaGroup.cpp (188)]  

Real  EGroup_GetSpread( EGroupID egroup )
 

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

  Source: [Groups.scar (1014)]  

Void  EGroup_GetSquadsHeld( EGroupID egroup, SGroupID sgroupRecipient )
 

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

  Source: [Groups.scar (1127)]  

Bool  EGroup_GetUnconsciousEnabled( EGroupID sgroup, Boolean all )
 

Returns whether a squad can go unconscious or not 

  Source: [Groups.scar (1142)]  

float  EGroup_GetUnconsciousPercentage( EGroupID sgroup, bool all )
 

Get Unconscious percent 

  Source: [Groups.scar (1195)]  

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

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

  Source: [Groups.scar (1001)]  

Void  EGroup_Hide( EGroupID egroup, Bool hide )
 

Hide or show all entities in an EGroup 

Bool should be true to hide, false to show

  Source: [Groups.scar (668)]  

Void  EGroup_InstantCaptureStrategicPoint( EGroupID egroup, PlayerID player )
 

Change the ownership of a Strategic Point 

  Source: [Groups.scar (653)]  

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)

  Source: [LuaGroup.cpp (160)]  

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.

  Source: [Groups.scar (404)]  

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

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

  Source: [Groups.scar (353)]  

Boolean  EGroup_IsEmpty( EGroupID egroup )
 

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

  Source: [Groups.scar (396)]  

Void  EGroup_IsHoldingAny( EGroupID egroup )
 

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

  Source: [Groups.scar (1112)]  

Boolean  EGroup_IsInCover( EGroupID egroup, Boolean all )
 

Returns true if ALL or ANY entities are in cover. 

  Source: [Groups.scar (330)]  

Boolean  EGroup_IsMoving( EGroupID egroupid, Boolean all )
 

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

  Source: [Groups.scar (783)]  

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. 

  Source: [Groups.scar (969)]  

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

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

  Source: [Groups.scar (341)]  

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

Check if the entities are attacked by the player 

  Source: [Groups.scar (705)]  

Void  EGroup_Kill( EGroupID egroup )
 

Kill all entities in an EGroup 

  Source: [Groups.scar (687)]  

Void  EGroup_Remove( EGroupID group, EntityID entity )
 

Removes an entity from a group. 

  Source: [LuaGroup.cpp (178)]  

Void  EGroup_ResetUnconscious( EGroupID sgroup, bool all )
 

Reset Unconscious 

  Source: [Groups.scar (1155)]  

Void  EGroup_ReSpawn( EGroupID egroup )
 

Respawn all despawned entities in a group. 

  Source: [Groups.scar (584)]  

Void  EGroup_SetAnimatorAction( EGroupID egroup, String actionName )
 

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

  Source: [Groups.scar (1061)]  

Void  EGroup_SetAnimatorEvent( EGroupID egroup, String eventName )
 

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

  Source: [Groups.scar (1074)]  

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 

  Source: [Groups.scar (1087)]  

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

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

  Source: [Groups.scar (1100)]  

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

  Source: [Groups.scar (438)]  

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

  Source: [Groups.scar (554)]  

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, health damage is disabled.

  Source: [Groups.scar (531)]  

Real  EGroup_SetLevel( EGroupID egroup, Integer/String level )
 

Changes the level of all spawned and despawned entities in an EGroup. 

  Source: [Groups.scar (452)]  

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

  Source: [Groups.scar (483)]  

Void  EGroup_SetSelectable( EGroupID egroup, Bool selectable )
 

Set player selectable state of entities in the egroup 

  Source: [Groups.scar (643)]  

Void  EGroup_SetUnconsciousRatioToRevive( EGroupID sgroup, bool all )
 

Reset Unconscious 

  Source: [Groups.scar (1168)]  

Void  EGroup_SetUnconsciousRatioToRevive( EGroupID sgroup, bool enabled, bool all )
 

Set unconscious enabled 

  Source: [Groups.scar (1181)]  

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.

  Source: [Groups.scar (801)]  

 

 

Entity
Functions

Boolean  Entity_CanLoadSquad( EntityID entity, SquadID squad )
 

Check if the entity can load squad or not 

  Source: [LuaEntity.cpp (767)]  

Boolean  Entity_CanSeeEntity( EntityID entity, EntityID target )
 

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

  Source: [LuaEntity.cpp (422)]  

Boolean  Entity_CanSeeSquad( EntityID entity, SquadID target )
 

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

  Source: [LuaEntity.cpp (434)]  

Void  Entity_ChargePosition( EntityID entity, Math::Vector3f pos )
 

Force entity to *attempt* moving to the given position in a straight line.  

Entity stops at first obstacle.

  Source: [LuaEntity.cpp (83)]  

Void  Entity_ClearPostureSuggestion( EntityID entity )
 

Clears any previous posture suggestions made to an entity 

  Source: [LuaModExtensions.cpp (235)]  

EntityID  Entity_Create( Integer blueprintID, 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 

  Source: [luaentity.cpp (50)]  

EntityID  Entity_CreateENV( Integer blueprintID, 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 

  Source: [luaentity.cpp (74)]  

Void  Entity_Delete( EntityID entity )
 

Delete the entity 

  Source: [luaentity.cpp (177)]  

Void  Entity_DeSpawn( EntityID entity )
 

DeSpawn the entity at its current position 

  Source: [luaentity.cpp (168)]  

Void  Entity_Destroy( EntityID entity )
 

Remove an entity from the world and destroy it. 

  Source: [luaentity.cpp (100)]  

Void  Entity_ForceConstruct( EntityID e )
 

Force constructs this entity but only if its a building 

  Source: [LuaEntity.cpp (464)]  

EntityID  Entity_FromWorldID( Integer id )
 

Get an entity from a mission editor ID. 

  Source: [luaentity.cpp (107)]  

Integer  Entity_GetActiveCommand( EntityID entity )
 

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

  Source: [LuaEntity.cpp (326)]  

Integer  Entity_GetBlueprintID( EntityID entity )
 

Returns the id of the entity blueprint 

  Source: [luaentity.cpp (197)]  

String  Entity_GetBlueprintName( EntityID entity )
 

Returns the name of the entity blueprint (from the attribute editor) 

  Source: [luaentity.cpp (191)]  

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. 

  Source: [LuaEntity.cpp (446)]  

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

  Source: [LuaEntity.cpp (780)]  

Integer  Entity_GetGameID( EntityID entity )
 

Returns the entities unique id in the world 

  Source: [luaentity.cpp (203)]  

Position  Entity_GetHeading( EntityID entity )
 

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

  Source: [luaentity.cpp (141)]  

Real  Entity_GetHealth( EntityID entity )
 

Returns the health of an entity. 

Health will be zero for entities with no health extension.

  Source: [LuaEntity.cpp (169)]  

Real  Entity_GetHealthMax( EntityID entity )
 

Returns the max health of an entity. 

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

  Source: [LuaEntity.cpp (183)]  

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

  Source: [LuaEntity.cpp (197)]  

Bool  Entity_GetInvulnerable( SquadID squad )
 

Check if the entity is invulnerable or not 

  Source: [Entity.scar (38)]  

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

  Source: [LuaEntity.cpp (597)]  

Integer  Entity_GetNumCombatSlots( EntityID entity )
 

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

  Source: [LuaEntity.cpp (755)]  

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

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

  Source: [Entity.scar (46)]  

PlayerID  Entity_GetPlayerOwner( EntityID entity )
 

Returns the Player owner of the given entity. 

  Source: [luaentity.cpp (183)]  

Position  Entity_GetPosition( EntityID entity )
 

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

  Source: [luaentity.cpp (129)]  

String  Entity_GetProductionQueueItemName( EntityID entity, Integer index )
 

Returns the name of the production item with index in range of [0,n-1] 

Item types are: PITEM_Upgrade, PITEM_Spawn, PITEM_SquadUpgrade, PITEM_SquadReinforce, PITEM_PlayerUpgrade. Any of these items can in a production queue.

Use Entity_GetProductionQueueItemType to get the type of a given production queue item if you are interested in such things.

  Source: [LuaEntity.cpp (387)]  

Integer  Entity_GetProductionQueueItemType( EntityID entity, Integer index )
 

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

  Source: [LuaEntity.cpp (368)]  

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

  Source: [LuaEntity.cpp (335)]  

Position  Entity_GetRallyPosition( EntityID entity )
 

Get the rally point for this production queue. 

  Source: [LuaEntity.cpp (356)]  

Real  Entity_GetResourceRate( EntityID entity, Integer resourceType )
 

Returns the rate at which the entity grants the specified resource. 

  Source: [LuaEntity.cpp (670)]  

Real  Entity_GetSightRadius( EntityID entity )
 

Returns the outer sight radius for this entity 

Radius will be zero for entities without a sight extension

  Source: [LuaEntity.cpp (155)]  

SquadID  Entity_GetSquad( EntityID pEntity )
 

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

  Source: [LuaEntity.cpp (557)]  

Boolean  Entity_GetSquadsHeld( EntityID pEntity, SGroupID sgroup )
 

Adds squads held by an entity to an SGroup 

  Source: [LuaEntity.cpp (814)]  

Boolean  Entity_GetUnconsciousEnabled( EntityID entity )
 

Gets Unconscious override value 

Gets Unconscious override value

  Source: [LuaEntity.cpp (638)]  

Boolean  Entity_HasProductionQueue( EntityID entity )
 

Returns true if an entity has a production queue. 

  Source: [LuaEntity.cpp (348)]  

Boolean  Entity_HasUpgrade( EntityID pEntity, Integer pbgID )
 

Return true if the entity has purchased the specified upgrade. 

  Source: [LuaEntity.cpp (794)]  

Void  Entity_InstantCaptureStrategicPoint( EntityID entity, PlayerID player )
 

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

  Source: [LuaEntity.cpp (693)]  

Integer  Entity_IsAlive( EntityID pEntity )
 

Returns true if entity is still alive 

  Source: [LuaEntity.cpp (566)]  

Boolean  Entity_IsAttacking( EntityID entity, Real time )
 

Returns true if the entity is attacking within the time 

Time is in seconds

  Source: [LuaEntity.cpp (410)]  

Boolean  Entity_IsBuilding( EntityID e )
 

Returns true if the given entity is a building 

  Source: [LuaEntity.cpp (458)]  

Integer  Entity_IsEBPBuilding( Integer blueprintID )
 

Returns true if the given blueprint is a building 

  Source: [LuaEntity.cpp (474)]  

Boolean  Entity_IsEBPObjCover( Integer blueprintID )
 

Returns true if the given blueprint is objcover 

  Source: [LuaEntity.cpp (483)]  

Boolean  Entity_IsHoldingAny( EntityID entity )
 

Check if the entity has a hold on anything 

  Source: [LuaEntity.cpp (773)]  

Boolean  Entity_IsInCover( EntityID entityId )
 

Returns true if entity is in cover. 

  Source: [Entity.scar (10)]  

Boolean  Entity_IsMoving( EntityID pEntity )
 

Returns whether an entity is moving. 

  Source: [LuaEntity.cpp (802)]  

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 

  Source: [LuaEntity.cpp (254)]  

Boolean  Entity_IsPartOfSquad( EntityID pEntity )
 

Returns true if the entity is part of a squad 

  Source: [LuaEntity.cpp (551)]  

Boolean  Entity_IsStartingPosition( EntityID entity )
 

Returns true if the entity is a starting position 

  Source: [LuaEntity.cpp (687)]  

Boolean  Entity_IsStrategicPoint( EntityID entity )
 

Returns true if the entity is a strategic point. 

  Source: [LuaEntity.cpp (664)]  

Boolean  Entity_IsStrategicPointCapturedBy( EntityID entity, PlayerID player )
 

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

  Source: [LuaEntity.cpp (743)]  

Boolean  Entity_IsUnconscious( EntityID entity )
 

Returns true if the entity is unconscious 

  Source: [LuaEntity.cpp (609)]  

Boolean  Entity_IsUnderAttack( EntityID entity, Real time )
 

Returns true if the entity is under attack.  

  Source: [LuaEntity.cpp (403)]  

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

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

  Source: [LuaEntity.cpp (416)]  

Boolean  Entity_IsValid( Integer id )
 

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

  Source: [luaentity.cpp (122)]  

Boolean  Entity_IsVehicle( EntityID pEntity )
 

Returns whether an entity is a vehicle 

  Source: [LuaEntity.cpp (808)]  

Boolean  Entity_IsVictoryPoint( Entity *pEntity )
 

Returns true if entityID is a victory point 

  Source: [LuaEntity.cpp (650)]  

Void  Entity_Kill( EntityID entity )
 

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

  Source: [LuaEntity.cpp (266)]  

Void  Entity_Kill_Gibbing( EntityID entity )
 

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

  Source: [LuaEntity.cpp (306)]  

Void  Entity_Kill_Ragdoll( EntityID entity )
 

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

  Source: [LuaEntity.cpp (286)]  

Boolean  Entity_ResetCrushInfantry( EntityID pEntity )
 

Reset crush humans to default for entity (does nothing if entity cannot crush). 

returns true if crush mode set, false otherwise

  Source: [LuaEntity.cpp (883)]  

Boolean  Entity_ResetCrushMode( EntityID pEntity )
 

Reset crush mode to default for entity (does nothing if entity cannot crush). 

returns true if crush mode set, false otherwise

  Source: [LuaEntity.cpp (854)]  

Void  Entity_ResetUnconscious( EntityID entity )
 

Resets all Unconscious overrides to default AE values 

Resets all Unconscious overrides to default AE values

  Source: [LuaEntity.cpp (616)]  

Void  Entity_RevertStrategicPointToNeutral( EntityID entity )
 

Slowly reverts a strategic point to neutral (not owned by any team) as if the current owner were losing control. 

  Source: [LuaEntity.cpp (727)]  

Void  Entity_SetAnimatorAction( EntityID pEntity, String actionName )
 

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

  Source: [LuaEntity.cpp (518)]  

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

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

  Source: [LuaEntity.cpp (507)]  

Void  Entity_SetAnimatorEvent( EntityID pEntity, String eventName )
 

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

  Source: [LuaEntity.cpp (496)]  

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 

  Source: [LuaEntity.cpp (529)]  

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

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

  Source: [LuaEntity.cpp (540)]  

Boolean  Entity_SetCrushInfantry( EntityID pEntity, Boolean crush )
 

Set crush humans for entity (does nothing if entity cannot crush). 

returns true if crush humans set, false otherwise

  Source: [LuaEntity.cpp (869)]  

Boolean  Entity_SetCrushMode( EntityID pEntity, Integer crushMode )
 

Set crush mode for entity (does nothing if entity cannot crush). 

returns true if crush mode set, false otherwise

  Source: [LuaEntity.cpp (835)]  

Void  Entity_SetHeading( EntityID entity, Position pos )
 

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

  Source: [luaentity.cpp (147)]  

Void  Entity_SetHealth( EntityID entity, Real healthPercent )
 

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

  Source: [LuaEntity.cpp (204)]  

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. 

  Source: [Entity.scar (17)]  

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

  Source: [LuaEntity.cpp (583)]  

Void  Entity_SetPlayerOwner( EntityID entity, PlayerID owner )
 

Changes the owner of the given entity. 

  Source: [LuaEntity.cpp (127)]  

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) 

  Source: [luaentity.cpp (135)]  

Void  Entity_SetStrategicPointNeutral( EntityID entity )
 

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

  Source: [LuaEntity.cpp (711)]  

Void  Entity_SetTeamColourByIndex( EntityID pEntity, Integer primaryIndex, Integer secondaryIndex, Integer tintIndex, Integer extraIndex, Integer badgeIndex, Integer patternIndex )
 

Sets team colour of an entity based on indeces in in armyPainterColours.lua file. 

  Source: [LuaEntity.cpp (896)]  

Void  Entity_SetUnconsciousEnabled( EntityID entity, Boolean enabled )
 

Sets Unconscious override value 

Sets Unconscious override value

  Source: [LuaEntity.cpp (627)]  

Void  Entity_Spawn( EntityID entity )
 

Spawn the entity at its current position 

  Source: [luaentity.cpp (153)]  

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.

  Source: [LuaModExtensions.cpp (224)]  

Void  Entity_TagDebug( EntityID entity )
 

Tags the entity to be used for debugging 

  Source: [luaentity.cpp (209)]  

Void  Entity_VisHide( EntityID pEntity, Boolean bHide )
 

Hides or shows an entity visually. 

  Source: [luaentity.cpp (216)]  

Void  ModMisc_MakeWreckAction( EntityID pTargetEntity )
 

Make the passed entity a wreck by triggering the MakeWreckAction 

  Source: [LuaModMisc.cpp (52)]  

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.

  Source: [LuaModMisc.cpp (64)]  

 

 

FOW
Functions

Void  FOW_EnableRevealEntitySquadRequests( PlayerID player, Boolean enable )
 

enables / disables future un-forced requests to reveal either entities or squads in FOW (typically via combat events) sent to attacked player. 

  Source: [LuaFOW.cpp (395)]  

Void  FOW_RevealAll( Void  )
 

Reveal FOW for all players 

  Source: [LuaFOW.cpp (358)]  

Void  FOW_RevealArea( Real x, Real z, 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 )

  Source: [LuaFOW.cpp (166)]  

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 )

  Source: [LuaFOW.cpp (242)]  

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 )

  Source: [LuaFOW.cpp (263)]  

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 )

  Source: [LuaFOW.cpp (210)]  

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

  Source: [ScarUtil.scar (874)]  

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 )

  Source: [LuaFOW.cpp (289)]  

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 )

  Source: [LuaFOW.cpp (310)]  

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 )

  Source: [LuaFOW.cpp (226)]  

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.

  Source: [LuaFOW.cpp (336)]  

Void  FOW_UnRevealAll( Void  )
 

Use to undo a FOW_RevealAll 

  Source: [LuaFOW.cpp (374)]  

Void  FOW_UnRevealArea( Real x, Real z, Real radius )
 

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

  Source: [LuaFOW.cpp (194)]  

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

  Source: [ScarUtil.scar (895)]  

Void  FOW_UnTagSGroup( PlayerID player, SGroupID group )
 

Removes items from a players FOW that were added using FOW_TagSGroup 

  Source: [LuaFOW.cpp (347)]  

 

 

Game
Functions

Void  Game_EnableInput( Boolean enabled )
 

Enables/Disables all input EXCEPT for ESC and F10. 

  Source: [LuaGame.cpp (80)]  

Real  Game_GetSimRate( Void  )
 

Gets the simulation rate in ticks per second 

  Source: [LuaGame.cpp (295)]  

Void  Game_HideSystemMessage( LocString msg )
 

Removes a message added by Game_ShowSystemMessage. 

  Source: [LuaGame.cpp (133)]  

Boolean  Game_IsCoop( Void  )
 

 

  Source: [LuaGame.cpp (307)]  

Void  Game_QuitApp( Void  )
 

Quits the app immediately 

  Source: [LuaGame.cpp (177)]  

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 

  Source: [LuaGame.cpp (223)]  

Void  Game_SetSimRate( Real rate )
 

Sets the simulation rate in ticks per second 

  Source: [LuaGame.cpp (301)]  

Void  Game_ShowSystemMessage( LocString msg )
 

Shows a system message in the area where Game Paused text appears/ 

Call Game_HideSystemMessage to remove the message.

  Source: [LuaGame.cpp (111)]  

Void  Game_StopGameToPerformanceTest( Void  )
 

Quits out of the game and returns the user to the performance test ending overlay. 

  Source: [LuaGame.cpp (196)]  

Boolean  Misc_IsCommandLineOptionSet( String option )
 

Returns true if -option is specified on the command line (don't pass the dash in the string) - does not work in RTM or MP 

  Source: [LuaGame.cpp (313)]  

 

 

General
Functions

Void  ModMisc_TriggerDcaAction( String actionName, Real durationSecs, Math::Vector3f pos, PlayerID player )
 

Trigger a DCA Action on a Position 

Triggers a DCA Action on a Position.

  Source: [LuaModMisc.cpp (76)]  

 

 

ID
Functions

LuaTable  EGroup_CreateTable( String format, Integer size )
 

Returns a table of egroups NOT in the world builder 

See Marker_GetTable for more info on format parameter

  Source: [UID.scar (110)]  

LuaTable  EGroup_GetWBTable( String format )
 

Returns a table of egroups from the world builder 

See Marker_GetTable for more info on format parameter

  Source: [UID.scar (90)]  

LuaTable  Marker_GetNonSequentialTable( String format, Integer 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' 

  Source: [UID.scar (72)]  

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

  Source: [UID.scar (60)]  

LuaTable  SGroup_CreateTable( String format, Integer size )
 

Returns a table of sgroups NOT in the world builder 

See Marker_GetTable for more info on format parameter

  Source: [UID.scar (120)]  

LuaTable  SGroup_GetWBTable( String format )
 

Returns a table of sgroups from the world builder 

See Marker_GetTable for more info on format parameter

  Source: [UID.scar (100)]  

 

 

Leveling
Functions

Boolean  Leveling_EntitySupportsLeveling( EntityID entity )
 

Determine if entity supports leveling. 

Returns true if entity can support leveling, false otherwise.

  Source: [LuaLeveling.cpp (165)]  

Integer  Leveling_GetAvailableAttributePoints( SquadID squad )
 

Get unspent attribute points of given squad. 

Returns the unspent portion of attribute points. returns 0 if squad does not support leveling.

  Source: [LuaLeveling.cpp (221)]  

Real  Leveling_GetBaseExperienceForEntityBlueprint( Integer blueprintID )
 

Returns the base experience value for the given blueprint (i.e., the experience gifted to attackers). 

  Source: [LuaLeveling.cpp (236)]  

Integer  Leveling_GetEntityLevel( EntityID entity )
 

Get entity level. 

Returns current level of entity. Returns 0 if squad does not support leveling.

  Source: [LuaLeveling.cpp (194)]  

Real  Leveling_GetLevelInfoExperienceModifierForLevel( SquadID squad, Integer level )
 

Returns the experience multiplier value for the given level. 

  Source: [LuaLeveling.cpp (252)]  

Real  Leveling_GetLevelInfoRequiredXPForLevel( Integer level )
 

Returns the earned experience value required to reach the given level. 

  Source: [LuaLeveling.cpp (260)]  

Integer  Leveling_GetMaximumLevel( Void  )
 

Returns the maximum number of levels. 

  Source: [LuaLeveling.cpp (268)]  

Real  Leveling_GetSquadExperience( SquadID squad )
 

Get squad experience. 

Returns current XP of squad. Returns 0 if squad does not support leveling.

  Source: [LuaLeveling.cpp (204)]  

Integer  Leveling_GetSquadLevel( SquadID squad )
 

Get squad level. 

Returns current level of squad based on XP. Returns 0 if squad does not support leveling.

  Source: [LuaLeveling.cpp (177)]  

Void  Leveling_ModifySquadAttribute( SquadID squad, Integer attributeType, Integer attributePoints )
 

Adjust attribute points of a squad (adds points, you can pass in negatives to lower). 

Adds attribute points of given squad to attribute level of attributeType. attributeType should be one of: LEVELING_ATTRIB_POINTS_Health, LEVELING_ATTRIB_POINTS_Energy, LEVELING_ATTRIB_POINTS_Melee, LEVELING_ATTRIB_POINTS_Ranged, Throws exception if attributeType is invalid. Throws an error if squad does not support leveling.

  Source: [LuaLeveling.cpp (301)]  

Void  Leveling_ModifySquadBonusAttribute( SquadID squad, Integer attributeType, Integer attributePoints )
 

Adjust bonus attribute points of a squad (adds points, you can pass in negatives to lower). 

Adds attribute points of given squad to attribute level of attributeType. attributeType should be one of: LEVELING_ATTRIB_POINTS_Health, LEVELING_ATTRIB_POINTS_Energy, LEVELING_ATTRIB_POINTS_Melee, LEVELING_ATTRIB_POINTS_Ranged, Throws exception if attributeType is invalid. Throws an error if squad does not support leveling.

  Source: [LuaLeveling.cpp (327)]  

Void  Leveling_RewardSGroupWithExperience( SGroupID sgroup, Real experience )
 

Add experience points to given squad group. 

Adds experience points to all squads in given squad group. Only rewards squads with leveling support.

  Source: [LuaLeveling.cpp (71)]  

Void  Leveling_RewardSquadWithExperience( SquadID squad, Real experience )
 

Add experience points to given squad. 

Adds experience points to given squad. Does nothing if squad does not support leveling.

  Source: [LuaLeveling.cpp (53)]  

Void  Leveling_SetEntityLevel( EntityID entity, Integer level )
 

Sets the given entity's level to the given level. 

  Source: [LuaLeveling.cpp (286)]  

Void  Leveling_SetSGroupInitialExperience( SGroupID sgroup, Real experience )
 

Sets the sgroups experience, without broadcasting the event (i.e. no UI/campaign notifications). 

  Source: [LuaLeveling.cpp (123)]  

Void  Leveling_SetSquadInitialExperience( SquadID squad, Real experience )
 

Sets the squads experience, without broadcasting the event (i.e. no UI/campaign notifications). 

  Source: [LuaLeveling.cpp (99)]  

Void  Leveling_SetSquadLevel( SquadID squad, Integer level )
 

Sets the given squad's level to the given level. 

  Source: [LuaLeveling.cpp (274)]  

Boolean  Leveling_SquadSupportsLeveling( SquadID squad )
 

Determine if squad supports leveling. 

Returns true if squad supports leveling, false otherwise.

  Source: [LuaLeveling.cpp (153)]  

 

 

Marker
Functions

Boolean  Marker_DoesNumberAttributeExist( MarkerID marker, String attrname )
 

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

  Source: [LuaMarker.cpp (221)]  

Boolean  Marker_DoesStringAttributeExist( MarkerID marker, String attrname )
 

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

  Source: [LuaMarker.cpp (210)]  

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 ( "" ) 

  Source: [LuaMarker.cpp (99)]  

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_

  Source: [LuaMarker.cpp (80)]  

Position  Marker_GetDirection( MarkerID marker )
 

Returns a vector for the marker direction 

  Source: [LuaMarker.cpp (238)]  

String  Marker_GetName( MarkerID marker )
 

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

  Source: [LuaMarker.cpp (169)]  

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.

  Source: [LuaMarker.cpp (183)]  

Position  Marker_GetPosition( MarkerID marker )
 

Returns the position of a given marker. 

  Source: [LuaMarker.cpp (108)]  

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. 

  Source: [LuaMarker.cpp (163)]  

Integer  Marker_GetProximityType( MarkerID marker )
 

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

  Source: [LuaMarker.cpp (157)]  

Pos  Marker_GetRandomPosition( MarkerID/Pos marker[, Real range] )
 

Returns a random position within the marker's proximity. Range is ignored for rectangular markers 

  Source: [MoreUtils.scar (36)]  

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. 

This function no longer looks for a specific marker type.

  Source: [MoreUtils.scar (75)]  

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.

  Source: [LuaMarker.cpp (199)]  References: [MarkerTypes.lua]

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) 

  Source: [LuaMarker.cpp (175)]  

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

  Source: [LuaMarker.cpp (232)]  

 

 

MetaCampaign
Functions

Void  Campaign_AddNotification( LuaBinding::StackVarTable textTable, String category, String small_icon, String large_icon, LuaBinding::StackVarTable effectTable, Boolean silent )
 

Adds an arbitrary notification accessible from the front end. effectTable is a table of {text=123,colour={red=255,green=255,blue=255,alpha=255}} tables 

  Source: [CampaignLua.cpp (904)]  

Void  Campaign_ForceImmediateActivation( String missionID, String locationID )
 

  Source: [CampaignLua.cpp (589)]  

Integer  Campaign_GetActiveGoalDayAssigned( String goalID )
 

  Source: [CampaignLua.cpp (729)]  

Integer  Campaign_GetAverageSquadLevel( Void  )
 

  Source: [CampaignLua.cpp (404)]  

Integer  Campaign_GetCompletedMissionCountSinceDate( Integer missionType, const int date )
 

  Source: [CampaignLua.cpp (679)]  

String  Campaign_GetCurrentEventPlanet( Void  )
 

  Source: [CampaignLua.cpp (619)]  

String  Campaign_GetCurrentPlayerPlanet( Void  )
 

  Source: [CampaignLua.cpp (607)]  

Integer  Campaign_GetDay( Void  )
 

  Source: [CampaignLua.cpp (58)]  

Integer  Campaign_GetEventExecutedCount( String eventID, String planetID )
 

Return the # of times the specified event has executed on the specified planet 

  Source: [CampaignLua.cpp (519)]  

Integer  Campaign_GetGoalKillCount( String goalID )
 

  Source: [CampaignLua.cpp (704)]  

Integer  Campaign_GetHighestSquadLevel( Void  )
 

  Source: [CampaignLua.cpp (417)]  

Integer  Campaign_GetKillCount( String filter )
 

  Source: [CampaignLua.cpp (662)]  

String  Campaign_GetMissionAtLocation( String locationID )
 

Returns the ID of the mission that is currently populated at a given location 

  Source: [CampaignLua.cpp (998)]  

String  Campaign_GetMissionLocation( String missionID )
 

Returns the locationID of the location a mission is populated on if it is active 

  Source: [CampaignLua.cpp (826)]  

Integer  Campaign_GetOwnedStratagemCount( String planetID, String ebp )
 

  Source: [CampaignLua.cpp (541)]  

LuaBinding::StackVarTable  Campaign_GetSquad( String pbg )
 

Returns a table containing data about the squad 

  Source: [CampaignLua.cpp (961)]  

Integer  Campaign_GetSquadSpendableAttributePoints( String pbgDir )
 

Gets the number of spendable attribute points for the squad specified 

  Source: [CampaignLua.cpp (949)]  

Integer  Campaign_GetStratagemLastOwnershipChangeDayCount( String locationID, String ebp )
 

  Source: [CampaignLua.cpp (754)]  

Integer  Campaign_GetStratagemOwnership( String locationID, String ebp )
 

  Source: [CampaignLua.cpp (290)]  

Integer  Campaign_GetTyranidRating( String planetID )
 

  Source: [CampaignLua.cpp (494)]  

Void  Campaign_GrantExperienceToSquad( String pbgDir, Real experience )
 

Grants the amount of experience specified to the squad pbg specified.  

  Source: [CampaignLua.cpp (927)]  

Boolean  Campaign_IsCoop( Void  )
 

  Source: [CampaignLua.cpp (1113)]  

Boolean  Campaign_IsGoalComplete( String goalID )
 

  Source: [CampaignLua.cpp (125)]  

Boolean  Campaign_IsGoalExpired( String goalID )
 

  Source: [CampaignLua.cpp (143)]  

Boolean  Campaign_IsLocationLocked( String locationID )
 

  Source: [CampaignLua.cpp (161)]  

Boolean  Campaign_IsMissionActive( String missionID )
 

  Source: [CampaignLua.cpp (107)]  

Boolean  Campaign_IsMissionComplete( String missionID )
 

  Source: [CampaignLua.cpp (71)]  

Boolean  Campaign_IsMissionExpired( String missionID )
 

  Source: [CampaignLua.cpp (89)]  

Boolean  Campaign_IsPlanetLocked( String planetID )
 

  Source: [CampaignLua.cpp (793)]  

Boolean  Campaign_IsStratagemThreatened( String locationID, String ebp )
 

  Source: [CampaignLua.cpp (365)]  

Void  Campaign_ModifyTyranidRating( String planetID, Integer ratingDelta )
 

  Source: [CampaignLua.cpp (447)]  

Void  Campaign_PingSquadTab( String pbgDir, Boolean on )
 

  Source: [CampaignLua.cpp (1119)]  

Void  Campaign_PingWargear( String wargearName, Boolean on )
 

Pings a wargear icon in the bridge inventory screen. 

  Source: [CampaignLua.cpp (1085)]  

Void  Campaign_PlaySpeech( String movieName, Integer locID )
 

  Source: [CampaignLua.cpp (631)]  

Void  Campaign_ResetDeployments( Void  )
 

  Source: [CampaignLua.cpp (652)]  

Void  Campaign_SetLocationLocked( String locationID, Boolean locked )
 

  Source: [CampaignLua.cpp (179)]  

Void  Campaign_SetNextGameplayTip( String icon, LocString title, LocString description )
 

Shows a gameplay tip on the next loading screen 

  Source: [CampaignLua.cpp (876)]  

Void  Campaign_SetNextLoadingScreenBackground( String texture )
 

Shows a background image on the next loading screen 

  Source: [CampaignLua.cpp (894)]  

Void  Campaign_SetSquadAttribute( String pbgDir, Integer attributeType, Integer attributeValue )
 

Sets an attribute value for the squad specified. 

Setting a squad attribute in this way is not undoable by the player, use with care.

  Source: [CampaignLua.cpp (983)]  

Void  Campaign_SetSquadLevel( String pbgDir, Integer level )
 

Sets the level of the squad pbg specified 

  Source: [CampaignLua.cpp (937)]  

Void  Campaign_SetSquadLocked( String pbgDir, Boolean locked )
 

  Source: [CampaignLua.cpp (195)]  

Void  Campaign_SetSquadOwner( String pbgDir, Integer owner )
 

  Source: [CampaignLua.cpp (205)]  

Void  Campaign_SetStratagemOwnership( String locationID, String ebp, Integer ownership )
 

  Source: [CampaignLua.cpp (239)]  

Void  Campaign_SetStratagemThreatened( String locationID, String ebp, Boolean threatened )
 

  Source: [CampaignLua.cpp (330)]  

Void  Campaign_SetTyranidRating( String planetID, Integer newRating )
 

  Source: [CampaignLua.cpp (471)]  

Void  Campaign_SetUIVisibility( Integer uiState, Boolean enable )
 

Turn a part of the bridge UI on or off, valid values for uiState include: UIV_TyranidRating, UIV_Starmap, UIV_DebriefPerformance, UIV_StarmapPing, UIV_InventoryPing, UIV_SquadSelectionPing, UIV_AccoladesPing, UIV_StarmapCalderisPing, UIV_StarmapTyphonPing, UIV_StarmapMeridianPing, UIV_StarmapCalderisVisible, UIV_StarmapTyphonVisible, UIV_StarmapMeridianVisible, UIV_NotificationButtonPing, UIV_PlanetViewProvinces, UIV_SquadTabs, UIV_InventoryLevelPanelHighlight, UIV_InteractiveUIDuringSpeech,  

  Source: [CampaignLua.cpp (863)]  

 

 

Modifiers
Functions

Integer  Modifier_ApplyToEntity( ScarModifier modifier, EntityID entity )
 

Applies an entity modifier to an entity. 

  Source: [LuaModifier.cpp (246)]  

Integer  Modifier_ApplyToPlayer( ScarModifier modifier, PlayerID player )
 

Applies a player modifier to a player. 

  Source: [LuaModifier.cpp (276)]  

Integer  Modifier_ApplyToSquad( ScarModifier modifier, SquadID squad )
 

Applies a squad modifier to a squad. 

  Source: [LuaModifier.cpp (216)]  

Integer  Modifier_ApplyToWorld( ScarModifier modifier )
 

Applies an entity modifier to world owned objects. 

  Source: [LuaModifier.cpp (302)]  

ScarModifier  Modifier_Create( Integer applicationType, String modtype, Integer 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 or MUT_Enable.
exclusive :
value : The value for the modifier.
extname : The name of the entity/squad blueprint for when the applicationType is MAT_EntityType or MAT_SquadType.

  Source: [LuaModifier.cpp (116)]  

Void  Modifier_Destroy( ScarModifier modifier )
 

Todo. 

  Source: [LuaModifier.cpp (189)]  

Void  Modifier_Remove( ModID modifier )
 

Remove an applied modifier.  

  Source: [Modifiers.scar (86)]  

Void  Modifier_RemoveAllFromEGroup( EGroupID egroup )
 

Removes all SCAR-applied modifiers for a specific EGroup.  

  Source: [Modifiers.scar (173)]  

Void  Modifier_RemoveAllFromSGroup( SGroupID sgroup )
 

Removes all SCAR-applied modifiers for a specific SGroup.  

  Source: [Modifiers.scar (152)]  

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

Modifies the recharge time of an ability 

  Source: [Modifiers.scar (868)]  

ModID  Modify_CaptureTime( EGroupID sgroup, Real scalefactor )
 

Modifies the capture time of all strategic points in an EGroup 

  Source: [Modifiers.scar (773)]  

ModID  Modify_DisableCapture( EGroupID egroup, Real scalefactor )
 

Disables the capturability of strategic points in an EGroup 

  Source: [Modifiers.scar (803)]  

ModID  Modify_DisableHold( EGroupID group, Boolean disable )
 

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

  Source: [Modifiers.scar (918)]  

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

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

  Source: [Modifiers.scar (193)]  

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

Modifies the cost of an entity for a particular player. Possible resource types are RT_Requisition, RT_Power 

  Source: [Modifiers.scar (883)]  

ModID  Modify_KnockbackChance( SGroupID/EGroupID group, Knockback type, Real scalefactor )
 

Modifies the chance of a squad/entity being knocked back 

  Source: [Modifiers.scar (956)]  

ModID  Modify_PlayerProductionRate( PlayerID sgroup, Real scalefactor )
 

Modifies the production rate of a player. 

  Source: [Modifiers.scar (853)]  

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

Modifies a player's resource bonus received (ie. one-time resource gifts) Possible resource types are RT_Requisition, RT_Power 

  Source: [Modifiers.scar (275)]  

ModID  Modify_PlayerResourceRate( PlayerID playerId, Integer resourceType, Real scalefactor )
 

Modifies a player's incoming resource rate. Possible resource types are RT_Requisition, RT_Power 

  Source: [Modifiers.scar (253)]  

ModID  Modify_PlayerSightRadius( PlayerID player, Real scalefactor )
 

Modifies the sight radius for a player. 

  Source: [Modifiers.scar (599)]  

ModID  Modify_ProductionRate( EGroupID sgroup, Real scalefactor )
 

Modifies the production rate of all factories in an EGroup 

  Source: [Modifiers.scar (829)]  

ModID  Modify_ReceivedAccuracy( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the chance of a squad/entity being hit 

  Source: [Modifiers.scar (508)]  

ModID  Modify_ReceivedDamage( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the damage a squad/entity receives. 

  Source: [Modifiers.scar (469)]  

ModID  Modify_ReceivedSuppression( SGroupID sgroup, Real scalefactor )
 

Modifies the rate at which a squad gets suppressed 

  Source: [Modifiers.scar (548)]  

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

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

  Source: [Modifiers.scar (234)]  

ModID  Modify_SightRadius( SGroupID/EGroupID group, Real scalefactor )
 

Modifies the sight radius for an egroup or an sgroup. 

  Source: [Modifiers.scar (622)]  

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

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

  Source: [Modifiers.scar (717)]  

ModID  Modify_TargetPriority( SGroupID/EGroupID group, Integer addition )
 

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

  Source: [Modifiers.scar (732)]  

ModID  Modify_TerritoryRadius( EGroupID group, Real scalefactor )
 

Modifies the territory radius for an egroup or an sgroup. 

  Source: [Modifiers.scar (663)]  

ModID  Modify_UnitSpeed( SGroupID sgroup, Real scalefactor )
 

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

  Source: [Modifiers.scar (573)]  

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

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

  Source: [Modifiers.scar (206)]  

ModID  Modify_Upkeep( PlayerID playerId, Real scalefactor )
 

Modifies the upkeep for a player  

  Source: [Modifiers.scar (220)]  

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

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

  Source: [Modifiers.scar (903)]  

ModID  Modify_Vulnerability( SGroupID sgroup, 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. 

  Source: [Modifiers.scar (689)]  

ModID  Modify_WeaponAccuracy( SGroupID/EGroupID group, Real scalefactor )
 

Modifies a squad's weapon accuracy. 

  Source: [Modifiers.scar (331)]  

ModID  Modify_WeaponBurst( SGroupID/EGroupID group, Real scalefactor )
 

Modifies a squad's weapon burst time. 

  Source: [Modifiers.scar (399)]  

ModID  Modify_WeaponCooldown( SGroupID/EGroupID group, Real scalefactor )
 

Modifies a squad's weapon cooldown time. 

  Source: [Modifiers.scar (365)]  

ModID  Modify_WeaponDamage( SGroupID/EGroupID group, Real scalefactor )
 

Modifies a squad's weapon damage. 

  Source: [Modifiers.scar (434)]  

ModID  Modify_WeaponRange( SGroupID/EGroupID group, Real scalefactor )
 

Modifies a squad's weapon range. 

  Source: [Modifiers.scar (296)]  

 

 

NIS
Functions

Void  nis_clearmarker( Void  )
 

Call this function to stop playing NISes relative to a marker 

  Source: [LuaGameNIS.cpp (493)]  

Void  nis_debugdisplay( Boolean bDisplay )
 

If set to true extra debugging information will be displayed 

  Source: [LuaGameNIS.cpp (327)]  

Real  nis_getlength( String filename )
 

Returns the number of seconds an NIS will run for. Returns 0 if the NIS isn't found. 

  Source: [LuaGameNIS.cpp (499)]  

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

  Source: [LuaGameNIS.cpp (353)]  

Void  nis_setmarker( MarkerID marker )
 

Sets a scar marker to center an NIS on 

Call before triggering the nis_play

  Source: [LuaGameNIS.cpp (481)]  

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.

  Source: [LuaGameNIS.cpp (405)]  

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

  Source: [LuaGameNIS.cpp (379)]  

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

  Source: [LuaGameNIS.cpp (302)]  

 

 

Objectives
Functions

Void  Ghost_DisableSpotting( Void  )
 

Disable the spotting of enemy entities that may become ghosts in the FoW 

  Source: [LuaUI.cpp (3132)]  

Void  Ghost_EnableSpotting( Void  )
 

Enable the spotting of enemy entities that may become ghosts in the FoW 

  Source: [LuaUI.cpp (3126)]  

Void  Obj_AlertSitRep( PlayerID player, Integer id )
 

Create an on screen event cue to alert new sit rep 

  Source: [LuaUI.cpp (2188)]  

Integer  Obj_Create( LocString title, LocString desc, LocString completion, String icon, Integer type )
 

Create an objective and returns the unique ID for it 

type could either be OT_Primary, OT_Secondary

  Source: [LuaUI.cpp (2071)]  

Integer  Obj_GetState( Integer objectiveID )
 

Get objective state ( OS_Off, OS_Incomplete, OS_Complete, OS_Failed ) 

  Source: [LuaUI.cpp (2135)]  

Boolean  Obj_GetVisible( Integer objectiveID )
 

Get objective visibility 

  Source: [LuaUI.cpp (2153)]  

Void  Obj_SetCompletionText( Integer objectiveID, LocString completion )
 

Set completion text localization ID for the objective 

  Source: [LuaUI.cpp (2111)]  

Void  Obj_SetDescription( Integer objectiveID, LocString desc )
 

Set description text localization ID for the objective 

  Source: [LuaUI.cpp (2105)]  

Void  Obj_SetIcon( Integer objectiveID, String icon )
 

Set icon path for the objective 

  Source: [LuaUI.cpp (2117)]  

Void  Obj_SetObjectiveFunction( Integer id, Integer 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

  Source: [LuaUI.cpp (2166)]  

Void  Obj_SetState( Integer objectiveID, Integer state )
 

Set objective state ( OS_Off, OS_Incomplete, OS_Complete, OS_Failed ) 

  Source: [LuaUI.cpp (2123)]  

Void  Obj_SetTitle( Integer objectiveID, LocString title )
 

Set title text localization ID for the objective 

  Source: [LuaUI.cpp (2099)]  

Void  Obj_SetVisible( Integer objectiveID, Boolean visible )
 

Set objective visibility 

  Source: [LuaUI.cpp (2147)]  

ElementID  Objective_AddHintPoint( LuaTable objTable, Position pos[, LocString hintpointText, Float/Position objectiveArrowOffset] )
 

Adds a hintpoint style arrow and optional mouseover text tied to an objective. 'pos' can be group/entity/squad/marker. objectiveArrowOffset is an optional offset applied to the arrow's position (you can specify a height offset or a 3D position offset). 

  Source: [Objectives.scar (483)]  

PingID  Objective_AddPing( LuaTable objectiveTable, Position pos, Float radius )
 

Adds a tactical map ping to an objective 

  Source: [Objectives.scar (586)]  

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

Adds a minimap ping and a hintpoint style arrow (with optional mouseover text) to an objective. 'pos' can be group/entity/squad/marker. objectiveArrowOffset is an optional offset applied to the arrow's position (you can specify a height offset or a 3D position offset). 

  Source: [Objectives.scar (390)]  

Void  Objective_AlertSitRep( LuaTable objTable )
 

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

  Source: [Objectives.scar (1021)]  

Boolean  Objective_AreAllPrimaryObjectivesComplete( )
 

Returns whether all primary objectives have been completed. 

  Source: [Objectives.scar (784)]  

Void  Objective_Complete( LuaTable objTable[, Boolean bShowTitle, PlayerID player] )
 

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

  Source: [Objectives.scar (231)]  

Void  Objective_Fail( LuaTable objTable[, Boolean bShowTitle, PlayerID player] )
 

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

  Source: [Objectives.scar (321)]  

Void  Objective_ForceSitRep( LuaTable objTable )
 

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

  Source: [Objectives.scar (1033)]  

Integer  Objective_GetCounter( LuaTable objTable )
 

Returns the current count associated with this objective. 

  Source: [Objectives.scar (989)]  

Integer  Objective_GetTimerSeconds( LuaTable objTable )
 

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

  Source: [Objectives.scar (915)]  

Boolean  Objective_IsComplete( LuaTable objTable )
 

Returns whether an objective is complete 

  Source: [Objectives.scar (736)]  

Boolean  Objective_IsCounterSet( LuaTable objTable )
 

Returns true if a counter has been set for this objective 

  Source: [Objectives.scar (1005)]  

Boolean  Objective_IsFailed( LuaTable objTable )
 

Returns whether an objective is failed 

  Source: [Objectives.scar (752)]  

Void  Objective_IsStarted( LuaTable objTable )
 

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

  Source: [Objectives.scar (768)]  

Boolean  Objective_IsTimerSet( LuaTable objTable )
 

Returns true if a timer has been set for this objective 

  Source: [Objectives.scar (937)]  

Void  Objective_PauseTimer( LuaTable objTable )
 

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

  Source: [Objectives.scar (870)]  

ObjectiveID  Objective_Register( LuaTable objTable )
 

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

  Source: [Objectives.scar (76)]  

Void  Objective_RemovePing( LuaTable objectiveTable, Integer PingID )
 

Removes a tactical map ping from an objective 

  Source: [Objectives.scar (667)]  

Void  Objective_RemoveUIElements( LuaTable objTable, Integer elementID )
 

Removes a group of UI elements that were added by Objective_AddUIElements 

  Source: [Objectives.scar (503)]  

Void  Objective_ResumeTimer( LuaTable objTable )
 

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

  Source: [Objectives.scar (885)]  

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. 

  Source: [Objectives.scar (1052)]  

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" 

  Source: [Objectives.scar (952)]  

Void  Objective_Show( LuaTable objective_table, Boolean on/off )
 

Shows or hides an objective from the UI and tactical map 

  Source: [Objectives.scar (365)]  

Void  Objective_Start( LuaTable objTable[, Boolean bShowTitle, PlayerID player] )
 

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.

  Source: [Objectives.scar (169)]  

Void  Objective_StartTimer( LuaTable objTable, Integer 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 

  Source: [Objectives.scar (836)]  

Void  Objective_StopCounter( LuaTable objTable )
 

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

  Source: [Objectives.scar (975)]  

Void  Objective_StopTimer( LuaTable objTable )
 

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

  Source: [Objectives.scar (900)]  

Void  Objective_TogglePings( LuaTable objective_table, Boolean on/off )
 

Toggles minimap blips on or off. 

  Source: [Objectives.scar (377)]  

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 

  Source: [Objectives.scar (809)]  

Void  Sound_DisableSpeechEvent( Integer event )
 

Disables certain speech events. 

  Source: [LuaUI.cpp (2529)]  

Void  Sound_PreCacheSinglePlayerSpeech( String mission )
 

pre-caches single player speech. For instance pre-caching mission 1 speech is done like: Sound_PreCacheSinglePlayerSpeech( "mission01" ) 

  Source: [LuaUI.cpp (2550)]  

Void  UI_AddSquadTab( SquadID squad, Integer preferredSquadTabIndex )
 

Set squad to appear in UI tab at preferredSquadTabIndex. Use -1 to use the next available index. Specific indicies always win out over generic. 

  Source: [LuaUI.cpp (2864)]  

Void  UI_ClearBuildingPlacementCallback( Void  )
 

Clears the building placement callback. 

  Source: [LuaUI.cpp (2580)]  

Void  UI_ClearConstructionMenuCallback( Void  )
 

Clears the construction menu navigation callback. 

  Source: [LuaUI.cpp (2610)]  

Void  UI_ClearOptionOverride( String name )
 

Clears the override on an option. See LuaConsts.scar for list of available options. 

  Source: [LuaUI.cpp (3138)]  

Void  UI_ClearSubmenuNavigationCallback( Void  )
 

Clears the submenu navigation callback. 

  Source: [LuaUI.cpp (2595)]  

Void  UI_CreateEntityKickerMessage( PlayerID player, EntityID entity, LocString message )
 

Create a custom kicker message on the entity and display to the player 

  Source: [LuaUI.cpp (2335)]  

Void  UI_CreateEntityKickerMessageEx( PlayerID player, EntityID entity, LocString message, Real duration, Real red, Real green, Real blue, Real alpha )
 

Create a custom kicker message on the entity and display to the player 

red, green, blue and alpha use a scale of 0-255.

  Source: [LuaUI.cpp (2371)]  

Void  UI_CreateSquadKickerMessage( PlayerID player, SquadID squad, LocString message )
 

Create a custom kicker message on the squad and display to the player 

  Source: [LuaUI.cpp (2320)]  

Void  UI_CreateSquadKickerMessageEx( PlayerID player, SquadID squad, LocString message, Real duration, Real red, Real green, Real blue, Real alpha )
 

Create a custom kicker message on the squad and display to the player, includes colour and duration variables. 

red, green, blue and alpha use a scale of 0-255.

  Source: [LuaUI.cpp (2351)]  

Void  UI_EnableEventSkip( Boolean bCanSkip )
 

Enables or disables the users ability to skip events using the escape key. 

  Source: [LuaUI.cpp (2677)]  

Void  UI_EnableResourceTypeKicker( Integer resourceType, Boolean enable )
 

Enables or disables resource kickers. Possible resource types are RT_Requisition, RT_Power. 

  Source: [LuaUI.cpp (2664)]  

Void  UI_HideSquadControlGroupBindings( Boolean hide )
 

Hides/unhides the squad control group UI on the right side of the screen 

  Source: [LuaUI.cpp (2698)]  

Void  UI_RemoveSquadTab( SquadID squad )
 

Remove a squad tab. 

  Source: [LuaUI.cpp (2895)]  

Void  UI_RestrictBuildingPlacement( MarkerID mkr )
 

Only allow buildings to be placed inside a marker 

  Source: [LuaUI.cpp (2622)]  

Void  UI_SetAlliedBandBoxSelection( Boolean allow )
 

Sets the game to allow allied squads to be selected at the same time as your own squads 

  Source: [LuaUI.cpp (2616)]  

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: [Integer] building EBP, [integer] phase: CP_Selected, CP_StartedPlacing (only applicable to fields, fences and buildings that let you set facing), or CP_FinishedPlacing  

  Source: [LuaUI.cpp (2571)]  

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) 

  Source: [LuaUI.cpp (2601)]  

Void  UI_SetOptionOverride( String name, Integer value )
 

Overrides an option. See LuaConsts.scar for list of available options. 

  Source: [LuaUI.cpp (3169)]  

Void  UI_SetPingPosition( Integer pingID, Real x, Real y )
 

Set the position of a previously created ping on the minimap. 

  Source: [LuaUI.cpp (2286)]  

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) 

  Source: [LuaUI.cpp (2586)]  

Void  UI_ShowBossHealth( Boolean show, SquadID squad )
 

Shows/hides the boss health item at the top mid of screen. 

  Source: [LuaUI.cpp (2768)]  

Void  UI_ShowCoverOnNonSelectedUnits( Boolean show )
 

Shows/hides cover display on non-selected units 

  Source: [LuaUI.cpp (2724)]  

Void  UI_ShowDecorators( Boolean show )
 

Shows/Hides all decorators. 

  Source: [LuaUI.cpp (3068)]  

Void  UI_ShowInGameChatPanel( Boolean show )
 

Show/hide in game chat panel 

Show in game chat panel if show is true, hide otherwise.

  Source: [LuaUI.cpp (2815)]  

Void  UI_ShowInGameChatPanelMP( Boolean show )
 

Show/hide in game multiplayer chat panel 

Show in game multiplayer chat panel if show is true, hide otherwise.

  Source: [LuaUI.cpp (2840)]  

Void  UI_ShowIntelEventsPanel( Boolean show )
 

Shows/Hides the intel events panel 

  Source: [LuaUI.cpp (2924)]  

Void  UI_ShowLevelUpKickers( Boolean show )
 

Shows/hides level change kickers 

  Source: [LuaUI.cpp (2704)]  

Void  UI_ShowMenuButtonPanel( Boolean show )
 

Shows/Hides the menu button in the top right corner of the screen 

  Source: [LuaUI.cpp (2948)]  

Void  UI_ShowMiniMapPanel( Boolean show )
 

Shows/Hides the mini map at the bottom left corner of the screen 

  Source: [LuaUI.cpp (2996)]  

Void  UI_ShowObjectivesPanel( Boolean show )
 

Shows/Hides the objectives at the left side of the screen 

  Source: [LuaUI.cpp (3020)]  

Void  UI_ShowPauseMenu( Boolean show )
 

Shows/Hides the pause menu. 

  Source: [LuaUI.cpp (3087)]  

Void  UI_ShowScarPanel( Boolean show )
 

Shows/Hides the SCAR buttons panel at the top of the screen 

  Source: [LuaUI.cpp (2972)]  

Void  UI_ShowSelectionPanel( Boolean show )
 

Shows/hides the selection panel at the bottom right corner of the screen 

  Source: [LuaUI.cpp (2744)]  

Void  UI_ShowSquadTabs( Boolean show )
 

Shows/Hides the squad tabs at the top right of the screen. 

  Source: [LuaUI.cpp (3044)]  

Void  UI_ShowThreatArrow( Boolean visible, SquadID squad )
 

Toggle a threat arrow on/off for a squad, this arrow points out 

  Source: [LuaUI.cpp (2298)]  

Void  UI_ShowThreatArrowIn( Boolean visible, SquadID squad )
 

Toggle a threat arrow on/off for a squad, this arrow points in 

  Source: [LuaUI.cpp (2309)]  

Void  UI_UnrestrictBuildingPlacement( Void  )
 

Removes the restriction on building placement 

  Source: [LuaUI.cpp (2629)]  

 

 

Player
Functions

Void  Player_AddAbilityLockoutZone( PlayerID player, Integer pbgID, 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. 

  Source: [LuaPlayer.cpp (723)]  

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

Add resource to player, as opposed to just setting it. Possible resource types are RT_Requisition, RT_Power 

  Source: [Player.scar (299)]  

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.

  Source: [Player.scar (312)]  

Boolean  Player_AreSquadsNearMarker( PlayerID playerid, MarkerID marker )
 

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

  Source: [Player.scar (639)]  

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

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

  Source: [Player.scar (458)]  

Boolean  Player_CanSeeEntity( const ModPlayer* player, EntityID entity )
 

Returns true if a player can see a given entity 

  Source: [LuaPlayer.cpp (519)]  

Boolean  Player_CanSeePosition( const ModPlayer* player, Position pos )
 

Returns true if a player can see a given position. 

  Source: [LuaPlayer.cpp (533)]  

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

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

  Source: [Player.scar (473)]  

Boolean  Player_CanSeeSquad( const ModPlayer* 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.

  Source: [LuaPlayer.cpp (526)]  

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)

  Source: [Player.scar (658)]  

Void  Player_ClearAvailabilities( PlayerID player )
 

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

  Source: [LuaPlayer.cpp (717)]  

Void  Player_ClearPopCapOverride( PlayerID player )
 

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

  Source: [LuaPlayer.cpp (771)]  

PlayerID  Player_FindFirstEnemyPlayer( const ModPlayer* player )
 

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

  Source: [LuaPlayer.cpp (735)]  

PlayerID  Player_FromId( Integer id )
 

Returns a player given a player id. 

  Source: [LuaPlayer.cpp (204)]  

Integer  Player_GetAIBonusLevel( const ModPlayer* player )
 

Returns the bonus level for this player. 

  Source: [LuaPlayer.cpp (219)]  

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.

  Source: [Player.scar (324)]  

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.

  Source: [Player.scar (420)]  

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.

  Source: [Player.scar (383)]  

Integer  Player_GetBuildingsCount( PlayerID playerId )
 

Returns the total number of buildings owned by this player. 

  Source: [Player.scar (201)]  

Integer  Player_GetBuildingsCountExcept( PlayerID playerId, Table exceptions )
 

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

  Source: [Player.scar (223)]  

Integer  Player_GetBuildingsCountOnly( PlayerID playerId, Table building_names )
 

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

  Source: [Player.scar (258)]  

Integer  Player_GetCurrentPopulation( const ModPlayer* player, Integer capType )
 

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

  Source: [LuaPlayer.cpp (539)]  

LocString  Player_GetDisplayName( const ModPlayer* player )
 

Returns the players UI name. 

  Source: [LuaPlayer.cpp (573)]  

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.

  Source: [LuaPlayer.cpp (441)]  

Integer  Player_GetEntityCount( const ModPlayer* player )
 

Returns the number of entities a player currently owns 

  Source: [LuaPlayer.cpp (310)]  

String  Player_GetEntityName( const ModPlayer* player, Integer index )
 

Returns the name of an entity a player currently owns 

  Source: [LuaPlayer.cpp (322)]  

SGroupID  Player_GetHero( const ModPlayer* player )
 

Returns a SquadGroupObs containing the player's hero's squad 

This function returns a 'global' squad group with the name '__Player%dHero', 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.

  Source: [LuaPlayer.cpp (410)]  

Integer  Player_GetID( const ModPlayer* player )
 

Returns the id of the player 

  Source: [LuaPlayer.cpp (551)]  

Integer  Player_GetMaxPopulation( const ModPlayer* player, Integer capType )
 

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

  Source: [LuaPlayer.cpp (545)]  

Integer  Player_GetNumSlotItem( PlayerID player, Integer itemID )
 

Get the number of slot items with the same ID that the player has 

example: local item = Util_GetSlotItemID( "slot_item/boom_stick" )

  Source: [LuaPlayer.cpp (800)]  

Integer  Player_GetNumStrategicPoints( const ModPlayer* p )
 

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

  Source: [LuaPlayer.cpp (473)]  

Integer  Player_GetNumVictoryPoints( const ModPlayer* p )
 

Returns the number of strategic objectives this player owns 

  Source: [LuaPlayer.cpp (496)]  

Integer  Player_GetRace( const ModPlayer* player )
 

Returns the race index for the given player. 

  Source: [LuaPlayer.cpp (254)]  

String  Player_GetRaceName( const ModPlayer* player )
 

Returns the ME name of the race for a given player. 

  Source: [LuaPlayer.cpp (241)]  

String  Player_GetRaceString( const ModPlayer* player )
 

Returns the race name of this player in non-localized english (eg. "eldar", "orks", "space_marines") 

Compare using RACE_SPACEMARINE, RACE_ELDAR, RACE_ORK, RACE_IMPERIALGUARD, RACE_TYRANID defined in LuaConsts.scar)

  Source: [LuaPlayer.cpp (248)]  

Integer  Player_GetRelationship( const ModPlayer* player1, PlayerID player2 )
 

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

  Source: [LuaPlayer.cpp (266)]  

Real  Player_GetResource( const ModPlayer* player, Integer resourceType )
 

Returns the amount of resources a given player has. Possible resource types are RT_Requisition, RT_Power, RT_Waaagh 

  Source: [LuaPlayer.cpp (367)]  

Real  Player_GetResourceRate( const ModPlayer* player, Integer resourceType )
 

Returns the amount of resources a given player is getting per second. Possible resource types are RT_Requisition, RT_Power, RT_Waaagh 

  Source: [LuaPlayer.cpp (374)]  

Integer  Player_GetSlotItemAt( PlayerID player, Integer index )
 

Returns the ID of the slot item. Use Player_GetSlotItemCount to determine how many slot items the player has. The first index is 1 

  Source: [LuaPlayer.cpp (813)]  

Integer  Player_GetSlotItemCount( PlayerID player )
 

Returns how many slot items this player has 

  Source: [LuaPlayer.cpp (807)]  

Integer  Player_GetSquadCount( const ModPlayer* player )
 

Returns the number of squads a player currently owns 

  Source: [LuaPlayer.cpp (316)]  

SGroupID  Player_GetSquads( const ModPlayer* 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.

  Source: [LuaPlayer.cpp (384)]  

Position  Player_GetStartingPosition( const ModPlayer* player )
 

Returns the starting position for this player. NOTE: This is only useful in PvP and makes *no* sense in campaign mode. 

  Source: [LuaPlayer.cpp (235)]  

Integer  Player_GetTeam( const ModPlayer* p )
 

Get the team a player is on 

  Source: [LuaPlayer.cpp (260)]  

Integer  Player_GetUnitCount( const ModPlayer* player )
 

Returns the current number of units the player has. 

  Source: [LuaPlayer.cpp (304)]  

Real  Player_GetUpgradeCost( PlayerID player, Integer upgradeID, Integer resourceType )
 

Returns the cost of an upgrade. Possible resource types are RT_Requisition, RT_Power, RT_Waaagh. 

  Source: [LuaPlayer.cpp (777)]  

Void  Player_GiveSlotItem( PlayerID player, Integer itemID )
 

Gives a slot item to the player. Can fail due to not enough slots left 

  Source: [LuaPlayer.cpp (828)]  

Void  Player_GrantAbility( PlayerID pPlayer, Integer pbgID )
 

Grants the player an ability. 

  Source: [LuaPlayer.cpp (624)]  

boolean  Player_HasBuilding( PlayerID player, Blueprint/ID/Table 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

  Source: [Player.scar (125)]  

boolean  Player_HasBuildingsExcept( PlayerID playerId, Blueprint/ID/Table exceptions-entitytypes )
 

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

  Source: [Player.scar (88)]  

boolean  Player_HasBuildingUnderConstruction( PlayerID player, Blueprint/ID/Table entitytypes )
 

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

  Source: [Player.scar (163)]  

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.

  Source: [Player.scar (711)]  

Boolean  Player_HasUpgrade( const ModPlayer* pPlayer, Integer pbgID )
 

Return true if the squad has purchased the specified upgrade. 

  Source: [LuaPlayer.cpp (579)]  

Boolean  Player_IsAlive( const ModPlayer* player )
 

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

  Source: [LuaPlayer.cpp (272)]  

Boolean  Player_IsAllied( PlayerID playerId1, PlayerID playerId2 )
 

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

  Source: [Player.scar (78)]  

Boolean  Player_IsValid( const ModPlayer* player )
 

Returns true if player is valid (actually exists in the game still) 

  Source: [LuaPlayer.cpp (278)]  

Void  Player_Kill( PlayerID player )
 

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

  Source: [LuaPlayer.cpp (295)]  

Integer  Player_NumUpgradeComplete( const ModPlayer* 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) 

  Source: [LuaPlayer.cpp (558)]  

Boolean  Player_OwnsEGroup( PlayerID playerid, EGroupID egroup )
 

Returns true if a given player exculsivley owns all items in a group 

  Source: [Player.scar (598)]  

Boolean  Player_OwnsSGroup( PlayerID playerid, SGroupID sgroup )
 

Returns true if a given player exculsivley owns all items in a group 

  Source: [Player.scar (618)]  

Void  Player_RemoveAbilityLockoutZone( PlayerID player, Integer pbgID, MarkerID marker )
 

Removes a marker that was previously a lockout zone. 

  Source: [LuaPlayer.cpp (729)]  

Void  Player_ReplenishSlotItem( PlayerID player, Integer itemID )
 

Replenish slot items to the player. Only refills existing slots based on itemID type. 

itemID must be a SlotItemBag.

  Source: [LuaPlayer.cpp (840)]  

Void  Player_RestrictAddOnList( PlayerID playerid, Table addonlist )
 

Restrict a list of addons. 

list should contain an array of strings to restrict.

  Source: [Player.scar (566)]  

Void  Player_RestrictBuildingList( PlayerID playerid, Table blueprintlist )
 

Restrict a list of buildings. 

list should contain an array of strings to restrict.

  Source: [Player.scar (577)]  

Void  Player_RestrictResearchList( PlayerID playerid, StringTable list )
 

Restrict a list of research items. 

list should contain an array of strings to restrict.

  Source: [Player.scar (588)]  

Void  Player_SetAbilityAvailability( PlayerID pPlayer, Integer pbgID, Integer availability )
 

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

  Source: [LuaPlayer.cpp (607)]  

Void  Player_SetAIBonusLevel( PlayerID player, Integer bonusLevel )
 

Sets the bonus level for this player. Should the AI take over this player, this will be its difficulty / resourcing levels.  

  Source: [LuaPlayer.cpp (225)]  

Void  Player_SetAllCommandAvailability( PlayerID player, Integer availability )
 

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

  Source: [LuaPlayer.cpp (696)]  

Void  Player_SetCommandAvailability( PlayerID player, Integer cmdType, Integer availability )
 

Sets the availability of entity, squad and player commands. See Command_Entity, Command_Squad, and Command_Player for valid command types. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

  Source: [LuaPlayer.cpp (685)]  

Void  Player_SetConstructionMenuAvailability( PlayerID player, String menuName, Integer availability )
 

Sets the availability of construction menus by name. In AE, they're under type_construction. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT 

  Source: [LuaPlayer.cpp (705)]  

Void  Player_SetDefaultSquadMoodMode( PlayerID pPlayer, Integer mode )
 

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

  Source: [LuaPlayer.cpp (676)]  

Void  Player_SetEntityProductionAvailability( PlayerID pPlayer, Integer pbgID, Integer availability )
 

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

  Source: [LuaPlayer.cpp (662)]  

Void  Player_SetMaxCapPopulation( PlayerID playerid, Integer captype, Integer 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.

  Source: [Player.scar (528)]  

Void  Player_SetMaxPopulation( PlayerID playerid, Integer captype, Integer 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.

  Source: [Player.scar (489)]  

Void  Player_SetPopCapOverride( PlayerID player, Integer personnel, Integer vehicles )
 

Sets a pop cap override that ignores any modifiers. You can pass in -1 for a cap value to use the default [modified] value 

  Source: [LuaPlayer.cpp (761)]  

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

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

Possible resource types are RT_Requisition, RT_Power, RT_Waaagh.

  Source: [LuaPlayer.cpp (335)]  

Void  Player_SetSquadProductionAvailability( PlayerID pPlayer, Integer pbgID, Integer availability )
 

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

  Source: [LuaPlayer.cpp (645)]  

Void  Player_SetUpgradeAvailability( PlayerID pPlayer, Integer pbgID, Integer availability )
 

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

  Source: [LuaPlayer.cpp (590)]  

Void  Player_SetUpgradeCost( PlayerID player, UpgradeID upgrade, Real requisition, Real power )
 

Sets the cost of an upgrade. 

  Source: [Player.scar (699)]  

 

 

Presentation
Functions

Void  Actor_Clear( ActorTable actor )
 

Clear ties between an actor and any units 

  Source: [Actor.scar (142)]  

Void  Actor_PlaySpeech( ActorTable actor, Integer 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.*, etc...

  Source: [Actor.scar (183)]  

Void  Actor_PlaySpeechWithoutPortrait( ActorTable actor, Integer 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 

  Source: [Actor.scar (191)]  

Void  Actor_SetFromSGroup( ActorTable actor, SGroupID sgroup )
 

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

  Source: [Actor.scar (134)]  

Void  Actor_SetFromSquad( ActorTable actor, SquadID squad )
 

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

  Source: [Actor.scar (126)]  

 

 

Procedural.Ai
Functions

  Ai.ClearDebugRender( Void  )
 

Clears the render frame 

  Source: [StateMachine.scar (339)]  

  Ai.ComponentMananger:Add( Void  )
 

Add a component to the manager 

  Source: [StateMachine.scar (390)]  

  Ai.ComponentMananger:GetComponent( Void  )
 

Get a component 

  Source: [StateMachine.scar (403)]  

  Ai.ComponentMananger:SendEvent( Void  )
 

Send and event to the component 

  Source: [StateMachine.scar (412)]  

  Ai.ComponentMananger:UpdateComponents( Void  )
 

Update all components 

  Source: [StateMachine.scar (441)]  

  Ai.Disable( Void  )
 

Disables AI 

  Source: [StateMachine.scar (372)]  

  Ai.Enable( Void  )
 

Enables AI 

  Source: [StateMachine.scar (366)]  

  Ai.EnabledDebugRender( Void  )
 

Enables/Disables Debug Rendering 

  Source: [StateMachine.scar (349)]  

  Ai.GetState( Void  )
 

Returns the string id of a given components state 

  Source: [StateMachine.scar (469)]  

  Ai.IsEnabled( Void  )
 

Is AI Enabled 

  Source: [StateMachine.scar (378)]  

  Ai.IsEnabledDebugRender( Void  )
 

Is Debug Rendering Enabled 

  Source: [StateMachine.scar (360)]  

  Ai.StateMachineDef:AddTrait( Void  )
 

Add a Trait to a StateMachine 

  Source: [StateMachine.scar (163)]  

  Ai.StateMachineDef:AddTraits( Void  )
 

Add a table of Traits to a StateMachine 

  Source: [StateMachine.scar (170)]  

  Ai.StateMachineDef:DebugRender( Void  )
 

Draws a debug message to the screen for the component selected 

  Source: [StateMachine.scar (303)]  

  Ai.StateMachineDef:GetData( Void  )
 

Returns the Data the Statemachine 

  Source: [StateMachine.scar (291)]  

  Ai.StateMachineDef:GetState( Void  )
 

Returns the string id of the current state 

  Source: [StateMachine.scar (273)]  

  Ai.StateMachineDef:GetTimeActive( Void  )
 

Returns the duration the Statemachine has been active 

  Source: [StateMachine.scar (279)]  

  Ai.StateMachineDef:GetTimeInState( Void  )
 

Returns the duration of the current state 

  Source: [StateMachine.scar (285)]  

  Ai.StateMachineDef:GotoState( Void  )
 

Set a state. The state is a string value 

  Source: [StateMachine.scar (265)]  

  Ai.StateMachineDef:OnEnter( Void  )
 

PRIVATE - This should never be called 

  Source: [StateMachine.scar (240)]  

  Ai.StateMachineDef:OnEvent( Void  )
 

Sends an event to a StateMachine 

  Source: [StateMachine.scar (178)]  

  Ai.StateMachineDef:OnExit( Void  )
 

PRIVATE - This should never be called 

  Source: [StateMachine.scar (259)]  

  Ai.StateMachineDef:Process( Void  )
 

PRIVATE - This should never be called 

  Source: [StateMachine.scar (194)]  

  Ai.StateMachineDef:Update( Void  )
 

This is called once a frame/tick to update the state machine 

  Source: [StateMachine.scar (247)]  

  DebugPrintTraits( Void  )
 

This is a very useful function that can print out the TRAIT - STATE matrix 

  Source: [StateMachine.scar (119)]  

  GetDebugNameForTrait( Void  )
 

Builds a string of the TRAIT based on the name under which it was registered. 

  Source: [StateMachine.scar (109)]  

  InitializeAllTraitsAndStates( Void  )
 

This must be called after registering all the AI traits and states 

  Source: [StateMachine.scar (93)]  

  MakeStateMachineComponent( Void  )
 

Turns a given table into a component. This give it a Statemachine member 

  Source: [StateMachine.scar (145)]  

  NewStateMachine( Void  )
 

Returns a blank StateMachine 

  Source: [StateMachine.scar (156)]  

  RegisterEvent( Void  )
 

Use to build a list of EVENTS for AI functionality 

  Source: [StateMachine.scar (59)]  

  RegisterState( Void  )
 

Use to build a list of STATES for AI functionality 

  Source: [StateMachine.scar (52)]  

  RegisterTrait( Void  )
 

Use to build a list of TRAITS for AI functionality 

  Source: [StateMachine.scar (43)]  

 

 

Procedural.Backend
Functions

Boolean  ScarGameBackend.AnyReservedMarkersWithinRangeOf( Marker marker, String region, Int radius )
 

Queries all reserved markers to see if there is a conflict with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (494)]  

  ScarGameBackend.ApplyTeamColours( Void  )
 

Apply a custom team colour to any squad group previously setup by SetTeamColour 

  Source: [ProceduralBackend.scar (1126)]  

void  ScarGameBackend.CreatePlayerAllSquadsSGroup( PlayerIndex playerIndex )
 

This is used to initialize the SGroup of a given player 

  Source: [ProceduralBackend.scar (614)]  

void  ScarGameBackend.CreatePlayerAllStructureEGroup( PlayerIndex playerIndex )
 

This is used to initialize the SGroup of a given player 

  Source: [ProceduralBackend.scar (646)]  

Heroes  ScarGameBackend.GetHeroes( PlayerIndex playerIndex )
 

Given a player index (for co-op only) this returns the Hero for that player 

  Source: [ProceduralBackend.scar (636)]  

PlayerID  ScarGameBackend.GetHostPlayer( )
 

Returns the host players ID 

  Source: [ProceduralBackend.scar (691)]  

PlayerID  ScarGameBackend.GetHumanPlayers( )
 

Returns a table with all the players ID's 

  Source: [ProceduralBackend.scar (699)]  

String  ScarGameBackend.GetIndigenousRace( )
 

Returns the race string of the indigenous player 

  Source: [ProceduralBackend.scar (736)]  

PlayerID  ScarGameBackend.GetMainOpponentPlayer( )
 

Returns the player id of the indigenous player 

  Source: [ProceduralBackend.scar (750)]  

String  ScarGameBackend.GetMainOpponentRace( )
 

Returns the race string of the indigenous player 

  Source: [ProceduralBackend.scar (759)]  

Int  ScarGameBackend.GetMaxRadiusForMarker( Marker marker, String region )
 

Queries all reserved markers to see the max radius for this marker 

  Source: [ProceduralBackend.scar (523)]  

PlayerID  ScarGameBackend.GetNeutralPlayer( )
 

Returns the neutral player 

  Source: [ProceduralBackend.scar (713)]  

PlayerID  ScarGameBackend.GetPlayer( PlayerIndex playerIndex )
 

Given a player index this returns the player id 

  Source: [ProceduralBackend.scar (682)]  

Sgroup  ScarGameBackend.GetPlayerAllSquadsSGroup( PlayerIndex playerIndex )
 

Given a player index (for co-op only) this returns the SGroup that contains all the players units 

  Source: [ProceduralBackend.scar (624)]  

EGroup  ScarGameBackend.GetPlayerAllStructureEGroup( PlayerIndex playerIndex )
 

Given a player index (for co-op only) this returns the SGroup that contains all the players units 

  Source: [ProceduralBackend.scar (656)]  

String  ScarGameBackend.GetPlayerRace( PlayerIndex playerIndex )
 

Given a player index this returns a string id of the player's race 

  Source: [ProceduralBackend.scar (722)]  

Marker  ScarGameBackend.GetRandomUnreserveMarkerName( String region )
 

Returns a random unreserved with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (455)]  

  ScarGameBackend.IsCoop( Void  )
 

Checks if a mission is being played Co-operatively. 

  Source: [ProceduralBackend.scar (1109)]  

Boolean  ScarGameBackend.IsMarkerReserved( Marker marker, String region )
 

Query to determine if a given marker is reserved with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (439)]  

void  ScarGameBackend.ReserveAnyMarkersWithinRangeOf( Marker marker, String region, Int radius )
 

Reserves all Chaff markers within range of a given marker with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (561)]  

void  ScarGameBackend.ReserveMarker( Marker marker, String region, Int radius )
 

Used to reserve a marker with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (413)]  

  ScarGameBackend.SetTeamColour( Void  )
 

This takes an SGroup and a colour 

  Source: [ProceduralBackend.scar (1118)]  

Player  ScarGameBackend.SetupNextAvailablePlayer( String playerName, String playerRace, Int team )
 

Sets up a player and returns the index into the which player it is. 

  Source: [ProceduralBackend.scar (666)]  

void  ScarGameBackend.SpawnProceduralBoss( Marker marker, String region )
 

Used to unreserve a marker with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (1161)]  

void  ScarGameBackend.UnreserveAllChaffMarker( )
 

Unreserves all Chaff markers with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (477)]  

void  ScarGameBackend.UnreserveMarker( Marker marker, String region )
 

Used to unreserve a marker with regards to Encounter Spawning 

  Source: [ProceduralBackend.scar (394)]  

 

 

Procedural.Encounters
Functions

Void  Encounters.SpawnChaffUnits( String region[, Integer loadout] )
 

Spawn chaff units across a region defined in the map's t_RegionList table 

The race of the spawned units depends on the owner established in the t_RegionList table.

The unit type is determined by the naming of the marker and the units put in the global t_UnitList spawn table.

Loadout determines troopers in each squad -- leave out for min loadout; set to 0 for max.

  Source: [Encounters.scar (32)]  

 

 

Procedural.Entry
Functions

  entry.FinalizeSetup( Boolean show_squad_tab )
 

Finalize post-spawn setup for all heroes. 

delay -- (e.g., wargear delay), ui_delay -- (e.g., squad tabs and control groups delay)

  Source: [EntryManager.scar (237)]  

  entry.FinalizeSGroup( Boolean show_squad_tab] )
 

Finalize post-spawn setup for sgroup. 

delay -- (e.g., wargear delay), ui_delay -- (e.g., squad tabs and control groups delay)

  Source: [EntryManager.scar (245)]  

  entry.SpawnPlayerUnits( Void  )
 

Instance spawn all created heroes 

  Source: [EntryManager.scar (204)]  

  EntryManager_DefaultCreateUnits( Marker marker )
 

The default hero creation at mission start. 

Creates all unlocked heroes in the campaign. Does not spawn or finalize units.

  Source: [EntryManager.scar (71)]  

  EntryManager_DefaultSetupUnits( )
 

The default hero creation, spawn, and finalized setup to start mission. 

Performs a race specific entry for all unlocked heroes in the campaign.

  Source: [EntryManager.scar (52)]  

  EntryManager_DefaultSpawnCreatedSquads( SGroup sgroup, Marker marker, Boolean show_squad_tab )
 

The default hero spawn at mission start. 

Spawns given SGroup of squads in the race default manner. Finalizes units post spawn.

  Source: [EntryManager.scar (87)]  

  EntryManager_RequestUpdates( Void  )
 

Call to trigger EntryManager update events 

Starts running the EntryManager periodic rule, if not already running.

  Source: [EntryManager.scar (13)]  

 

 

Procedural.Quests
Functions

  Quests:SendEvent( Void  )
 

Send a Quest event to all quests registered for it 

  Source: [Quests.scar (290)]  

 

 

Production
Functions

Void  Prod_AddAddOnToList( String addonname, LuaTable list )
 

Adds a add-on item to a production list table. 

  Source: [Production.scar (66)]  

Void  Prod_AddResearchToList( String researchname, LuaTable list )
 

Adds a research item to a production list table. 

  Source: [Production.scar (59)]  

Void  Prod_AddSquadToList( String blueprintname, LuaTable list )
 

Adds a squad item to a production list table. 

  Source: [Production.scar (73)]  

Boolean  Prod_DoesListContainAddOn( String addonname, LuaTable list )
 

Returns true if a production list contains the given add-on item 

  Source: [Production.scar (88)]  

Boolean  Prod_DoesListContainResearch( String researchname, LuaTable list )
 

Returns true if a production list contains the given research item 

  Source: [Production.scar (81)]  

Boolean  Prod_DoesListContainSquad( String blueprintname, LuaTable list )
 

Returns true if a production list contains the given squad item 

  Source: [Production.scar (95)]  

Void  Prod_GetPlayerProductionList( PlayerID playerId, LuaTable list )
 

Gets everything a given player currently has in production. 

See Prod_GetProductionList for more info.

  Source: [Production.scar (136)]  

Void  Prod_GetProductionList( String egroupname, LuaTable list )
 

Checks all entities to see if they're production-capable and if so, adds their queued items to a Production Table. 

Use Prod_DoesListContainSquad etc to query the resulting production table.

Example:
local ProductionTable = { }
Prod_GetProductionList( "GRP_ANYENTITYGROUP", ProductionTable )
if(Prod_DoesListContainSquad("sbps_pvp_sm_assault_marine", ProductionTable) then
-- There is a building in GRP_ANYENTITYGROUP that is currently producing a space marine Squad_CanSeeEntity
end

  Source: [Production.scar (111)]  

Boolean  Prod_IsPlayerConstructing( PlaierID playerId, String buildingname )
 

Returns true the players henchmen are currently constructing a building with given blueprintname. 

Note: If you find that you are calling this function for tons of different buildings, we should change this function to take a constuction list (similar to the way production lists are handled)

  Source: [Production.scar (200)]  

Boolean  Prod_IsPlayerProducing( PlayerID playerId, LuaTable list, Boolean all )
 

Returns true if the player is producing all or any items in a production table. See Prod_IsProducing for more info. 

  Source: [Production.scar (144)]  

Boolean  Prod_IsProducing( String egroupname, LuaTable list, Boolean all )
 

Returns true if buildings in a entity group are producing ALL or ANY items in a given production table. 

Use Prod_AddSquadToList etc to add entries to the given production list.

Example:
local ProductionTable = { }
Prod_AddSquadToList( "sbps_pvp_sm_devastator", list )
Prod_AddSquadToList( "sbps_pvp_sm_devastator", list )
Prod_AddSquadToList( "sbps_pvp_sm_tactical_marine", list )
if( Prod_IsProducing( "GRP_ANYENTITYGROUP", ProcutionTable, true ) then
-- Of all the buildings in GRP_ANYENTITYGROUP, they are producing 2 devastators and a tactical marine.
end

  Source: [Production.scar (162)]  

 

 

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

  Source: [Proximity.scar (366)]  

Boolean  Prox_ArePlayerMembersNearMarker( PlayerID player, MarkerID/Position pos, Boolean all[, Real range, Boolean allow_infiltrated] )
 

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. If you are using a marker and specify a range, that range will be used instead of the marker's proximity.

  Source: [Proximity.scar (454)]  

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

  Source: [Proximity.scar (432)]  

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

  Source: [Proximity.scar (283)]  

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

  Source: [Proximity.scar (251)]  

Boolean  Prox_AreTeamMembersNearMarker( TeamID team, Position/MarkerID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL of the individual members of a team's squads are within the given area. 

  Source: [Team.scar (579)]  

Boolean  Prox_AreTeamsNearMarker( TeamID team, Position/MarkerID position, Boolean all[, Real range] )
 

Returns true if ANY or ALL of a team's squads are within the given area. 

  Source: [Team.scar (563)]  

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.

  Source: [Proximity.scar (157)]  

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.

  Source: [Proximity.scar (180)]  

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.

  Source: [Proximity.scar (617)]  

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.

  Source: [Proximity.scar (203)]  

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.

  Source: [Proximity.scar (226)]  

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.

  Source: [Proximity.scar (578)]  

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.

  Source: [Proximity.scar (565)]  

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.

  Source: [Proximity.scar (526)]  

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.

  Source: [Proximity.scar (513)]  

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.

  Source: [Proximity.scar (552)]  

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.

  Source: [Proximity.scar (539)]  

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.

  Source: [Proximity.scar (500)]  

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.

  Source: [Proximity.scar (134)]  

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.

  Source: [Proximity.scar (604)]  

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.

  Source: [Proximity.scar (591)]  

Boolean  Prox_TeamSquadsInProximityOfEntities( EGroupID egroup, Real proximity, Boolean all )
 

Checks if ALL or ANY team's 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.

  Source: [Team.scar (610)]  

Boolean  Prox_TeamSquadsInProximityOfSquads( TeamID team, SGroupID sgroup, Real proximity, Boolean all, SquadID exclude )
 

Checks if ALL or ANY team's 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.

  Source: [Team.scar (594)]  

  ProxCallback_PlayerSquadInProximityOfMarker( PlayerID playerID, MarkerID/Position marker, Real proximity, Boolean all, Function callback )
 

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

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY. Set proximity to nil to use the marker data.

  Source: [Proximity.scar (629)]  

  ProxCallback_PlayerSquadInProximityOfMarkerNotInfiltrated( PlayerID playerID, MarkerID/Position marker, Real proximity, Boolean all, Function callback )
 

Checks if ALL or ANY player squads that are not infiltrated are in proximity of a given marker. 

Set "all" to true to check that ALL entities are in proximity, or set "all" to false to check for ANY. Set proximity to nil to use the marker data.

  Source: [Proximity.scar (640)]  

 

 

RuleSystem
Functions

Rule Table  Rule:Add( ScarFunction Rule, Lua!Table params, Int interval, Int maxUses )
 

Create a rule to be maintained by the rule system 

  Source: [QuestRules.scar (40)]  

Rule Table  Rule:AddDelayed( ScarFunction Rule, Int delay, Lua!Table params )
 

Create a rule to run but start delayed 

  Source: [QuestRules.scar (103)]  

Rule Table  Rule:AddDelayedInterval( ScarFunction Rule, Int delay, Int interval, Lua!Table params )
 

Create a rule to run on an intervalbut start delayed 

  Source: [QuestRules.scar (117)]  

Rule Table  Rule:AddInterval( ScarFunction Rule, Int interval, Lua!Table params )
 

Create a rule to run on an interval 

  Source: [QuestRules.scar (82)]  

Rule Table  Rule:AddLimited( ScarFunction Rule, Int maxUses, Lua!Table params )
 

Create a rule to run a limited ammount of times 

  Source: [QuestRules.scar (89)]  

Rule Table  Rule:AddOneShot( ScarFunction Rule, Int delay, Lua!Table params )
 

Create a rule to run once after a set amount of seconds 

  Source: [QuestRules.scar (110)]  

Rule Table  Rule:AddWithParameter( ScarFunction Rule, Lua!Table params )
 

Create a rule to run with parameters 

  Source: [QuestRules.scar (96)]  

Void  Rule_Add( LuaFunction rule[, Integer 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. 

  Source: [RuleSystem.scar (31)]  

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

Add a rule to be executed at every 'interval' seconds, starting after 'delay' 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.

  Source: [RuleSystem.scar (92)]  

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

Add a rule to be executed at every 'interval' seconds, starting after 'delay' seconds, will run 'calls' times.  

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.

  Source: [RuleSystem.scar (131)]  

Void  Rule_AddEvent( LuaFunction f, Integer type )
 

Add a rule to be executed when a simulation event is sent. 

  Source: [LuaGameEventRuleSystem.cpp (708)]  

Void  Rule_AddEventIfNotAlreadyExisting( LuaFunction rule[, GameEventType eventType] )
 

Add a rule to be executed when a simulation event is sent. The rule is only added if it hasn't been added to the rule system at a prior time. 

  Source: [RuleSystem.scar (271)]  

Void  Rule_AddIfNotAlreadyExisting( LuaFunction rule[, Integer priority] )
 

Add a rule to be executed every frame if it has not already been added. 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. 

  Source: [RuleSystem.scar (39)]  

Void  Rule_AddInterval( LuaFunction rule, Real interval[, Integer 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. 

  Source: [RuleSystem.scar (83)]  

Void  Rule_AddIntervalEx( LuaFunction rule, Real interval, Integer calls[, Integer 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. 

  Source: [RuleSystem.scar (57)]  

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

Add a rule to be executed 'calls' times, at every 'interval' seconds if it has not already been added. 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. 

  Source: [RuleSystem.scar (65)]  

Void  Rule_AddIntervalIfNotAlreadyExisting( LuaFunction rule, Real interval[, Integer priority] )
 

Add a rule to be executed at every 'interval' seconds if it has not already been added. 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. 

  Source: [RuleSystem.scar (167)]  

Void  Rule_AddOneShot( LuaFunction rule, Real interval[, Integer 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. 

  Source: [RuleSystem.scar (185)]  

Void  Rule_AddOneShotIfNotAlreadyExisting( LuaFunction rule, Real interval[, Integer priority] )
 

Add a rule to be executed once, after 'interval' seconds if this rule does not already been added. 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. 

  Source: [RuleSystem.scar (193)]  

Void  Rule_ChangeInterval( LuaFunction rule, Real interval )
 

Change 'interval' seconds of an existing rule 

  Source: [RuleSystem.scar (211)]  

Boolean  Rule_EventExists( LuaFunction f )
 

Returns true if the given event rule exists. 

  Source: [LuaGameEventRuleSystem.cpp (679)]  

Void  Rule_EventRemoveMe( Void  )
 

Removes the currently executing event rule. 

  Source: [LuaGameEventRuleSystem.cpp (690)]  

Boolean  Rule_Exists( LuaFunction rule )
 

Test if a rule is currently active 

  Source: [RuleSystem.scar (258)]  

Void  Rule_Remove( LuaFunction rule )
 

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

  Source: [RuleSystem.scar (228)]  

Void  Rule_RemoveAll( [Integer max_priority] )
 

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

  Source: [RuleSystem.scar (248)]  

Void  Rule_RemoveAllEvents( Void  )
 

Remove all event rules. 

  Source: [LuaGameEventRuleSystem.cpp (656)]  

Void  Rule_RemoveEvent( LuaFunction f )
 

Removes the given event rule from the system. 

  Source: [LuaGameEventRuleSystem.cpp (722)]  

Void  Rule_RemoveIfExist( LuaFunction rule )
 

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

  Source: [RuleSystem.scar (237)]  

Void  Rule_RemoveMe( )
 

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

  Source: [RuleSystem.scar (218)]  

 

 

Setup
Functions

  Setup_Difficulty( PlayerID player[, Integer difficulty] )
 

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

  Source: [Setup.scar (74)]  

Real  Setup_GetVictoryPointTickerOption( Void  )
 

Get the victory point ticker option selected 

  Source: [LuaGameSetup.cpp (68)]  

PlayerID  Setup_Player( Integer playerIndex, LocString playerName, String playerRace, Integer 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: "space_marines", "imperial_guards", "orks", "eldar","tyranids"

Example:
function OnGameSetup( )
g_player1 = Setup_Player(0, "PlayerDisplayName", "space_marines", 1)
-- g_player2 and g_player3 will be on the same team (allies)
g_player2 = Setup_Player(1, "$20000", "eldar", 2)
g_player3 = Setup_Player(2, "$20001", "orks", 2)
--? The team ID starts from one!! end

  Source: [Setup.scar (42)]  

Void  Setup_SetPlayerName( PlayerID player, LocString name )
 

Set the UI name of a given player. 

  Source: [LuaGameSetup.cpp (61)]  

Void  Setup_SetPlayerOnlineLevel( PlayerID player, Integer onlineLevel )
 

Set the online level of a player 

  Source: [LuaGameSetup.cpp (90)]  

Void  Setup_SetPlayerRace( PlayerID player, Integer raceIndex )
 

Set the race for a given player. Use World_GetRaceIndex() to get the race index from the ME name. 

  Source: [LuaGameSetup.cpp (46)]  

Void  Setup_SetPlayerTeam( PlayerID p, Integer team_id )
 

Put a player in a team. Use TEAM_NEUTRAL as the team_id to set the player as neutral 

  Source: [LuaGameSetup.cpp (84)]  

 

 

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 

  Source: [Groups.scar (2463)]  

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

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

  Source: [Groups.scar (2781)]  

Void  SGroup_Add( SGroupID group, SquadID squadron )
 

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

  Source: [LuaGroup.cpp (507)]  

Void  SGroup_AddGroup( SGroupID group, SGroupID grouptoadd )
 

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

  Source: [LuaGroup.cpp (485)]  

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

  Source: [Groups.scar (1674)]  

Boolean  SGroup_CanInstantReinforceNow( SGroupID group, Boolean all )
 

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

  Source: [Groups.scar (2123)]  

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. 

  Source: [Groups.scar (1309)]  

  SGroup_CeaseFire( SGroupID sgroup )
 

Stops all squads in an sgroup firing of their own accord. You can still tell them to fire explicitly, though. 

  Source: [Groups.scar (2897)]  

Void  SGroup_Clear( SGroupID sgroup )
 

Removes all entities from a group. 

  Source: [LuaGroup.cpp (479)]  

Void  SGroup_ClearPostureSuggestion( SGroupID sgroup )
 

Clears any previous posture suggestions made to a squad 

  Source: [LuaModExtensions.cpp (73)]  

Void  SGroup_ClearSpecialAttackChanceOverride( SGroupID sgroup )
 

Sets the probability that a melee attack will be a special attack for each member of the sgroup back to default 

  Source: [LuaModExtensions.cpp (105)]  

Void  SGroup_ClearSyncKillChanceOverride( SGroupID sgroup )
 

Resets the SyncKill override, and reverts to the default synckill probabilities for each member of the sgroup 

  Source: [LuaModExtensions.cpp (139)]  

Void  SGroup_ClearSyncKillIDOverride( SGroupID sgroup )
 

Resets the sync kill id override that is used and reverts to default sync kill selection for each member of the sgroup. 

  Source: [LuaModExtensions.cpp (156)]  

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. 

  Source: [LuaGroup.cpp (501)]  

Boolean  SGroup_ContainsBlueprints( SGroupID sgroup, BlueprintTable blueprints, Boolean all )
 

Check if a group contains ALL or ANY of the items in a blueprint table. 

This function will validate all blueprint names.
Set all to true to check for all blueprints in the blueprintTable or set to false to check for any.
A blueprint table containing two assault marines and a tactical marine looks like so:
BlueprintTable = {
{ name = "sbps_pvp_sm_assault_marine", count = 2 }
{ name = "sbps_pvp_sm_tactical_marine", count = 1 }
}

You could also call Util_MakeBlueprintTable:
BlueprintTable = Util_MakeBlueprintTable( "sbps_pvp_sm_assault_marine", "sbps_pvp_sm_assault_marine", "sbps_pvp_sm_tactical_marine")

This function will take care of setting up the table for you.

  Source: [Groups.scar (1576)]  

Boolean  SGroup_ContainsSGroup( SGroupID group1, SGroupID group2, Boolean all )
 

Returns true if SGroup1 contains ANY or ALL of SGroup2 

Includes both spawned and despawned squads.

  Source: [LuaGroup.cpp (713)]  

Boolean  SGroup_ContainsSquad( SGroupID group, Integer SquadID )
 

Returns true if SGroup contains a particular SquadID 

Includes both spawned and despawned squads.

  Source: [LuaGroup.cpp (705)]  

Integer  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

  Source: [LuaGroup.cpp (461)]  

Integer  SGroup_CountDeSpawned( SGroupID sgroup )
 

Returns the number of despawned squads in a group. 

  Source: [LuaGroup.cpp (473)]  

Integer  SGroup_CountSpawned( SGroupID sgroup )
 

Returns the number of spawned squads in a group. 

  Source: [LuaGroup.cpp (467)]  

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( )

  Source: [LuaGroup.cpp (419)]  

SGroupID  SGroup_CreateIfNotFound( String name )
 

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

  Source: [Groups.scar (1377)]  

Void  SGroup_CreateKickerMessage( SGroupID group, PlayerID player, LocString textid[, String color, Float duration, Float alpha] )
 

Create and display kicker message on the each squad in the sgroup to the player 

  Source: [Groups.scar (2141)]  

Void  SGroup_CreateKickerMessageEx( SGroupID group, PlayerID player, LocString textid, Float duration, Float red, Float green, Float blue, Float alpha )
 

Create and display kicker message on the each squad in the sgroup to the player 

  Source: [Groups.scar (2217)]  

Void  SGroup_DeSpawn( SGroupID groupid )
 

Despawn all spawned squads in a group. 

  Source: [Groups.scar (1746)]  

Void  SGroup_Destroy( SGroupID egroup )
 

Manually destroy a group that you dont need anymore. 

  Source: [LuaGroup.cpp (439)]  

Void  SGroup_DestroyAllInMarker( SGroupID sgroup, MarkerID marker )
 

Destroys all items in a group that are in proximity to a given marker. 

  Source: [Groups.scar (1646)]  

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

  Source: [Groups.scar (1549)]  

Void  SGroup_DisableCombatPlans( SGroupID groupID )
 

Disables all current combat plans for the squads in the sgroup 

  Source: [Groups.scar (2709)]  

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.

  Source: [Groups.scar (2494)]  

Void  SGroup_Eject( SGroupID sgroup, Position destination )
 

Tells an SGroup to eject themselves from whatever they're inside (building or vehicle) 

  Source: [Groups.scar (2594)]  

Void  SGroup_EnableMinimapIndicator( SGroupID group, Boolean enable )
 

Enable or disable minimap indicator on all squads in the sgroup 

  Source: [Groups.scar (2057)]  

Void  SGroup_EnableSurprise( SGroupID groupid, Boolean enable )
 

Enables or disables the surprise feature for an sgroup 

  Source: [Groups.scar (1966)]  

Void  SGroup_EnableUIDecorator( SGroupID group, Boolean enable )
 

Enable or disable decorators on all squads in the sgroup  

  Source: [Groups.scar (2038)]  

Boolean  SGroup_Exists( String name )
 

Returns true if the squad group with the given name exists 

  Source: [LuaGroup.cpp (576)]  

Void  SGroup_FaceEachOther( SGroupID sgroup1, SGroupID sgroup2 )
 

Makes two SGroups face each other 

  Source: [Groups.scar (1689)]  

Void  SGroup_FaceMarker( SGroupID sgroup, MarkerID marker )
 

Makes a SGroup face a marker. 

  Source: [Groups.scar (1719)]  

Void  SGroup_Filter( SGroupID sgroup, String/ID/Table blueprint, Integer filtertype[, SGroupID splitgroup] )
 

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, while FILTER_REMOVE will strip those same squads out and leave those that aren't of the types listed. If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (2246)]  

Void  SGroup_FilterCount( SGroupID sgroup1, Int groupSize )
 

Pass in a group and it will filter it down to the indicated number 

  Source: [Groups.scar (2441)]  

  SGroup_FilterInfiltrated( SGroupID sgroup, Int filtertype[, SGroupID splitgroup] )
 

Filters an SGroup depending on who's infiltrated. Use a filtertype of FILTER_KEEP to keep the squads that are infiltrated and remove the ones that are visible, or FILTER_REMOVE to remove the squads that are infiltrated and keep the rest. 

If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (2397)]  

  SGroup_FilterUnconscious( SGroupID sgroup, Int filtertype[, SGroupID splitgroup] )
 

Filters an SGroup depending on who's unconscious. Use a filtertype of FILTER_KEEP to keep the squads that are down and remove the ones that are alive, or FILTER_REMOVE to remove the squads that are down and keep the rest. 

If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (2352)]  

  SGroup_FilterVisible( SGroupID sgroup, PlayerID player, Int filtertype[, SGroupID splitgroup] )
 

Filters an SGroup depending on who's visible from a given player's point of view. Use a filtertype of FILTER_KEEP to keep the squads you can see and remove the ones you can't, or FILTER_REMOVE to remove the squads you can see and keep the rest. 

If you specify a splitgroup, then units that would have been removed get moved into this group instead. This group is cleared beforehand.

  Source: [Groups.scar (2307)]  

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.

  Source: [LuaGroup.cpp (697)]  

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.

  Source: [LuaGroup.cpp (641)]  

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. 

  Source: [LuaGroup.cpp (590)]  

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. 

  Source: [LuaGroup.cpp (647)]  

SGroupID  SGroup_FromName( String name )
 

Find an squadron group with a given name. 

  Source: [LuaGroup.cpp (445)]  

Real  SGroup_GetAvgHealth( SGroupID sgroup )
 

Returns the average health of all units in a squad group as a weighted percent [0.0, 1.0]. 

Example: A group of squads with health 20/100 and 100/1000 would return 120/1100 ( approx 11 % )

  Source: [Groups.scar (1414)]  

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

  Source: [Groups.scar (1448)]  

Real  SGroup_GetCourage( SGroupID sgroup )
 

Returns the lowest courage out of all the squads in an SGroup. Set the level between 0.0 (suppressed) and 1.0 (fine) 

  Source: [Groups.scar (2878)]  

SquadID  SGroup_GetDeSpawnedSquadAt( SGroupID group, Integer 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().

  Source: [LuaGroup.cpp (541)]  

EntityID  SGroup_GetGarrisonedBuildingEntity( SGroupID groupid )
 

Get the entity id of the building that any squad of the sgroup is garrisoned in 

  Source: [Groups.scar (1902)]  

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.

  Source: [Groups.scar (1627)]  

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  

  Source: [Groups.scar (2767)]  

SquadID  SGroup_GetLoadedVehicleSquad( SGroupID groupid )
 

Get the squad id of the vehicle squad that any squad of the sgroup is loaded in 

  Source: [Groups.scar (1934)]  

String  SGroup_GetName( SGroupID sgroup )
 

Returns the name of a given squad group. 

  Source: [LuaGroup.cpp (584)]  

Int  SGroup_GetNumSlotItem( SGroupID group, Int itemID )
 

Get the number of slot items with the same ID that the squads in the sgroup own 

  Source: [Groups.scar (1859)]  

Position  SGroup_GetPosition( SGroupID group )
 

Returns the center position of a squad group. 

Despawned squads are ignored.

  Source: [LuaGroup.cpp (559)]  

SquadID  SGroup_GetRandomSpawnedSquad( SGroup sgroupid )
 

Get a random spawned squad from sgroup 

  Source: [Groups.scar (1807)]  

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. 

  Source: [Groups.scar (2666)]  

SquadID  SGroup_GetSpawnedSquadAt( SGroupID group, Integer 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().

  Source: [LuaGroup.cpp (522)]  

Real  SGroup_GetSpread( SGroupID sgroup )
 

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

  Source: [Groups.scar (2640)]  

Void  SGroup_GetSquadsHeld( SGroupID sgroup, SGroupID sgroupRecipient )
 

Returns an sgroup containing all squads held by any squad in an sgroup 

  Source: [Groups.scar (2809)]  

Boolean  SGroup_HasUpgrade( SGroupID sgroup, UpgradeID upgrade, Boolean all )
 

Returns whether ANY or ALL squads in an SGroup have the specified upgrade 

  Source: [Groups.scar (2626)]  

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

  Source: [Groups.scar (1982)]  

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)

  Source: [LuaGroup.cpp (495)]  

Boolean  SGroup_IsAttackMoving( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL squads in an SGroup are attack moving. 

  Source: [Groups.scar (2543)]  

Boolean  SGroup_IsDeSpawnedEmpty( SGroupID sgroup )
 

Returns true if a named squad group is empty (i.e., SGroup_CountDeSpawned == 0) 

  Source: [Groups.scar (1402)]  

Boolean  SGroup_IsDoingAttack( SGroupID sgroup, Boolean all, Float time )
 

Returns true if ALL or ANY squads are attacking within the time. 

  Source: [Groups.scar (1293)]  

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) 

  Source: [Groups.scar (2021)]  

Boolean  SGroup_IsEmpty( SGroupID sgroup )
 

Returns true if a named squad group is empty (i.e., SGroup_Count == 0) 

  Source: [Groups.scar (1388)]  

Boolean  SGroup_IsFullyInfiltrated( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are fully infiltrated 

  Source: [Groups.scar (1349)]  

Void  SGroup_IsHoldingAny( SGroupID sgroup )
 

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

  Source: [Groups.scar (2794)]  

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. 

  Source: [Groups.scar (1214)]  

Boolean  SGroup_IsInEGroup( SGroupID sgroup, EGroupID egroup, Boolean all )
 

Returns true if ANY or ALL squads in an SGroup are inside any building in the EGroup. 

  Source: [Groups.scar (2570)]  

Boolean  SGroup_IsInfiltrated( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are infiltrated 

  Source: [Groups.scar (1325)]  

Boolean  SGroup_IsInHoldEntity( SGroupID sgroup, Boolean ALL )
 

Checks if ANY or ALL squads in an SGroup are garrisoned in an entity (building)  

  Source: [Groups.scar (2751)]  

Boolean  SGroup_IsMoving( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL squads in an SGroup are moving. 

  Source: [Groups.scar (2230)]  

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. 

  Source: [Groups.scar (2525)]  

Boolean  SGroup_IsPartiallyInfiltrated( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are partially infiltrated 

  Source: [Groups.scar (1337)]  

Boolean  SGroup_IsPinned( SGroupID group, Boolean all )
 

Returns true if ANY or ALL of a group is pinned 

  Source: [Groups.scar (2091)]  

Boolean  SGroup_IsRetreating( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the squads in an SGroup are currently retreating 

  Source: [Squad.scar (175)]  

Boolean  SGroup_IsSpawnedEmpty( SGroupID sgroup )
 

Returns true if a named squad group is empty (i.e., SGroup_CountSpawned == 0) 

  Source: [Groups.scar (1395)]  

Boolean  SGroup_IsSuppressed( SGroupID group, Boolean all )
 

Returns true is ANY or ALL of a group is suppressed 

  Source: [Groups.scar (2074)]  

Boolean  SGroup_IsTotallyInfiltrated( SGroupID sgroup, Boolean all )
 

Returns true if ALL or ANY squads in a group are totally infiltrated (i.e., every entity in the squad is either partially or fully infiltrated) 

  Source: [Groups.scar (1361)]  

Boolean  SGroup_IsUnconscious( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the squads in the sgroup have a unit that is unconcious.  

  Source: [Groups.scar (1260)]  

Boolean  SGroup_IsUnderAttack( SGroupID sgroup, Boolean all, Float time )
 

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

  Source: [Groups.scar (1277)]  

Bool  SGroup_IsUnderAttackByPlayer( SGroupID group, PlayerID attackerplayer, Float duration )
 

Check if the squads are attacked by the player 

  Source: [Groups.scar (1879)]  

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. 

  Source: [Groups.scar (2612)]  

  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.

  Source: [Groups.scar (1761)]  

Void  SGroup_Remove( SGroupID group, SquadID squadron )
 

Removes an squadron from a group. 

  Source: [LuaGroup.cpp (513)]  

Void  SGroup_RemoveGroup( SGroupID group, SGroupID grouptoremove )
 

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

  Source: [Groups.scar (2002)]  

Void  SGroup_ResetCallForHelpDistance( SGroupID sgroup )
 

Reset the call for help distance for an SGroup 

  Source: [Groups.scar (2993)]  

Void  SGroup_ResetIdleLeashDistance( SGroupID sgroup )
 

Reset the idle leash distance for an SGroup 

  Source: [Groups.scar (2979)]  

Void  SGroup_ResetMeleeLeashDistance( SGroupID sgroup )
 

Reset the melee leash distance for an SGroup 

  Source: [Groups.scar (2966)]  

Void  SGroup_ResetUnconscious( SGroupID sgroup, Boolean all )
 

Resets the unconscious state 

  Source: [Groups.scar (2838)]  

Void  SGroup_ReSpawn( SGroupID groupid )
 

Respawn all despawned squads in a group. 

  Source: [Groups.scar (1731)]  

Void  SGroup_RestoreCombatPlans( SGroupID sgroupID )
 

Restore all current combat plans for the squads in the sgroup 

  Source: [Groups.scar (2730)]  

  SGroup_ResumeFire( SGroupID sgroup )
 

Lets all squads in an sgroup resume firing again, after they have previously been stopped with the SGroup_CeaseFire() function. 

  Source: [Groups.scar (2909)]  

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

  Source: [Groups.scar (1430)]  

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

  Source: [Groups.scar (1478)]  

Void  SGroup_SetCallForHelpDistance( SGroupID sgroup, Real distance )
 

Set the call for help distance for an SGroup 

  Source: [Groups.scar (2951)]  

  SGroup_SetCourage( SGroupID sgroup, Real level )
 

Sets the courage of all the squads in an SGroup. Set the level between 0.0 (suppressed) and 1.0 (fine) 

  Source: [Groups.scar (2865)]  

Void  SGroup_SetIdleLeashDistance( SGroupID sgroup, Real distance )
 

Set the idle leash distance for an SGroup 

  Source: [Groups.scar (2937)]  

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, health damage is disabled.

  Source: [Groups.scar (1599)]  

Real  SGroup_SetLevel( SGroupID sgroup, Integer/String level )
 

Changes the level of all spawned and despawned squads in an SGroup. 

  Source: [Groups.scar (1495)]  

Void  SGroup_SetMeleeLeashDistance( SGroupID sgroup, Real distance )
 

Set the melee leash distance for an SGroup 

  Source: [Groups.scar (2924)]  

Void  SGroup_SetMoodMode( SGroupID group, Integer mode )
 

Set soldier mood mode. Mode could be MM_Auto, MM_ForceCalm or MM_ForceTense 

  Source: [Groups.scar (2107)]  

Void  SGroup_SetMoveType( SGroupID group, String movetype )
 

Set the move type for an SGroup - move type is either MOVETYPE_SAFE, MOVETYPE_NORMAL, MOVETYPE_FAST 

  Source: [Groups.scar (1843)]  

Void  SGroup_SetPlayerOwner( SGroupID sgroup, PlayerID owner )
 

Changes the player owner of spawned and despawned squads in an SGroup. 

  Source: [Groups.scar (1529)]  

  SGroup_SetSelectable( SGroup sgroupid, bool selectable )
 

Set player selectable state of squads in the sgroup 

  Source: [Groups.scar (1825)]  

Void  SGroup_SetSpecialAttackChanceOverride( SGroupID sgroup, Real specialAttackChanceOverride )
 

Overrides the probability that a melee attack will be a special attack for each member of the sgroup 

  Source: [LuaModExtensions.cpp (88)]  

Void  SGroup_SetSyncKillChanceOverride( SGroupID sgroup, Real specialAttackChanceOverride )
 

Overrides the probability that kill will be a synckill for each member of the sgroup 

  Source: [LuaModExtensions.cpp (122)]  

Void  SGroup_SetSyncKillIDOverride( SGroupID sgroup, String idOverride )
 

Overrides the id of the sync kill that is used for each member of the sgroup. 

If when executing a sync kill the override ID is not a valid choice, a random sync kill will be chosen.

  Source: [LuaModExtensions.cpp (174)]  

Bool  SGroup_SetUnconsciousEnabled( SGroupID sgroup, Bool enabled, Boolean all )
 

Returns whether a squad can go unconscious or not 

  Source: [Groups.scar (2824)]  

Void  SGroup_SetUnconsciousRatioToRevive( SGroup sgroup, Float ratio )
 

Sets the required health pct for a unit to get back up after going unconscious 

  Source: [Groups.scar (2851)]  

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.

  Source: [Groups.scar (2689)]  

Void  SGroup_SnapFaceEachOther( SGroupID sgroup1, SGroupID sgroup2 )
 

Makes two SGroups face each other at no time 

  Source: [Groups.scar (1704)]  

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

  Source: [Groups.scar (1786)]  

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.

  Source: [LuaModExtensions.cpp (57)]  

Integer  SGroup_TotalMembersCount( SGroupID sgroup )
 

Returns the total count of all members of all the squads in a given SGroup. 

  Source: [Groups.scar (2508)]  

Void  SGroup_WarpToMarker( SGroupID sgroup, MarkerID marker )
 

Warps all members of an SGroup immediately to a marker 

  Source: [Squad.scar (159)]  

Void  SGroup_WarpToPos( SGroupID sgroup, Position pos )
 

Warps all members of an SGroup immediately to a new position 

  Source: [Squad.scar (145)]  

 

 

Simplified Entry
Functions

Void  Leveling_CompleteQuest( PlayerID player, LocString quest_id )
 

Moves an objective from the profile's list of quests in progress to its list of complete quests. Called by Objective_Complete. 

This gets called by Objective_Complete and so should usually not be necessary to call on its own.

  Source: [Simplified-Functions.scar (1429)]  

Void  Leveling_FailQuest( PlayerID player, LocString quest_id )
 

Moves an objective from the profile's list of quests in progress to its list of failed quests. Called by Objective_Failed. 

This gets called by Objective_Fail and so should usually not be necessary to call on its own.

  Source: [Simplified-Functions.scar (1467)]  

Void  Leveling_InitDiscovery( )
 

Setup the list of regions that can be discovered on your map.  

Reads in the t_RegionList table and then checks for discovery markers.

Call this once in the setup of the mission.

  Source: [Simplified-Functions.scar (302)]  

String questStatus  Objective_CheckQuestStatus( PlayerID player, LuaTable obj_table )
 

Get the status of a quest from the persist profile. 

Possible results are:/n/n "in_progress"/n "failed"/n "complete"/n "not_found"/n

  Source: [Simplified-Functions.scar (738)]  

Void  Objective_CombatPatrol( PlayerID player, LuaTable obj_table, LuaTable mkr_num_table, MarkerID!home_mkr [, Boolean win, SgroupID patrol_sgroup, SgroupID sgroup_must_survive] )
 

Sets up and monitors a combat patrol for the player 

Combat patrols are objectives in which the player must move units from waypoint to waypoint.

MANDATORY ARGUMENTS

player: player_id of the player

obj_table: objective table for the combat patrol. This function with start the objective, but it must be registered ahead of time like all others.

mkr_num_table: luatable that contains either the marker ids of the nmarkers on the patrol (save the last one) or simply the integers of the standard patrol markers (assuming the map has these). Default markers are named as mkr_Patrol1, mkr_Patrol2, and so forth.

home_mkr: the marker ID of the final marker

OPTIONAL ARGUMENTS

win: a boolean that determines if the objective will be completed by completing the patrol (you may wish to withold victory for some other event, such as finding an object). Defaults to TRUE.

patrol_sgroup: The sgroupID of the units that must simultaenously be at a waypoint (within 10 meters) to mark it as done. If absent or nil, defaults to any player squad

sgroup_must_survive: If present, or all members of this sgroup must survive or the mission fails

  Source: [Simplified-Functions.scar (579)]  

Boolean  Objective_CombatPatrolIsDone( LuaTable obj_table )
 

Returns true if a combat patrol function is complete (as it can occur without triggering the objective conmplete). 

  Source: [Simplified-Functions.scar (689)]  

Void  Objective_CompleteXP( LuaTable obj_table, PlayerID player[, SgroupID sgroup] )
 

Completes an Objective and awards the associated xp value. Plays a kicker on a passed in sgroup (if any). 

If the obj_table has no value for xp, this completes the objective and then returns.

If no player is passed in, defaults to player at position 1.

If no Sgroup is passed in (or if the sgroup doesnot exist), no kicker is played, but the XP is still awarded.

  Source: [Simplified-Functions.scar (1506)]  

Void  Player_AddHealthPack( PlayerID playerid, Integer number )
 

Add or remove a health pack from the player's persistent profile. And display the pack button if any are left. 

Derives the profile name from the player ID and then adjusts the number of packs in thew profile. It then clears any current cue and (if any packs remain) adds a new cue. /n/n This function utilizes a placeholder version of health packs pending the ability to create ability buttons.

  Source: [Simplified-Functions.scar (1289)]  

Integer  Player_GetHealthPacks( PlayerID playerid )
 

Returns the number of health packs the player has in his inventory. 

This function utilizes a placeholder version of health packs pending the ability to create ability buttons.

  Source: [Simplified-Functions.scar (1328)]  

Void  Player_InitHealthPacks( PlayerID playerid )
 

Initializes health packs by checking current inventory and creating relevant button. Use at begining of a mission. 

This function utilizes a placeholder version of health packs pending the ability to create ability buttons.

  Source: [Simplified-Functions.scar (1345)]  

Void  Quest_QuestBoss( PlayerID player_id, SgroupID boss_sgroup )
 

Runs a quest boss's behavior. 

A shortened version of the master function (in DoW1 scar) created by Dan Kading. Only handles the GTAE behavior needed for the SEP.

  Source: [Simplified-Functions.scar (793)]  

ButtonID button_id  SE_QuestButtonCreate( LuaTable objective_table )
 

Create a quest button for a particular quest. 

The quest must have a giver defined (an SGroup listed in the objective_table and indexed as "giver").

  Source: [Simplified-Functions.scar (989)]  

Void  SE_QuestButtonWatch( )
 

Listens for a quest button to be clicked and then adds the objective associted with the button. 

This should be called as a rule with an interval.

  Source: [Simplified-Functions.scar (1038)]  

Void  SE_QuestUpdate( PlayerID playerid )
 

Updates the the quest flags and creates the quest buttons for a mission. 

This should not be called as a recurring rule. Call it once after marking an objective complete.

  Source: [Simplified-Functions.scar (1064)]  

Void  UI_XpKicker( PlayerID player_id, SGroupID sgroup, Real xp_num) )
 

Play a kicker on an sgroup showing added XP 

Plays the kicker in the form "+ NUM XP"

  Source: [Simplified-Functions.scar (1415)]  

Boolean status  Util_RegionIsDiscovered( PlayerID player, String region )
 

Returns true if a particular region has been discovered.  

Reads from the persistent profile. Make sure to use the one-word non-localize region string defined in t_RegionList table.

  Source: [Simplified-Functions.scar (431)]  

Void  Util_SpawnChaffStructures( String region )
 

Spawn chaff structures across a region defined in the map's t_RegionList table 

The race of the spawned structures depends on the owner established in the t_RegionList table.

The structure type is determined by the naming of the marker and the units put in the global t_StructureList spawn table.

  Source: [Simplified-Functions.scar (239)]  

Void  Util_SpawnChaffUnits( String region[, Integer loadout] )
 

Spawn chaff units across a region defined in the map's t_RegionList table 

The race of the spawned units depends on the owner established in the t_RegionList table.

The unit type is determined by the naming of the marker and the units put in the global t_UnitList spawn table.

Loadout determines troopers in each squad -- leave out for min loadout; set to 0 for max.

  Source: [Simplified-Functions.scar (61)]  

 

 

Sound
Functions

Void  Sound_AddToMusicPlaylist( String name )
 

Plays music from the 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_AddToMusicPlaylist( "Music/GreatMusic" )

  Source: [LuaSound.cpp (412)]  

Void  Sound_ContainerDebug( Void  )
 

Turns container debugging on/off 

Example:

\Sound_ContainerDebug()

  Source: [LuaSound.cpp (437)]  

Integer  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 SHOULD BE 2D Example:

Sound_Play( "Blah/Mysound" )

  Source: [LuaSound.cpp (340)]  

Integer  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 )

  Source: [LuaSound.cpp (322)]  

Integer  Sound_PlayAtLocation( String name, Math::Vector3f pos )
 

Plays a 3D sound from the Data:Sound folder at the location. 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", scar location )

  Source: [LuaSound.cpp (331)]  

Void  Sound_PlayMusic( String name, Real fade, Real delay )
 

Plays music from the 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 )

  Source: [LuaSound.cpp (382)]  

Integer  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" )

  Source: [LuaSound.cpp (349)]  

Integer  Sound_PlayStreamed3D( String name, EntityID entity )
 

Plays a streaming 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 Example:\n\n \tSound_Play( "Speech/SpaceMarine/AddOnComplete", TheActor )\n 

  Source: [LuaSound.cpp (357)]  

Integer  Sound_PlayStreamedAtLocation( String name, Math::Vector3f pos )
 

Plays a streaming sound from the Data:Sound folder at the location. 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", scar location )

  Source: [LuaSound.cpp (366)]  

Void  Sound_PreCacheSound( String name )
 

pre-caches a sound 

Example:

Sound_PreCacheSound("nis/m02_n01_full")

  Source: [LuaSound.cpp (508)]  

Void  Sound_QueueMusic( String name, Real fade, Real delay )
 

queues music from the Sound folder AFTER currently playing music has finished 

The new music will only play once the currently playing music has finished, this means the currently playing music must not be looping/crossfading. Stop or PlayMusic will erase this queue Example:

\Sound_QueueMusic( "Music/GreatMusic", 0.0, 0.0 )

  Source: [LuaSound.cpp (392)]  

Void  Sound_SetVolume_Ambiences( Real volume, Real time )
 

Sets a new volume for the Music group. 

Example:

\Sound_SetVolume_Ambiences(0.5, 2)

  Source: [LuaSound.cpp (488)]  

Void  Sound_SetVolume_Master( Real volume, Real time )
 

Sets a new volume for all sounds. 

Example:

\Sound_SetVolume_Master(0.5, 2)

  Source: [LuaSound.cpp (498)]  

Void  Sound_SetVolume_Music( Real volume, Real time )
 

Sets a new volume for the Music group. 

Example:

\Sound_SetVolume_Music(0.5, 2)

  Source: [LuaSound.cpp (466)]  

Void  Sound_SetVolume_SFX( Real volume, Real time )
 

Sets a new volume for the SFX group. 

Example:

\Sound_SetVolume_SFX(0.5, 2)

  Source: [LuaSound.cpp (456)]  

Void  Sound_SetVolume_Speech( Real volume, Real time )
 

Sets a new volume for the speech group. 

Example:

\Sound_SetVolume_Speech(0.5, 2)

  Source: [LuaSound.cpp (446)]  

Void  Sound_SetVolume_Weapons( Real volume, Real time )
 

Sets a new volume for the weapons group. 

Example:

\Sound_SetVolume_Weapons(0.5, 2)

  Source: [LuaSound.cpp (478)]  

Void  Sound_StartMusicPlaylist( Real fadeTime, Real delay )
 

Plays music from the 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_StartMusicPlaylist( "Music/GreatMusic" )

  Source: [LuaSound.cpp (425)]  

Void  Sound_Stop( Integer handle )
 

Stops sound associated with the container handle 

  Source: [LuaSound.cpp (373)]  

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 )

  Source: [LuaSound.cpp (402)]  

 

 

Squad
Functions

LocString  Entity_GetSquadName( EntityID entity )
 

Returns a locstring containing the squad name. 

  Source: [LuaSquad.cpp (283)]  

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.

  Source: [LuaSquad.cpp (1283)]  

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.

  Source: [LuaSquad.cpp (1324)]  

Boolean  Squad_CanCaptureStrategicPoint( SquadID squad, EntityID entity )
 

Returns true if squad can capture stategic point 

  Source: [LuaSquad.cpp (989)]  

Boolean  Squad_CanInstantReinforceNow( SquadID squad )
 

Returns true if the squad is available to be reinforced 

  Source: [LuaSquad.cpp (430)]  

Boolean  Squad_CanSeeEntity( SquadID squad, EntityID entity )
 

Returns true if a given entity is in the squads sight radius 

  Source: [LuaSquad.cpp (632)]  

Boolean  Squad_CanSeeSquad( SquadID squad, SquadID target )
 

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

  Source: [LuaSquad.cpp (644)]  

Void  Squad_CeaseFire( SquadID squad )
 

Make a squad enter cease-fire mode, where it will not fire without explicit orders. 

Call Squad_ResumeFire to return to free-fire mode.

  Source: [LuaSquad.cpp (264)]  

Void  Squad_ClearPostureSuggestion( SquadID squad )
 

Clears any previous posture suggestions made to a squad 

  Source: [LuaModExtensions.cpp (212)]  

Integer  Squad_Count( SquadID squad )
 

Returns the number of units currently in a squad (spawned AND despawned!!) 

  Source: [LuaSquad.cpp (101)]  

SquadID  Squad_CreateAndSpawn( Integer squadBlueprintID, PlayerID player, Integer loadoutCount, Position pos )
 

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.

  Source: [LuaSquad.cpp (186)]  

SquadID  Squad_CreateAndSpawnToward( Integer squadBlueprintID, PlayerID player, Integer 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.

  Source: [LuaSquad.cpp (135)]  

Void  Squad_DeSpawn( SquadID squad )
 

Despawn the entire squad at its current position. 

  Source: [LuaSquad.cpp (91)]  

Void  Squad_Destroy( SquadID squad )
 

Remove an squad from the world and destroy it. 

  Source: [LuaSquad.cpp (41)]  

Void  Squad_EnableSurprise( SquadID squad, Boolean enable )
 

Enables or disables the surprise feature on thie given squad 

  Source: [LuaSquad.cpp (622)]  

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.

  Source: [LuaSquad.cpp (1255)]  

Void  Squad_FaceSquad( SquadID squad1, SquadID squad2 )
 

Get 2 squads to face each other. This function works on spawned squads only. 

  Source: [LuaSquad.cpp (1262)]  

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. 

  Source: [LuaSquad.cpp (1493)]  

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. 

  Source: [LuaSquad.cpp (1434)]  

SquadID  Squad_FromWorldID( Integer id )
 

Get a squad from a mission editor ID. 

  Source: [LuaSquad.cpp (178)]  

Integer  Squad_GetAbilityAvailableUses( SquadID squad, Integer abilityID )
 

Returns number of available uses the squad has for given ability. 

-1 is infinite, 0 is none, ...

  Source: [LuaSquad.cpp (1103)]  

Integer  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_Plan, SQUADSTATEID_Patrol, SQUADSTATEID_Melee, SQUADSTATEID_Jump, SQUADSTATEID_HunkerDown, SQUADSTATEID_Pickup, SQUADSTATEID_Plan. 

  Source: [LuaSquad.cpp (394)]  

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 

  Source: [LuaSquad.cpp (583)]  

String  Squad_GetBaseUnitName( SquadID squad )
 

Returns a string containing the base unit name for the current squadron 

  Source: [LuaSquad.cpp (231)]  

Integer  Squad_GetBlueprintID( SquadID squad )
 

Returns the id of the squad blueprint 

  Source: [LuaSquad.cpp (166)]  

String  Squad_GetBlueprintName( SquadID squad )
 

Returns the name of the squad blueprint (from the attribute editor) 

  Source: [LuaSquad.cpp (160)]  

Real  Squad_GetCourage( SquadID squad )
 

Check current squad courage amount 

  Source: [LuaSquad.cpp (1219)]  

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. 

  Source: [LuaSquad.cpp (1409)]  

Integer  Squad_GetGameID( SquadID squad )
 

Returns an integer containing the unqiue squad ID for this squad. 

  Source: [LuaSquad.cpp (172)]  

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) 

  Source: [LuaSquad.cpp (56)]  

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.

  Source: [LuaSquad.cpp (305)]  

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.

  Source: [LuaSquad.cpp (367)]  

EntityID  Squad_GetHoldEntity( SquadID squad )
 

Get which building (entity) is the squad garrisoned 

Please use Squad_IsInHold() to check first

  Source: [LuaSquad.cpp (1124)]  

SquadID  Squad_GetHoldSquad( SquadID squad )
 

Get which vehicle (squad) is the squad garrisoned 

Please use Squad_IsInHold() to check first

  Source: [LuaSquad.cpp (1138)]  

Bool  Squad_GetInvulnerable( SquadID squad )
 

Check if the squad is invulnerable or not 

  Source: [Squad.scar (71)]  

Real  Squad_GetInvulnerableMinCap( SquadID squad )
 

Returns the highest invulnerable min cap percentage from members of the squad. 

  Source: [LuaSquad.cpp (779)]  

Void  Squad_GetLastAttacker( SquadID squad, SGroupID group )
 

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

  Source: [LuaSquad.cpp (534)]  

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 

  Source: [LuaSquad.cpp (550)]  

Integer  Squad_GetMax( SquadID squad )
 

Returns the max number of units allowed in the squadron (from squad_loadout_ext) 

  Source: [LuaSquad.cpp (294)]  

LocString  Squad_GetName( SquadID squad )
 
  Source: [LuaSquad.cpp (249)]  

Integer  Squad_GetNumSlotItem( SquadID squad, Integer itemID )
 

Get the number of slot items with the same ID that the squad has 

Squad_GetNumSlotItem( squadid, item )

  Source: [LuaSquad.cpp (1014)]  

Position  Squad_GetOffsetPosition( SquadID squad, Integer offset, Real distance )
 

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

  Source: [Squad.scar (130)]  

PlayerID  Squad_GetPlayerOwner( SquadID squad )
 

Returns the Player owner of the given squad. Squad MUST NOT be owned by the world. 

  Source: [LuaSquad.cpp (126)]  

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) 

  Source: [LuaSquad.cpp (50)]  

Position  Squad_GetPositionDeSpawned( SquadID squad )
 

Returns the average position of the despawned AND spawned units in the squad. 

  Source: [LuaSquad.cpp (63)]  

Integer  Squad_GetSlotItemAt( SquadID squad, Integer 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 

  Source: [LuaSquad.cpp (1042)]  

Integer  Squad_GetSlotItemCount( SquadID squad )
 

Returns how many slot items this squad has 

  Source: [LuaSquad.cpp (1029)]  

LuaTable  Squad_GetSlotItemsTable( SquadID squadid )
 

Returns a table of SlotItem ID's that this squad currently owns 

  Source: [Squad.scar (97)]  

Boolean  Squad_GetSquadsHeld( SquadID squad, SGroupID sgroup )
 

Adds all squads held by 'squad' to an sgroup 

  Source: [LuaSquad.cpp (1180)]  

Void  Squad_GiveSlotItem( SquadID squad, Integer itemID )
 

Gives a slot item to the squad. Can fail due to not enough slots left 

  Source: [LuaSquad.cpp (1063)]  

Void  Squad_GiveSlotItemsFromTable( SquadID squadid, LuaTable itemTable )
 

Gives all slot items in a table to the squad. The table should come from Squad_GetSlotItemsTable 

  Source: [Squad.scar (116)]  

Boolean  Squad_HasActiveCommand( SquadID squad )
 

Returns true if there's an active command currently for the squad 

  Source: [LuaSquad.cpp (388)]  

Boolean  Squad_HasDestination( SquadID squad )
 

Returns whether this squad is moving and has a destination 

  Source: [LuaSquad.cpp (1397)]  

Boolean  Squad_HasUpgrade( SquadID squad, Integer pbgID )
 

Return true if the squad has purchased the specified upgrade. 

  Source: [LuaSquad.cpp (1370)]  

Boolean  Squad_IsAllInfiltrated( SquadID squad )
 

Returns whether ALL members of a squad are camouflaged 

  Source: [LuaSquad.cpp (1577)]  

Boolean  Squad_IsAnyConscious( SquadID squad )
 

Returns whether any units in a squad are conscious 

Returns whether any units in a squad are conscious

  Source: [LuaSquad.cpp (840)]  

Boolean  Squad_IsAttacking( SquadID squad, Real time )
 

Returns true if any unit in the squad is attacking within the time 

Time is in seconds

  Source: [LuaSquad.cpp (520)]  

Boolean  Squad_IsEntityUpgrading( SquadID squad, Integer pbgID )
 

Returns true if any entity in the squad is currently upgrading. Pass in -1 for pbgID if it doesn't matter what is being upgraded. 

  Source: [LuaSquad.cpp (477)]  

Boolean  Squad_IsFullyInfiltrated( SquadID squad )
 

Returns whether ALL members of a squad are fully camouflaged 

  Source: [LuaSquad.cpp (1617)]  

Boolean  Squad_IsHoldingAny( SquadID squad )
 

Check if the squad has a hold on anything (use this on vehicles) 

  Source: [LuaSquad.cpp (1174)]  

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.

  Source: [Squad.scar (14)]  

Boolean  Squad_IsInfiltrated( SquadID squad )
 

Returns whether ANY member of a squad is camouflaged 

  Source: [LuaSquad.cpp (1555)]  

Boolean  Squad_IsInHoldEntity( SquadID squad )
 

Check if the squad is garrisoned in entity (building) 

  Source: [LuaSquad.cpp (1150)]  

Boolean  Squad_IsInHoldSquad( SquadID squad )
 

Check if the squad is loaded in squad (vehicle 

  Source: [LuaSquad.cpp (1162)]  

Boolean  Squad_IsMoving( SquadID squad )
 

Returns whether any entity in the squad is moving 

  Source: [LuaSquad.cpp (1391)]  

Boolean  Squad_IsPartiallyInfiltrated( SquadID squad )
 

Returns whether ALL members of a squad are partially camouflaged 

  Source: [LuaSquad.cpp (1597)]  

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. 

  Source: [LuaSquad.cpp (406)]  

Boolean  Squad_IsRetreating( SquadID squadid )
 

Returns true if the squad is currently retreating 

  Source: [Squad.scar (81)]  

Boolean  Squad_IsSuppressed( SquadID squad )
 

True if squad is currently suppressed 

  Source: [LuaSquad.cpp (1231)]  

Boolean  Squad_IsUnconcious( SquadID squad )
 

Return true if any unit in the squad is unconcious. 

  Source: [LuaSquad.cpp (846)]  

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

  Source: [LuaSquad.cpp (513)]  

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

  Source: [LuaSquad.cpp (528)]  

Boolean  Squad_IsUpgrading( SquadID squad, Integer pbgID )
 

Returns true if the squad is currently upgrading. Pass in -1 for pbgID if it doesn't matter what is being upgraded. 

  Source: [LuaSquad.cpp (442)]  

Boolean  Squad_IsValid( Integer id )
 

Check if a squad with the given ID can be found in the world 

  Source: [LuaSquad.cpp (193)]  

Void  Squad_Kill( SquadID squad )
 

Kill whole squad. Sets health to 0, and triggers death effects. 

  Source: [LuaSquad.cpp (359)]  

Void  Squad_Merge( SquadID dest, SquadID source )
 

Merge source squad into destination squad. 

The source squad will become invalid after the merge

  Source: [LuaSquad.cpp (657)]  

Void  Squad_ModifyEnergy( SquadID squad, Real delta )
 

Modify squad's energy by incoming delta value (can be positive or negative) 

  Source: [LuaSquad.cpp (1243)]  

Void  Squad_ReplenishSlotItem( SquadID squad, Integer itemID )
 

Replenish slot items to the squad. Only refills existing slots based on itemID type. 

itemID must be a SlotItemBag.

  Source: [LuaSquad.cpp (1079)]  

Void  Squad_ResetCallForHelpDistance( SquadID squad )
 

Reset the call for help distance for the squad 

  Source: [LuaSquad.cpp (912)]  

Void  Squad_ResetIdleLeashDistance( SquadID squad )
 

Reset the idle leash distance for the squad 

  Source: [LuaSquad.cpp (902)]  

Void  Squad_ResetMeleeLeashDistance( SquadID squad )
 

Reset the melee leash distance for the squad 

  Source: [LuaSquad.cpp (892)]  

Void  Squad_ResetUnconscious( SquadID squad )
 

Resets all Unconscious overrides to default AE values 

Resets all Unconscious overrides to default AE values

  Source: [LuaSquad.cpp (800)]  

Void  Squad_ResumeFire( SquadID squad )
 

Make a squad return to free-fire mode. 

This is used to disable cease-fire mode from Squad_CeaseFire.

  Source: [LuaSquad.cpp (274)]  

Boolean  Squad_SetCallForHelpDistance( SquadID squad, Real distance )
 

Set the call for help distance for the squad 

Returns false if squad does not support combat behaviours, true otherwise.

  Source: [LuaSquad.cpp (880)]  

Void  Squad_SetCourage( SquadID squad, Real ratio )
 

Set current squad courage amount second parameter is 0-1 

  Source: [LuaSquad.cpp (1209)]  

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] 

  Source: [LuaSquad.cpp (326)]  

Boolean  Squad_SetIdleLeashDistance( SquadID squad, Real distance )
 

Set the idle leash distance for the squad 

Returns false if squad does not support combat behaviours, true otherwise.

  Source: [LuaSquad.cpp (867)]  

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. 

  Source: [Squad.scar (53)]  

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

  Source: [LuaSquad.cpp (755)]  

Boolean  Squad_SetMeleeLeashDistance( SquadID squad, Real distance )
 

Set the melee leash distance for the squad 

Returns false if squad does not support combat behaviours, true otherwise.

  Source: [LuaSquad.cpp (854)]  

Void  Squad_SetMoodMode( SquadID squad, Integer mode )
 

Set soldier mood mode. Can be MM_Auto, MM_ForceCalm and MM_ForceTense 

  Source: [LuaSquad.cpp (1378)]  

Void  Squad_SetMoveType( SquadID squad, String moveTypeName )
 

Sets the squad's move type 

moveTypeFullName must be the "short name". ex: "safe_move"

  Source: [LuaSquad.cpp (996)]  

Void  Squad_SetPlayerOwner( SquadID squad, PlayerID owner )
 

Changes the owner of the given squad. 

  Source: [LuaSquad.cpp (142)]  

Void  Squad_SetTeamColour( SquadID squad, Integer slot, Real r, Real b, Real g )
 

Sets team colour of a squad 

  Source: [LuaSquad.cpp (1499)]  

Void  Squad_SetTeamColourByIndex( SquadID squad, Integer primaryIndex, Integer secondaryIndex, Integer tintIndex, Integer extraIndex, Integer badgeIndex, Integer patternIndex )
 

Sets team colour of a squad based on indeces in in armyPainterColours.lua file. 

  Source: [LuaSquad.cpp (1524)]  

Void  Squad_SetUnconsciousEnabled( SquadID squad, Boolean enabled )
 

Sets Unconscious override value 

Sets Unconscious override value

  Source: [LuaSquad.cpp (820)]  

Boolean  Squad_Spawn( SquadID squad, Position pos )
 

Spawn the entire squad at a given position 

  Source: [LuaSquad.cpp (947)]  

Boolean  Squad_SpawnToward( SquadID squad, Position pos, Position toward )
 

Spawn the entire squad at a given position 

  Source: [LuaSquad.cpp (923)]  

SquadID  Squad_Split( SquadID squad, Integer 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.

  Source: [LuaSquad.cpp (703)]  

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.

  Source: [LuaModExtensions.cpp (202)]  

Void  Squad_WarpToMarker( SquadID squad, MarkerID marker )
 

Warps a squad immediately to a marker 

  Source: [Squad.scar (42)]  

Void  Squad_WarpToPos( SquadID squad, Position pos )
 

Warps a squad immediately to a new position 

  Source: [Squad.scar (32)]  

 

 

Stinger
Functions

  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

  Source: [Stingers.scar (22)]  

  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

  Source: [Stingers.scar (32)]  

  Stinger_Remove( PlayerID player, MarkerID marker )
 

Remove all stingers triggered from a specific location 

  Source: [Stingers.scar (41)]  

 

 

Team
Functions

Boolean  Team_AddAbilityLockoutZone( TeamID team, Integer pbgID, MarkerID marker )
 

Specifies a marker where an ability cannot be used. This only applies to abilities where you use the cursor to pick a spot in the world. 

  Source: [Team.scar (165)]  

Boolean  Team_CanSeeEGroup( TeamID team, EGroupID egroup, Boolean all )
 

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

  Source: [Team.scar (442)]  

Boolean  Team_CanSeeEntity( TeamID team, EntityID entity )
 

Returns true if a team can see an entity 

  Source: [Team.scar (464)]  

Boolean  Team_CanSeePosition( TeamID team, ScarPos/MarkerID position )
 

Returns true if a team can see a certain map location 

  Source: [Team.scar (530)]  

Boolean  Team_CanSeeSGroup( TeamID team, SGroupID sgroup, Boolean all )
 

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

  Source: [Team.scar (486)]  

Boolean  Team_CanSeeSquad( TeamID team, SquadID squad )
 

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

  Source: [Team.scar (508)]  

Void  Team_ForEach( TeamID team, LuaFunction function )
 

Iterates over every player in a team, and calls the function for each of those players. The function receives the parameters (teamid, playerid), and should return true to break, or false to continue. 

  Source: [Team.scar (105)]  

Boolean  Team_ForEachAllOrAny( TeamID team, Boolean all, LuaFunction function )
 

Iterates over the players in a team, and tells you if the function listed returns true for ANY or ALL of those players. The function receives the parameters (teamid, playerid), and should return true or false. 

This doesn't necessarily go through every player, as it will stop once it knows the answer. If you want to do that, use Team_ForEach() instead.

  Source: [Team.scar (126)]  

Void  Team_GetAll( TeamID team[, SGroupID sgroup, EGroupID egroup] )
 

Fills groups with all of a given team's units and buildings. Defaults - sg_allsquads and eg_allentities 

Fills an SGroup with all of the given team's squads, and an EGroup with all the team's entities. These groups are cleared beforehand, and if you don't provide and groups then it defaults to using sg_allsquads and eg_allentities.

  Source: [Team.scar (202)]  

Void  Team_GetAllEntitiesNearMarker( TeamID team, EGroupID egroup, MarkerID/Pos position[, Real range] )
 

Gather together all of a team'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.

  Source: [Team.scar (312)]  

Void  Team_GetAllSquadsNearMarker( TeamID team, SGroupID sgroup, MarkerID/Pos position[, Real range] )
 

Gather together all of a team'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.

  Source: [Team.scar (274)]  

Table  Team_GetPlayers( TeamID team )
 

Returns a table containing the IDs of all of the players in a given team 

  Source: [Team.scar (54)]  

Boolean  Team_HasUpgrade( TeamID team, UpgradeID upgrade, Boolean all )
 

Returns true if ANY or ALL of the players on a team have purchased the upgrade 

  Source: [Team.scar (422)]  

Boolean  Team_OwnsEGroup( TeamID team, EGroupID egroup, Boolean all )
 

Returns true if a given team owns ALL or ANY entities in a group 

  Source: [Team.scar (354)]  

Boolean  Team_OwnsSGroup( TeamID team, SGroupID sgroup, Boolean all )
 

Returns true if a given team owns ALL or ANY squads in a group 

  Source: [Team.scar (388)]  

Boolean  Team_RemoveAbilityLockoutZone( TeamID team, Integer pbgID, MarkerID marker )
 

Removes a lockout zone added with Team_AddAbilityLockoutZone. 

  Source: [Team.scar (180)]  

 

 

Timer
Functions

Void  Timer_Add( Integer timerID, Real period )
 

Add the amount of time to the specified timer 

  Source: [Timer.scar (62)]  

Void  Timer_Advance( Integer timerID, Real period )
 

Advances the timer by the specified amount of time 

  Source: [Timer.scar (72)]  

Void  Timer_Display( Integer timerID )
 

Display (in the console) the amount of time remaining in the specified timer. 

  Source: [Timer.scar (154)]  

Void  Timer_DisplayOnScreen( Integer 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 

  Source: [Timer.scar (196)]  

Void  Timer_End( Integer timerID )
 

Stop the specified timer. 

  Source: [Timer.scar (183)]  

Boolean  Timer_Exists( Integer timerID )
 

Returns whether the timer with this ID exists 

  Source: [Timer.scar (53)]  

Real  Timer_GetElapsed( Void  )
 

Returns how much time has elapsed since this timer has been started args Integer timerID 

  Source: [Timer.scar (119)]  

  Timer_GetMinutesAndSeconds( Luafunction getTimeFunction, Integer TimerID )
 

Returns TWO values: minutes and seconds. Provide it a function like Timer_GetRemaining or Timer_GetElapsed 

  Source: [Timer.scar (128)]  

Real  Timer_GetRemaining( Integer timerID )
 

Get the remaining time for the specified timer. 

  Source: [Timer.scar (99)]  

Void  Timer_Pause( Integer timerID )
 

Pause the specified timer. 

  Source: [Timer.scar (82)]  

Void  Timer_Resume( Integer timerID )
 

Resume the specified timer. 

  Source: [Timer.scar (141)]  

Void  Timer_Start( Integer timerID, Real period )
 

Start a timer with the specified id, taking the required period ( in seconds ) 

  Source: [Timer.scar (43)]  

 

 

UI
Functions

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.

  Source: [UI.scar (405)]  

Void  FOW_Enable( Boolean enable )
 

Enables or disables the FOW, including out of bound areas and all entities on the map 

  Source: [UI.scar (511)]  

PlayerID  Game_GetLocalPlayer( Void  )
 

Get the local player. (should only be used for UI purpose) 

  Source: [LuaUI.cpp (1986)]  

Boolean  Game_HasLocalPlayer( Void  )
 

Determine if there is a valid local player. (UI only -- nondeterminstic) 

  Source: [LuaUI.cpp (1980)]  

Boolean  Game_IsLetterboxed( Void  )
 

Returns true if the ui is in letterbox mode 

  Source: [LuaUI.cpp (1948)]  

Void  Game_Letterbox( Boolean on )
 

Enters/Exits letterbox mode in amount of time specified by timeSecs. 

Letterbox mode disables input

  Source: [LuaUI.cpp (1937)]  

Void  Game_SetSelectionAlphaScale( Real alphaScale )
 

A scale value for selection circle alpha 

  Source: [LuaUI.cpp (1959)]  

Void  Game_SkipAllEvents( Boolean bDeleteQueued )
 

Skips all events. Can either delete or skip queued events. 

  Source: [LuaUI.cpp (2018)]  

Void  Game_SkipEvent( Void  )
 

Skips the currently playing event (and stops current sound) 

  Source: [LuaUI.cpp (2009)]  

Void  HintMouseover_Add( LocString hintText, Marker/Egroup/Sgroup hintTarget, Real targetRadius, Boolean looping )
 

Adds a Hint Point that will only appear on Mouseover of the target. 

  Source: [UI.scar (272)]  

Void  HintMouseover_Remove( LocString hintText, Marker/Egroup/Sgroup hintTarget )
 

Removes a Mouseover Hint Point from the managing function. 

  Source: [UI.scar (367)]  

HintPointID  HintPoint_Add( StackVar where, Boolean bVisible, LocString hintText )
 

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.

  Source: [UI.scar (213)]  

Void  HintPoint_Remove( Integer HintPointID )
 

Removes a hintpoint. 

  Source: [UI.scar (239)]  

Void  HintPoint_RemoveAll( Void  )
 

Removes all hintpoints. 

  Source: [LuaUI.cpp (796)]  

Void  HintPoint_SetVisible( Integer HintPointID, Boolean bVisible )
 

Sets a hintpoint's visibility. Currently, FOW is not accounted for. 

  Source: [UI.scar (254)]  

HintPointID  InfoPoint_Add( PlayerID player, StackVar where, Float range, Boolean bVisible, Luafunction callback )
 

Creates a infopoint attached to a Marker, EGroup or SGroup. 

If range is set to 0, then the infopoint is rangeless, see the design document for rangeless features.

  Source: [UI.scar (450)]  

Void  InfoPoint_Remove( Integer HintPointID )
 

Removes an infopoint. 

  Source: [UI.scar (468)]  

Void  InfoPoint_RemoveAll( Void  )
 

Removes all infopoints. 

  Source: [LuaUI.cpp (732)]  

Void  InfoPoint_SetVisible( Integer InfoPointID, Boolean bVisible )
 

Sets an infopoint's visiblity through FOW. 

  Source: [UI.scar (483)]  

Void  Misc_DoWeaponHitEffectOnEntity( EntityID entity, Position pos, Integer weaponID )
 

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

  Source: [LuaUI.cpp (1488)]  

Void  Misc_DoWeaponHitEffectOnPosition( Position pos, Integer weaponID )
 

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

  Source: [LuaUI.cpp (1514)]  

Integer  Misc_GetEmptyControlGroup( Void  )
 

Returns the first unused control group index, (1-9,0), or -1 if none available. 

  Source: [LuaUI.cpp (1084)]  

Position  Misc_GetHiddenPositionOnPath( Integer checkType, Position origin, Position dest, Integer ebpID, 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!!

  Source: [LuaUI.cpp (1267)]  

Math::Vector3f  Misc_GetMouseOnTerrain( Void  )
 

Returns the world position of the mouse on the terrain 

  Source: [LuaUI.cpp (1142)]  

EntityID  Misc_GetMouseOverEntity( Void  )
 

Returns the entity under the mouse (if any) 

  Source: [LuaUI.cpp (1128)]  

Void  Misc_GetSelectedEntities( EGroupID group, Boolean subSelection )
 

Clears a given egroup and adds the current selection to the group 

  Source: [LuaUI.cpp (815)]  

Void  Misc_GetSelectedSquads( SGroupID group, Boolean subSelection )
 

Clears a given sgroup and adds the current selection to the group 

  Source: [LuaUI.cpp (850)]  

Integer  Misc_GetSquadControlGroup( SquadID squad )
 

Returns the first control group index that this squad belongs to, from 0 to 9, or -1 if none 

  Source: [LuaUI.cpp (1059)]  

Boolean  Misc_IsEGroupSelected( EGroupID egroup, Boolean all )
 

Returns true if ANY or ALL of the EGroup is selected 

  Source: [ScarUtil.scar (1788)]  

Boolean  Misc_IsEntityOnScreen( EntityID entity, Real pct )
 

Check if the entity is on screen currently 

  Source: [LuaUI.cpp (1542)]  

Boolean  Misc_IsEntitySelected( EntityID entity )
 

Returns true if an entity is currently selected 

  Source: [LuaUI.cpp (887)]  

Boolean  Misc_IsMouseOverEntity( Void  )
 

Returns true if the mouse is over an entity 

  Source: [LuaUI.cpp (1158)]  

Boolean  Misc_IsSGroupSelected( SGroupID sgroup, Boolean all )
 

Returns true if ANY or ALL of the SGroup is selected 

  Source: [ScarUtil.scar (1773)]  

Boolean  Misc_IsSquadOnScreen( SquadID squad, Real pct )
 

Check if the squad is on screen currently 

  Source: [LuaUI.cpp (1531)]  

Boolean  Misc_IsSquadSelected( SquadID squad )
 

Returns true if a squad is currently selected 

  Source: [LuaUI.cpp (898)]  

Void  Misc_SelectSquad( SquadID squad, Boolean bSelected )
 

Add or remove squad members from the current selection 

  Source: [LuaUI.cpp (992)]  

Void  Misc_SetDefaultCommandsEnabled( Boolean enabled )
 

Enables / Disables right-click command input. 

  Source: [LuaUI.cpp (1121)]  

Void  Misc_SetSelectionInputEnabled( Boolean enabled )
 

Enables / Disables selection input. 

  Source: [LuaUI.cpp (1115)]  

Boolean  Misc_SetSquadControlGroup( SquadID squad, Integer groupIndex )
 

Makes a squad belong to a specific control group. 

  Source: [LuaUI.cpp (1090)]  

Void  Misc_SetTeamColour( Integer teamNum, String racePath, Integer primaryIndex, Integer secondaryIndex, Integer tintIndex, Integer extraIndex, Integer badgeIndex, Integer patternIndex )
 

Sets the team colour for a given team based on the indeces passed in. Team number is assumed to be 0-5. 

  Source: [LuaUI.cpp (1170)]  

Void  NIS_PlaySpeech( Integer locID, Real speechTime )
 

Plays subtitle during NISes. 

  Source: [LuaUI.cpp (1557)]  

Void  Subtitle_EndCurrentSpeech( Void  )
 

Prematurely finish currently playing speech and advance the next one in queue 

This is useful for skipping speech events

  Source: [LuaUI.cpp (1849)]  

Void  Subtitle_PlaySpeech( String icon, Integer locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath, Integer actorNameLocID, Boolean queue )
 

Plays a global speech with subtitle and actor icon in the overlay 

please make sure that the the speech file is 2D

  Source: [LuaUI.cpp (1667)]  

Void  Subtitle_PlaySpeechAt( Integer 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

  Source: [LuaUI.cpp (1730)]  

Void  Subtitle_PlaySquadSpeech( SquadID squad, String icon, Integer locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath, Integer actorNameLocID )
 

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.

  Source: [LuaUI.cpp (1842)]  

Void  Subtitle_PlaySquadSpeechRadiolized( SquadID squad, String icon, Integer locID, Boolean disableIconSubtitle, Boolean continueButton, Boolean blockInput, Boolean stickySubtitle, String additionalPath, Integer actorNameLocID )
 

Plays 2D, radiolized speech spoken by one of guys in the squad with subtitle and actor icon in the overlay 

localization id is used for both subtitle text and speech

  Source: [LuaUI.cpp (1834)]  

Void  Subtitle_UnstickCurrentSpeech( Void  )
 

Removes "sticky" state from currently playing speech (if any) 

  Source: [LuaUI.cpp (1873)]  

blipID  TacticalMap_AddPing( StackVar where, Real lifetime, Integer blipType )
 

Add pings to tactical map. 

Be careful to remove your ping if needed! The following blipTypes are available: BT_GeneralPing, BT_CombatPing BT_PowerPing, BT_SelectionPing, BT_BuildingBoomPing, BT_AbilityPing, BT_ObjectivePrimary, BT_ObjectiveSecondary, BT_ObjectiveMedal, BT_AttackHerePing, BT_DefendHerePing, BT_CaptureHerePing,

  Source: [UI.scar (187)]  

Void  UI_AddHintAndFlashAbility( PlayerID playerid, AbilityID abilityID, LocString text, Integer 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.

  Source: [UI.scar (548)]  

Void  UI_ClearEventCues( Void  )
 

Clears all active event cues 

  Source: [LuaUI.cpp (553)]  

Void  UI_CoverPreviewHide( Void  )
 

Toggle off cover preview. Each call to UI_CoverPreviewHide must be matched by a call to UI_CoverPreviewShow 

  Source: [LuaUI.cpp (643)]  

Void  UI_CoverPreviewShow( Void  )
 

Toggle on cover preview. Each call to UI_CoverPreviewShow must be matched by a call to UI_CoverPreviewHide 

  Source: [LuaUI.cpp (627)]  

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) 

  Source: [UI.scar (525)]  

Void  UI_CreateEventCueNonClickable( String iconPath, LocString title )
 

Creates a non-clickable event cue. 

  Source: [LuaUI.cpp (528)]  

Void  UI_CreateEventCueTutorial( String iconPath, LocString title, LocString description )
 

Creates a tutorial-like event cue. 

  Source: [LuaUI.cpp (453)]  

Void  UI_CreateEventCueTutorialWithImages( String iconPath, LocString title, LocString description, String imageLeftPath, String imageCentrePath, String imageRightPath, String speechPath )
 

Creates a tutorial-like event cue with supporting images. 

  Source: [LuaUI.cpp (422)]  

Void  UI_CreateEventCueWithPosition( String iconPath, LocString title, const Math::Vector3f worldPos, Integer entityID, Boolean alliesOnly )
 

Creates an event cue with a world position and entity ID (set entity ID to zero if you don't want to use it) 

  Source: [LuaUI.cpp (484)]  

PingID  UI_CreateMinimapPing( MarkerID/ScarPos/EGroupID/SGroupID where, Integer blipType[, Real lifetime] )
 

Creates a ping on the minimap at a given marker, position, EGroup or SGroup. The following pingtypes are available: PT_Attack, PT_Defend, PT_PointOfInterest 

You can pass in an optional lifetime (in seconds) - the ping will automatically be removed after this expires.

  Source: [UI.scar (75)]  

Void  UI_CreateSGroupKickerMessage( PlayerID player, SGroup sgroup, LocString message )
 

Create a custom kicker message on the squad and display to the player. 

  Source: [UI.scar (498)]  

Void  UI_EnableEventCueType( Integer 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_BuildSquadComplete, etc

  Source: [LuaUI.cpp (572)]  

Void  UI_EnableSquadDecorator( SquadID squad, Boolean enabled )
 

Turn on or off squad decorator. The default is decorator enabled 

  Source: [LuaUI.cpp (671)]  

Void  UI_EnableSquadMinimapIndicator( SquadID squad, Boolean enabled )
 

Turn on or off squad minimap indicator. The default is decorator enabled 

  Source: [LuaUI.cpp (682)]  

Void  UI_HighlightSGroup( SGroupID sgroup, Real duration )
 

Highlights an SGroup in the UI for the given duration 

  Source: [UI.scar (10)]  

  UI_RemoveMinimapPing( PingID ping )
 

Removes a ping from the minimap, and the manager 

  Source: [UI.scar (106)]  

Void  UI_ResetSquadDecorator( SquadID squad )
 

Return to the default setting for showing the squad decorator. 

  Source: [LuaUI.cpp (659)]  

Void  UI_SetSelectionUIVisible( Boolean enable )
 

Sets the Selection UI visible or not 

  Source: [LuaUI.cpp (604)]  

Void  UI_ShowGameplay( Boolean show )
 

Shows and Hides the UI related to Gameplay 

Can be used to show and hide the UI panels related to gameplay (leaves intel events up)

  Source: [UI.scar (632)]  

Void  UIWarning_Show( LocString locText )
 

Displays a brief UI warning in the critical alert message area. 

  Source: [LuaUI.cpp (413)]  

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.

  Source: [LuaUI.cpp (332)]  

Boolean  WinWarning_Exists( String name )
 

Returns true if the named win warning exists. 

  Source: [LuaUI.cpp (356)]  

Void  WinWarning_FastFinishUpdate( Real fastFinishMultiplier )
 

Triggers a sound event update on fast finish value 

  Source: [LuaUI.cpp (398)]  

Void  WinWarning_PublishLoseReminder( PlayerID player, Integer 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

  Source: [LuaUI.cpp (382)]  

Void  WinWarning_Remove( String name )
 

Removes an added win/lose warning 

  Source: [LuaUI.cpp (349)]  

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.

  Source: [LuaUI.cpp (366)]  

Void  WinWarning_SetTextAndNumber( String name, LocString locText, Integer number )
 

Set the text for a win warning. 

Designers: PLEASE be careful how you use this. Use Loc_FormatText where nesc. for localization.

  Source: [LuaUI.cpp (374)]  

Void  WinWarning_SetTickerUpdated( Integer teamID, Integer oldTickerNumber, Integer newTickerNumber )
 

Triggers a sound event update on ticker value 

  Source: [LuaUI.cpp (390)]  

Void  WinWarning_UpdateTickerWinningAndLosing( Integer winningTeamID, Integer winningTickerNumber, Integer losingTeamID, Integer losingTickerNumber )
 

Sends out winner and loser teams with their ticker values 

  Source: [LuaUI.cpp (404)]  

 

 

Util
Functions

  ChangeColour( Void  )
 

Debug function to change the color of a selected unit 

  Source: [ScarUtil.scar (2294)]  

Void  Game_EndSP( Boolean win[, LocString message, Boolean nis] )
 

Ends the single player game (win/lose). You can optionally specify a message that will show up in the gameover dialog box 

  Source: [ScarUtil.scar (1802)]  

Void  Game_FadeToBlack( Bool direction, Real length )
 

Fades the screen to black - FADE_OUT to fade to black, FADE_IN to fade back in 

  Source: [ScarUtil.scar (1644)]  

LocString  Loc_FormatText( Integer FormatID )
 

Returns a formatted localized string. 

Use this function to format localized text. ie %1PLAYERNAME% is going to win.

  Source: [ScarUtil.scar (1714)]  

Lua Table  Marker_BuildMarkerList( String name, Int!marker type )
 

Builds a table of markers based on the string name 

  Source: [ScarUtil.scar (2505)]  

PlayerID  SafePlayer( PlayerID player )
 

Checks that the human player specified is still valid. Returns the same player if it is, the other player if it isn't. 

For example, pass in player_coop and it will return player_coop if that player is there, and player_main if the coop player isn't available (either by dropping, or not being there in the first place)

  Source: [ScarUtil.scar (2447)]  

  SGroup_GetNonKnockedOutSquad( )
 

Get an available non knocked out squad from an sgroup. 

  Source: [ScarUtil.scar (2327)]  

  SGroup_IsKnockedOut( )
 

Determine if all squads in an sgroup are knocked out. 

  Source: [ScarUtil.scar (2311)]  

Void  Sound_PlayOnSquad( String soundpathname, SGroupID sgroupid )
 

Play sound on the first entity of the squad in sgroup 

  Source: [ScarUtil.scar (1619)]  

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. 

  Source: [ScarUtil.scar (1872)]  

Lua Table  Util_AddTables( Lua Table, Lua Table )
 

Adds 2 lua tables together 

the returned table, name will = "bob". This function will not modify either of the existing tables, but will return a new one.

  Source: [ScarUtil.scar (2476)]  

  Util_ApplyUpgrade( UpgradeID!upgrade [, Boolean instant] )
 

Applies an upgrade to something (EGroup, SGroup, Entity, Squad, Player). Instant is true by default. 

  Source: [ScarUtil.scar (2698)]  

Boolean  Util_CheckOneTeamLeft( String win_condition )
 

If only one team is alive, players on that team win. Returns true if one team left. 

  Source: [ScarUtil.scar (785)]  

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

  Source: [ScarUtil.scar (2207)]  

Int  Util_CountSpawned( SGroup!/ EGroup )
 

Counts spawned entities in a group 

  Source: [ScarUtil.scar (2525)]  

  Util_CreateEntities( PlayerID player, EGroupID egroup, EntityBlueprint/Table ebp, Integer/String level, Marker/Pos/SGroup/EGroup spawn_point[, Integer numentities] )
 

High level function to create entities and give them basic orders upon spawning. detailed explanation found in Confluence 

  Source: [ScarUtil.scar (222)]  

Void  Util_CreateEntitiesAtMarker( PlayerID player, EGroupID egroup, Integer blueprintID, MarkerID/Pos location, Integer numentities )
 

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. 

  Source: [ScarUtil.scar (319)]  

  Util_CreateGroup( String groupname )
 

Creates an SGroup or an EGroup depending if item is an Entity, Squad, SGroup, or EGroup 

  Source: [ScarUtil.scar (2653)]  

  Util_CreateSquads( PlayerID player, SGroupID sgroup, SquadBlueprint/Table sbp, Integer/String level, Marker/Pos/SGroup/EGroup spawn_point[, Position destination, Integer numsquads, Integer loadout, WargearTable wargear] )
 

High level function to create squads and give them basic orders upon spawning. detailed explanation found in Confluence 

  Source: [ScarUtil.scar (558)]  

Void  Util_CreateSquadsAndGarrison( PlayerID playerid, SGroupID sgroup, Integer blueprintID, EGroupID/SGroupID hold, Integer numsquads[, Bool overload[, Integer loadout]] )
 

Creates a given number of squads and instant load them in to a hold and adds them to an sgroup. You can optionally also specify whether to overload the buiding or not & the squad loadout (default setting sets to NOT overload & uses normal loadout ) 

  Source: [ScarUtil.scar (456)]  

SGroupID  Util_CreateSquadsAndGarrisonExit( PlayerID playerid, SGroupID sgroup, Integer blueprintID, EGroupID hold_egroupid, Integer numsquads, MarkerID/Pos exitpos[, Bool overload[, Integer loadout]] )
 

Creates a given number of squads and instant load them in to a hold and adds them to an sgroup. It then exit them from the hold and move to a position. You can optionally also specify whether to overload the buiding or not & the squad loadout (default setting sets to NOT overload & uses normal loadout ) 

To ask the exited squad to do any subsequent actions, please use queued commands

  Source: [ScarUtil.scar (518)]  

Void  Util_CreateSquadsAtMarker( PlayerID playerid, SGroupID sgroup, Integer blueprintID, MarkerID/Pos location, Integer numsquads[, Integer loadout] )
 

Creates 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) 

  Source: [ScarUtil.scar (372)]  

Void  Util_CreateSquadsAtMarkerFacing( PlayerID playerid, SGroupID sgroup, Integer blueprintID, MarkerID/Pos marker, MarkerID/Pos facingmarker, Integer numsquads[, Integer loadout] )
 

Creates a given number of squads at a marker position (facing another marker) and adds them to an sgroup. You can optionally also specify the loadout (it will default to the min loadout if left off) 

  Source: [ScarUtil.scar (416)]  

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)

  Source: [ScarUtil.scar (1982)]  

Variable  Util_DifVar( Table difficultyVariables )
 

Takes in a table and chooses the right variable for the difficulty setting. 1-4 elements. 

  Source: [Setup.scar (297)]  

Boolean  Util_EntityLimit( [Integer 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. 

  Source: [ScarUtil.scar (2020)]  

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

  Source: [ScarUtil.scar (1482)]  

Int  Util_GetAbilityID( String blueprint_name )
 

Returns the ability ID, given its name (full path name to the ability bag). 

Example input would be "abilities/ally_blah_blah_blah_ability.lua"

  Source: [ScarUtil.scar (1208)]  

Integer  Util_GetActiveSquadCommand( SGroup!/ Squad )
 

Gets the active squad command for an SGroup or Squad. See Squad_GetActiveCommand for a list of valid squad commands. 

If an SGroup is passed in with more than one squad it will return the active squad command of a random squad within the SGroup.

  Source: [ScarUtil.scar (2798)]  

Int  Util_GetCamouflageStanceID( String blueprint_name )
 

Returns the camouflage stance ID, given its name (full path name to the stance bag). 

Example input would be "camouflage_stance_type/hold_fire_stance.lua"

  Source: [ScarUtil.scar (1264)]  

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 

  Source: [ScarUtil.scar (1751)]  

  Util_GetClosestObject( Obj position, LUA!Table Objects, INT range )
 

Returns the closest object in a table 

  Source: [ScarUtil.scar (2366)]  

Int  Util_GetCriticalID( String blueprint_name )
 

Returns the critical bag ID, given its name (full path name to the critical bag). 

Example input would be "critical/soldier_killed.lua"

  Source: [ScarUtil.scar (1224)]  

Int  Util_GetDamageID( String blueprint_name )
 

Returns the damage bag ID, given its name (full path name to the critical bag). 

The possible names are "damage/damage_green.lua", "damage/damage_yellow.lua" and "damage/damage_red.lua"

  Source: [ScarUtil.scar (1232)]  

Void  Util_GetEntitiesByBP( EGroupID sourcegroup, EGroupID destgroup, Integer bpID )
 

Find all the entities with a given blueprint in sourcegroup and add them to destgroup. 

See also: EGroup_Filter()

  Source: [ScarUtil.scar (1019)]  

Int  Util_GetEntityBlueprintID( String blueprint_name )
 

Returns the ebp ID, given its name (full path name to the entity blueprint). 

Example input would be "ebps/races/allies/buildings/checkpoint.lua"

  Source: [ScarUtil.scar (1240)]  

  Util_GetFurthestObject( Obj position, LUA!Table Objects, INT range )
 

Returns the furthest object in a table 

  Source: [ScarUtil.scar (2391)]  

  Util_GetGameID( )
 

Returns the game id for the item 

  Source: [ScarUtil.scar (2545)]  

  Util_GetGameID( )
 

Gives the Game ID of the passed in Entity or Squad 

  Source: [ScarUtil.scar (2682)]  

Void  Util_GetMouseoverSGroup( Void  )
 

Returns a unique SGroup used to hold mouseover squads obtained from Util_AddMouseoverSquadToSGroup 

  Source: [ScarUtil.scar (1899)]  

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 

For SGroup and EGroups, chooses the first spawned squad/entity in preference to the first despawend one, if available.

  Source: [ScarUtil.scar (740)]  

Position  Util_GetPosition( Variable var )
 

Returns a position from entity/marker/pos/egroup/sgroup/squad 

  Source: [ScarUtil.scar (1688)]  

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.

  Source: [ScarUtil.scar (1567)]  

  Util_GetRandomObject( Obj position, LUA!Table Objects, INT range )
 

Returns the random object in a table 

  Source: [ScarUtil.scar (2416)]  

Int  Util_GetSlotItemID( String blueprint_name )
 

Returns the slot item ID, given its name (full path name to the slot item bag). 

Example input would be "slot_item/allies_grenades.lua"

  Source: [ScarUtil.scar (1256)]  

Int  Util_GetSquadBlueprintID( String blueprint_name )
 

Returns the sbp ID, given its name (full path name to the squad blueprint). 

Example input would be "sbps/races/allies/soldiers/rifleman_squad.lua"

  Source: [ScarUtil.scar (1248)]  

Void  Util_GetSquadsByArmourType( SGroupID sourcegroup, SGroupID destgroup, String armourtype )
 

Find all the squads with a given armour type in sourcegroup and add them to destgroup. 

destgroup will be created if it does not already exist. See Squad_HasArmourType for list of valid armour types.

  Source: [ScarUtil.scar (963)]  

Void  Util_GetSquadsByBP( SGroupID sourcegroup, SGroupID destgroup, Integer bpID )
 

Find all the squads with a given blueprint in sourcegroup and add them to destgroup. 

See also: SGroup_Filter()

  Source: [ScarUtil.scar (1004)]  

Number  Util_GetTrailingNumber( String val )
 

Returns trailing numbers from a string, if it exists, nil otherwise. E.G. "marker23" would return 23. 

  Source: [ScarUtil.scar (1031)]  

Int  Util_GetUpgradeID( String blueprint_name )
 

Returns the upgrade ID, given its name (full path name to the upgrade bag). 

Example input would be "upgrade/allies/item/allies_squad_item_bazooka.lua"

  Source: [ScarUtil.scar (1216)]  

  Util_GroupDelete( )
 

Empties an EGroup or SGroup then destroys the empty group (for groups we no longer need) 

  Source: [ScarUtil.scar (2768)]  

  Util_GroupForEach( SGroup!/ EGroup, Function f )
 

Runs function f for each entry in the group 

  Source: [ScarUtil.scar (2535)]  

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

  Source: [ScarUtil.scar (1946)]  

  Util_LoadOnce( String!/ FilePath )
 

Checks to see if a file has already been loaded via this command, if not, imports it 

NOTE: It can not check if files are imported via the import() function

  Source: [ScarUtil.scar (2828)]  

BlueprintTable  Util_MakeBlueprintTable( Args args )
 

Function takes multiple strings and returns a BlueprintTable ( used for SGroup_ContainsBlueprints ) 

Example:
local bpTable = Util_MakeBlueprintTable( "sbps_pvp_sm_assault_marine", "sbps_pvp_sm_assault_marine", "sbps_pvp_sm_tactical_marine" )
--Check if SGroup contains ALL items from the list (two assault marines and a tactical marine)
local result = SGroup_ContainsBlueprints( "sg_MyGroup", bpTable, true )

--Check if an SGroup contains ANY blueprints from the list result = SGroup_ContainsBlueprints( "sg_MyGroup", bpTable, false )

  Source: [ScarUtil.scar (924)]  

void  Util_MarkerFX( String markername, String eventfile )
 

Play an events file at a given markers location 

  Source: [ScarUtil.scar (1045)]  

Void  Util_MissionTitle( LocString title )
 

Play the mission title fade. 

  Source: [ScarUtil.scar (1271)]  

Void  Util_MuteAmbientSound( Boolean enable, [Real fade] )
 

Enabling this function will mute the ambient sound (NOT all sound). 

  Source: [ScarUtil.scar (2257)]  

Void  Util_PhilTestFunction( String value )
 

Test function checking Scardoc. Prints value passed into it. 

  Source: [ScarUtil.scar (2284)]  

Void  Util_PlayClosingNIS( String NISname, LuaFunction OnComplete )
 

Plays a mission's closing NIS with appropriate fades, letterboxes, etc. Provides 1 callback: OnComplete is called after the event is over (this would be where to set the winner) 

  Source: [ScarUtil.scar (1122)]  

Void  Util_PlayMidMissionNIS( String NISname, LuaFunction OnScreenFaded, LuaFunction OnComplete )
 

Plays a mid mission NIS with appropriate fades, letterboxes, etc. Provides 2 callbacks: OnScreenFaded is called when the screen is faded to black right after the NIS (but still during the event), and OnComplete is called after the event is over. 

  Source: [ScarUtil.scar (1106)]  

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 

  Source: [ScarUtil.scar (2235)]  

Void  Util_PlayOpeningNIS( String NISname, LuaFunction OnScreenFaded, LuaFunction OnComplete )
 

Plays a mission's opening NIS with appropriate fades, letterboxes, etc. Provides 2 callbacks: OnScreenFaded is called when the screen is faded to black right after the NIS (but still during the event), and OnComplete is called after the event is over. 

  Source: [ScarUtil.scar (1087)]  

  Util_ReloadScript( Void  )
 

Reloads the running scar script. Current running rules would also be updated to the redefined functioin. 

  Source: [ScarUtil.scar (1606)]  

Void  Util_RestoreMusic( )
 

Resumes playing the music track that was last triggered i.e. after a save/load 

  Source: [ScarUtil.scar (2246)]  

Position  Util_ScarPos( Real xpos, 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.

  Source: [ScarUtil.scar (215)]  

  Util_SetAnimatorAction( SGroup!/!EGroup item, String animatorAction )
 

Plays an AnimatorAction on the item 

  Source: [ScarUtil.scar (2573)]  

  Util_SetAnimatorState( SGroup!/!EGroup item, String stateMachineName, String stateName )
 

Sets the Animator State on the item 

  Source: [ScarUtil.scar (2612)]  

  Util_SGroupHasWargearEquipped( )
 

Determine if given sgroup has either all (or any) of the specified wargear. Returns true if conditions satisfied, false otherwise. 

wargear_table is a table of wargear names (string). If all is true, sgroup must have all wargear equipped, otherwise any match is sufficient.

  Source: [ScarUtil.scar (2344)]  

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.

  Source: [ScarUtil.scar (1065)]  

Void  Util_StartNIS( LuaFunction func )
 

Play an NIS. These have the highest priority, and will interrupt Intel Events and Stingers. 

This function should used instead of Event_Start because it handles priorities.

  Source: [ScarUtil.scar (1055)]  

Void  Util_StartStinger( 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.

  Source: [ScarUtil.scar (1074)]  

  Util_TeamCanSee( bool any/all )
 

Returns the game id for the item 

  Source: [ScarUtil.scar (2557)]  

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.

  Source: [ScarUtil.scar (1293)]  

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)

  Source: [ScarUtil.scar (2062)]  

Void  World_KillAllNeutralEntitesNearMarker( MarkerID marker )
 

Kills ALL world entities near a marker 

  Source: [ScarUtil.scar (1735)]  

 

 

Various
Functions

Real  app_currenttime( Void  )
 

Return the current app time 

  Source: [AppLua.cpp (187)]  

Void  app_fixedframerate( Real frameRate )
 

Run the game at specified frame rate (for capturing movies) 

  Source: [AppLua.cpp (181)]  

Boolean  app_isgamealive( Void  )
 

Returns true if the app is currently "playing the game" 

  Source: [AppLua.cpp (142)]  

Nil  Campaign_AddBridgeTip( Lua!Table tip_table )
 

Creates a standardized gameplay tip for the bridge-level campaign log. (Campaign Lua) 

  Source: [campaignutil.lua (376)]  

Nil  Campaign_AddDefendNotification( String mapID, String missionID )
 

Creates a standard notification that a defend mission has populated (Campaign Lua) 

  Source: [campaignutil.lua (519)]  

Nil  Campaign_AddInventoryNotification( Lua!Table tip_table, Boolean is_hidden )
 

Creates a standardized wargear inventory tip for the bridge-level campaign log. If is_hidden is true, no kicker is played. (Campaign Lua) 

  Source: [campaignutil.lua (408)]  

Nil  Campaign_AddStatusUpdateNotification( LuaTable update_table )
 

Triggers a status update for the campaign log (Campaign Lua) 

  Source: [campaignutil.lua (1062)]  

Nil  Campaign_CleanUpThreatenedStratagems( String planetID )
 

Sets all stratagems on a planet to unthreatened, unless a defend mission is currently active there (Campaign Lua) 

  Source: [campaignutil.lua (1034)]  

Real  Campaign_GetActiveMissionCount( String!planet_id (optional) )
 

Counts the number of active missions across the sector or on a specified planet (Campaign Lua) 

  Source: [campaignutil.lua (153)]  

Real  Campaign_GetAllowedDefendCount( )
 

Returns the allowable number of random defend missions remaining at this point in the campaign (Campaign Lua) 

  Source: [SM_util.lua (234)]  

Real  Campaign_GetCompletedAct2CriticalPathMissions( )
 

Counts the number of completed critical path missions in Act 2. (Campaign Lua) 

  Source: [SM_util.lua (209)]  

String  Campaign_GetDefendMission( String planetID, Integer stratagemType, Real tyranidRating )
 

Returns the defend mission appropriate (Campaign Lua) 

  Source: [campaignutil.lua (723)]  

Integer  Campaign_GetDefensibleStratagemCount( String planet, String stratagemType )
 

Returns the number of stratagems of a type the player owns on a planet, on which a defend mission could populate (Campaign Lua) 

  Source: [campaignutil.lua (969)]  

Real  Campaign_GetEventCountSector( String event_id )
 

Returns the total number of times an event has executed across all planets. (Campaign Lua) 

  Source: [campaignutil.lua (81)]  

Lua Table  Campaign_GetLocationTable( String location_id )
 

Returns a copy of a location's (map's) data table from planets.lua (Campaign Lua) 

  Source: [campaignutil.lua (117)]  

LuaTable  Campaign_GetPlanetIDs( )
 

Returns a lua table containing the IDs of the planets in the game. These IDs are strings. (Campaign Lua) 

  Source: [campaignutil.lua (63)]  

Lua Table  Campaign_GetPlanetTable( String planet_id )
 

Returns a copy of the planet's data table from planets.lua (Campaign Lua) 

  Source: [campaignutil.lua (102)]  

Real  Campaign_GetRemainingRandomMissionCount( Boolean count_active )
 

Counts the number of random missions that are not complete. If count_active is false, active missions are removed from the count. (Campaign Lua) 

  Source: [campaignutil.lua (196)]  

Lua Table  Campaign_GetRemainingRandomMissionTable( Boolean count_active )
 

Returns a table of incomplete random missions. If include_active is false, active missions are removed from the table. (Campaign Lua) 

  Source: [campaignutil.lua (228)]  

Lua Table  Campaign_GetStratagemsTable( String location_id )
 

Returns a copy of a location's (map's) stratagems table from planets.lua (Campaign Lua) 

  Source: [campaignutil.lua (140)]  

Integer  Campaign_GetValidDefendCount( String stratagemType )
 

Returns the number of stratagems the player owns on which a defend mission could populate (Campaign Lua) 

  Source: [campaignutil.lua (995)]  

Real  Campaign_IsDefendEventValid( String mapID, Integer stratagem_type_to_defend, Integer other_stratagem )
 

Returns true if a defend mission can be validly populated on a given map and stratagem (Campaign Lua) 

  Source: [SM_util.lua (161)]  

Boolean  Campaign_IsMissionActiveOrComplete( String mission_id )
 

Return true if a mission has been completed or is currently active. (Campaign Lua) 

  Source: [campaignutil.lua (48)]  

Boolean  Campaign_IsMissionDefend( String missionID )
 

Returns true if the mission is on the list of defend missions (Campaign Lua) 

  Source: [campaignutil.lua (461)]  

Boolean  Campaign_IsRandomBossValid( String planetID, Real boss_threshold )
 

Returns true if a boss threshold for act 2 missions is met and a Random boss is valid (Campaign Lua) 

  Source: [campaignutil.lua (358)]  

Nil  Campaign_PopulateEmptyPlanet( String planet_id )
 

Forces a mission to activate on a planet without any. (Campaign Lua) 

  Source: [campaignutil.lua (260)]  

LuaTable  CloneTable( LuaTable original )
 

Creates a duplicate of an existing table, which can then be modified without changing the original table (Campaign Lua) 

  Source: [campaignutil.lua (1143)]  

Void  cursor_hide( Void  )
 

Hide the cursor 

  Source: [AppLua.cpp (175)]  

Void  cursor_show( Void  )
 

Show the cursor 

  Source: [AppLua.cpp (169)]  

Boolean  EBP_Exists( String name )
 

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

  Source: [LuaBlueprint.cpp (40)]  

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.

  Source: [FallBack.scar (27)]  

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.

  Source: [FallBack.scar (71)]  

Void  FallBack_RemoveLocation( PlayerID player, String marker )
 

Remove a fallback location from the manager. 

Remove a fallback location from the manager.

  Source: [FallBack.scar (46)]  

Integer  fatal( lua_State* state )
 

Throws an error to lua and print out the error message 

  Source: [Scar.cpp (275)]  

Void  FOW_EnableTint( Boolean enable )
 

Enable or disable Fog-of-war tinting. Applies to outside playable area as well. 

  Source: [LuaGameEngineScar.cpp (29)]  

Integer  Game_GetSPDifficulty( Void  )
 

Returns current single player difficulty. Values are GD_EASY, GD_NORMAL, GD_HARD, GD_EXPERT. 

  Source: [LuaGameMisc.cpp (229)]  

Void  Game_LoadAtmosphere( String filename )
 

Replaces atmosphere with the one in the specified file 

  Source: [LuaGameMisc.cpp (235)]  

Integer  getgametype( Void  )
 

Gets the type of game we are playing (GT_SINGLEPLAYER_CAMPAIGN, GT_SINGLEPLAYER_SKIRMISH, GT_MULTIPLAYER_CAMPAIGN, GT_MULTIPLAYER_SKIRMISH, GT_PLAYBACK ) 

  Source: [LuaGameObj.cpp (258)]  

Integer  getlocalplayer( Void  )
 

Returns the local player index 

  Source: [LuaGameObj.cpp (158)]  

String  getmapname( Void  )
 

Returns the scenario name (shortname version eg. "2P Semois") 

  Source: [LuaGameObj.cpp (266)]  

hero table (see blankHero for description)  Heroes:CreateHero( Campaign.HeroTable hero )
 

Returns a new hero table for hero of given Campaign.HeroTable 

New hero is added to list of heroes

  Source: [Heroes.scar (40)]  

  Heroes:ForEach( function(hero)!func!-!where!hero!is!a!table!(see!blankHero!for description) )
 

Call func for each hero 

  Source: [Heroes.scar (87)]  

  Heroes:ForEachHeroInSGroup( function(hero)!func!-!where!hero!is!a!table!(see!blankHero!for description), SGroup sgroup, boolean!all!-!defaults!to false, if true, includes!despawned units. )
 

Call func for each hero 

  Source: [Heroes.scar (95)]  

hero table (see blankHero for description)  Heroes:Get( string/number heroName )
 

Returns the hero table for hero of given name or index 

  Source: [Heroes.scar (67)]  

hero table (see blankHero for description)  Heroes:GetByName( string heroName )
 

Returns the hero table for hero of given name 

  Source: [Heroes.scar (81)]  

hero table (see blankHero for description) or nil if no matching hero found  Heroes:GetHeroFromSquad( Squad squad )
 

Find and return the first matching hero comprised from the given squad  

  Source: [Heroes.scar (114)]  

The hotkey number. 0 for invalid hotkey.  Heroes:GetHotkeyForHero( string/table/number!sbpOrIndex!-!blueprint name, hero table, or!hero index. )
 

Given a hero name, table, or index, return the hotkey for that hero 

Prefer hero.ctrl_group if hero table is fully initialized

  Source: [Heroes.scar (131)]  

Void  Leveling_CompleteQuest( PlayerID player, LocString quest_id )
 

Moves an objective from the profile's list of quests in progress to its list of complete quests. Called by Objective_Complete. 

This gets called by Objective_Complete and so should usually not be necessary to call on its own.

  Source: [Procedural-Functions.scar (270)]  

Void  Leveling_FailQuest( PlayerID player, LocString quest_id )
 

Moves an objective from the profile's list of quests in progress to its list of failed quests. Called by Objective_Failed. 

This gets called by Objective_Fail and so should usually not be necessary to call on its own.

  Source: [Procedural-Functions.scar (308)]  

Void  Leveling_InitDiscovery( )
 

Setup the list of regions that can be discovered on your map.  

Reads in the t_RegionList table and then checks for discovery markers.

Call this once in the setup of the quest.

  Source: [Procedural-Functions.scar (607)]  

Void  listplayers( Void  )
 

Print all players information. 

  Source: [LuaGameObj.cpp (78)]  

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

  Source: [LuaLocalizer.cpp (151)]  

LocString  Loc_ConvertNumber( Integer number )
 

Returns a localized string containing the number. 

  Source: [LuaLocalizer.cpp (88)]  

LocString  Loc_Empty( Void  )
 

Empty string. 

This will create an empty localized string.

  Source: [LuaLocalizer.cpp (142)]  

LocString  Loc_FormatText( Integer FormatID )
 

Returns a formatted localized string. 

Use this function to format localized text. ie %1PLAYERNAME% is going to win.

  Source: [campaignutil.lua (21)]  

LocString  Loc_FormatTime( Integer 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) 

  Source: [LuaLocalizer.cpp (102)]  

Boolean  Misc_AIControlLocalPlayer( Void  )
 

Let AI take over local player 

  Source: [LuaGameMisc.cpp (82)]  

Boolean  Misc_DetectKeyboardInput( Void  )
 

Returns true if the app has had any keyboard input in the last second 

  Source: [LuaGameDev.cpp (117)]  

Boolean  Misc_DetectMouseInput( Void  )
 

Returns true if the app has had any mouse input in the last second 

  Source: [LuaGameDev.cpp (106)]  

Void  Misc_EnablePerformanceTest( Boolean toEnable )
 

Turn on or off the performance test monitoring 

  Source: [LuaGameMisc.cpp (100)]  

Integer  Misc_GetLocalPlayerID( Void  )
 

Returns the player ID of the local player. Returns -1 if no local player. 

You can never assume that there will be a local player! There is no local player in recorded games and ai vs ai games.

  Source: [LuaGameMisc.cpp (354)]  

PlayerID  Misc_GetPlayerFromName( String playerName )
 

Returns the playername for this player 

  Source: [LuaGameMisc.cpp (309)]  

String  Misc_GetPlayerName( PlayerID pPlayer )
 

Returns the playername for this player 

  Source: [LuaGameMisc.cpp (276)]  

LocString  Misc_GetPlayerNameLocalized( PlayerID pPlayer )
 

Returns the localized playername for this player 

  Source: [LuaGameMisc.cpp (293)]  

Boolean  Misc_IsHumanPlayer( PlayerID pPlayer )
 

Returns true if this player is run by a human, locally or remotely 

  Source: [LuaGameMisc.cpp (338)]  

Boolean  Misc_IsPosOnScreen( Position pos )
 

Check if position is on screen 

  Source: [LuaGameMisc.cpp (89)]  

Void  Misc_SetDesignerSplatsVisibility( Boolean bVisible )
 

Shows or hides designer splats, which are splats in the UI folder 

  Source: [LuaGameMisc.cpp (185)]  

Void  network_show( Void  )
 

toggle the network debug information 

  Source: [AppLua.cpp (107)]  

Integer  norenderwithupdate_toggle(  lua_State* )
 

Disable rendering but keep render updating 

  Source: [AppLua.cpp (95)]  

String questStatus  Objective_CheckQuestStatus( PlayerID player, LuaTable obj_table )
 

Get the status of a quest from the persist profile. 

Possible results are:/n/n "in_progress"/n "failed"/n "complete"/n "not_found"/n

  Source: [Procedural-Functions.scar (726)]  

Void  Objective_CompleteXP( LuaTable obj_table, PlayerID player[, SgroupID sgroup] )
 

Completes an Objective and awards the associated xp value. Plays a kicker on a passed in sgroup (if any). 

If the obj_table has no value for xp, this completes the objective and then returns.

If no player is passed in, defaults to player at position 1.

If no Sgroup is passed in (or if the sgroup doesnot exist), no kicker is played, but the XP is still awarded.

  Source: [Procedural-Functions.scar (347)]  

Integer  Player_GetRaceProbabilities( PlayerID playerid )
 

Returns assorted player data. 

Quest probabilities determine the chance of particular enemies and particular quests appearing procedurally. They're stored in Persistant info so that they can be modified based on player exploits.

  Source: [Procedural-Functions.scar (206)]  

String  PlayerProfile_GetVar( String varname )
 

Retrieve a custom value in current player profile. Returns an empty string if value does not exist 

  Source: [LuaGameMisc.cpp (201)]  

Void  PlayerProfile_SetVar( String varname, String value )
 

Save a custom value in current player profile. 

  Source: [LuaGameMisc.cpp (216)]  

ScarPosition  Position_GetRandomPosition( ScarPosition ceneter, float radius )
 

Use to get a random position based within a circle 

Algorythm and distribution:

The method for determining the position will use no weighting so to allow an even distribution through the cirlce.

  Source: [Procedural-Functions.scar (373)]  

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.

  Source: [PrintOnScreen.scar (21)]  

Void  PrintOnScreen_RemoveFromScreen( )
 

Remove any messages from the screen 

Removes from the screen any messages put there with PrintOnScreen()

  Source: [PrintOnScreen.scar (57)]  

Void  quit( Void  )
 

Exit to windows 

  Source: [AppLua.cpp (76)]  

Integer  render_toggle(  lua_State* )
 

Disable rendering and render update 

  Source: [AppLua.cpp (83)]  

ResourceAmount  ResourceAmount_Add( ResourceAmount amt1, ResourceAmount amt2 )
 

Add each element of the two passed in ResourceAmounts together 

  Source: [LuaModObjects.cpp (49)]  

ResourceAmount  ResourceAmount_ClampToZero( ResourceAmount amt )
 

Clamps the passed in resource to zero if it has any negative numbers 

  Source: [LuaModObjects.cpp (73)]  

Real  ResourceAmount_Get( ResourceAmount amt, Integer resourceType )
 

Get the amount of a specific resource. 

  Source: [LuaModObjects.cpp (37)]  

Boolean  ResourceAmount_Has( ResourceAmount amt1, ResourceAmount amt2 )
 

Returns true if the first amount has enough resources for the second amount (amt2) 

  Source: [LuaModObjects.cpp (67)]  

ResourceAmount  ResourceAmount_Mult( ResourceAmount amt1, Real mult )
 

Take a resource amount and multiply each value inside of it by mult 

  Source: [LuaModObjects.cpp (55)]  

ResourceAmount  ResourceAmount_Subtract( ResourceAmount amt1, ResourceAmount amt2 )
 

Subtract the second amount from the first and return the new ResourceAmount 

  Source: [LuaModObjects.cpp (43)]  

Real  ResourceAmount_Sum( ResourceAmount amt1 )
 

Add up all the numbers in the resource and return a single value 

  Source: [LuaModObjects.cpp (61)]  

ResourceAmount  ResourceAmount_Zero( Void  )
 

Creates a new ResourceAmount all set to zero 

  Source: [LuaModObjects.cpp (31)]  

Void  restart( Void  )
 

Restart the single player or the skirmish game. (does not work in multi-player games) 

  Source: [AppLua.cpp (226)]  

Void  Restrict_PlayerToLevel( PlayerID playerId, Integer level, RestrictionTable restrictions )
 

Applies restrictions. Call this at the begining of mission. 

  Source: [Restrict.scar (46)]  

Void  RulesProfiler_Activate( Boolean on )
 

Activate the scar RulesProfiler 

  Source: [LuaGameObj.cpp (211)]  

Void  RulesProfiler_Enable( Boolean on )
 

Enable the scar RulesProfiler so it runs in the background. Call this before RulesProfiler_Activate 

  Source: [LuaGameObj.cpp (205)]  

Boolean  RulesProfiler_IsActive( Void  )
 

Returns true if the scar RulesProfiler is active 

  Source: [LuaGameObj.cpp (217)]  

Boolean  SBP_Exists( String name )
 

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

  Source: [LuaBlueprint.cpp (46)]  

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) 

  Source: [LuaGameScar.cpp (57)]  

Void  Scar_DoFile( const char *scriptName )
 

Run the specified scar script file 

  Source: [LuaGameObj.cpp (245)]  

Void  Scar_DoString( String str )
 

Run the specified scar command 

  Source: [LuaGameObj.cpp (251)]  

Void  Scar_Reload( Void  )
 

Reload all scar scripts 

  Source: [LuaGameObj.cpp (239)]  

Integer  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 

  Source: [Scar.cpp (98)]  

String  scartype_constant_tostring( Integer v )
 

Convert a scartype constant to a string 

  Source: [Scar.cpp (200)]  

String  scartype_tostring( LuaBinding::StackVar v )
 

Returns a string representing the scartype 

  Source: [Scar.cpp (193)]  

Void  setsimframecap( Real fcap )
 

Set the simulation rate 

  Source: [LuaGameObj.cpp (45)]  

Void  setsimpause( Void  )
 

Pause the simulation. 

  Source: [LuaGameObj.cpp (63)]  

Void  Stamp_Place( String filename, MarkerID marker )
 

Places a GameStamp at the position of a marker 

filename should be relative to the Assets/Simulation/GameStamps directory without extension

  Source: [LuaGameMisc.cpp (443)]  

Void  Stamp_PlaceGroup( String filename, MarkerID marker, EGroupID egroup )
 

Places a GameStamp at the position of a marker, newly added Entities will be added to the given EGroup 

filename should be relative to the Assets/Simulation/GameStamps directory without extension

  Source: [LuaGameMisc.cpp (409)]  

Integer  statgraph_save( Boolean begin )
 

Save the statgraph output to a file 

  Source: [AppLua.cpp (160)]  

Integer  switchplayer( lua_State* state )
 

Change the local player. 

  Source: [LuaGameObj.cpp (174)]  

Item/Table  Table_GetPCRand( Table table[, Integer numberofitems] )
 

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

  Source: [Procedural-Functions.scar (76)]  

Integer  Tut_GetLocalPlayerIndex( Void  )
 

Returns the local player index to be used with World_GetPlayerAt. 

  Source: [LuaGameMisc.cpp (381)]  

  typecheck( Void  )
 

Add runtime type checking to a lua function; my_function = typecheck( ST_NUMBER, ST_STRING )( my_function ) 

  Source: [typecheck.scar (17)]  

  typecheck_class( The!class!to!add!typechecking to. )
 

Add runtime type checking to a lua class; e.g. MyClass = typecheck_class( MyClass ) 

  Source: [typecheck.scar (119)]  

Void  UI_XpKicker( PlayerID player_id, SGroupID sgroup, Real xp_num) )
 

Play a kicker on an sgroup showing added XP 

Plays the kicker in the form "+ NUM XP"

  Source: [Procedural-Functions.scar (258)]  

Void  Util_AutoIntel( Table intelEventTable, [Boolean random, Int priority] )
 

Auto-generate an Intel Event, playing all lines in order, or if random is set to true it will randomly choose one line from the table to play. 

priority is a integer to indicate priority of the speech events (default is 5, mid)

  Source: [dow2_autointel.scar (9)]  

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

  Source: [ScarUtil.scar (161)]  

Position  Util_GetOffsetPosition( entity/squad/egroup/sgroup/marker/position pos, Integer 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. 

  Source: [ScarUtil.scar (184)]  

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

  Source: [ScarUtil.scar (168)]  

Boolean status  Util_RegionIsDiscovered( PlayerID player, String region )
 

Returns true if a particular region has been discovered.  

Reads from the persistent profile. Make sure to use the one-word non-localize region string defined in t_RegionList table.

  Source: [Procedural-Functions.scar (862)]  

Void  Util_SpawnChaffStructures( String region )
 

Spawn chaff structures across a region defined in the map's t_RegionList table 

The race of the spawned structures depends on the owner established in the t_RegionList table.

The structure type is determined by the naming of the marker and the units put in the global t_StructureList spawn table.

  Source: [Procedural-Functions.scar (128)]  

Void  VIS_OccCullToggleOBB( Void  )
 

toggle the visibility of occlusion culling OBB 

  Source: [luagameengine.cpp (44)]  

Boolean  Weather_GetEnabled( Void  )
 

Query if weather is enabled 

  Source: [LuaGameMisc.cpp (531)]  

Integer  Weather_GetSplashQuality( Void  )
 

Query the level-of-detail for the rain splashes. 

  Source: [LuaGameMisc.cpp (484)]  

Void  Weather_SetEnabled( Boolean bEnable )
 

Enable or disable weather entirely 

  Source: [LuaGameMisc.cpp (493)]  

Void  Weather_SetSplashQuality( Integer level )
 

Sets the level-of-detail for the rain splashes. 0 is off, 1 is low, 2 is high. 

  Source: [LuaGameMisc.cpp (449)]  

  WinCondition_RemoveAllVictoryPoints( Void  )
 

Remove all Victory Point objects; use this if you don't need VP objects for your win condition. 

  Source: [WinCondition.scar (141)]  

  WinCondition_StartupAnnihilate( Void  )
 

Startup the annihilate win condition 

  Source: [WinCondition.scar (153)]  

  WinCondition_StartupVictoryPoints( Void  )
 

Initialize the victory point win condition 

  Source: [WinCondition.scar (11)]  

 

 

Wargear
Functions

EGroupID  Player_GetWargearDropEntities( PlayerID player )
 

Returns an EntityGroupObs containing all the currently dropped wargear entities available to the given player. 

This function returns a 'global' entity group with the name '__Player%dWargearDropEntities', 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.

  Source: [LuaWargear.cpp (273)]  

Void  Player_WargearPickup( PlayerID player, EntityID entity )
 

Picks up the given WargearDrop entity. 

entity must have a WargearDropExt (e.g., returned by Player_GetWargearDropEntities).

  Source: [LuaWargear.cpp (307)]  

Void  SGroup_EquipDefaultWargear( SGroupID sgroup )
 

Equips default wargear on all squads in an SGroup 

  Source: [LuaWargear.cpp (146)]  

Void  SGroup_EquipWargear( SGroupID sgroup, String wargearName )
 

Equips a specified piece of wargear on all entities in an SGroup 

  Source: [LuaWargear.cpp (130)]  

Boolean  SGroup_HasWargearEquipped( SGroupID sgroup, String wargearName )
 

Returns true if any squad in SGroup has wargearName equipped 

  Source: [LuaWargear.cpp (175)]  

Void  SGroup_UnequipWargear( SGroupID sgroup, String wargearName )
 

Unequips a specified piece of wargear from every squad in SGroup 

  Source: [LuaWargear.cpp (159)]  

String  Wargear_GetWargearBlueprintName( EntityID entity )
 

Returns name of given WargearDrop entity. 

  Source: [LuaWargear.cpp (432)]  

Integer  Wargear_GetWargearType( EntityID entity )
 

Returns the WargearType for the given WargearDrop entity. 

This function returns one of: WT_Weapon, WT_Armour, WT_Accessory, WT_CommanderAccessory, WT_Consumable. entity must have a WargearDropExt (e.g., returned by Player_GetWargearDropEntities).

  Source: [LuaWargear.cpp (332)]  

Boolean  Wargear_IsExclusive( EntityID entity )
 

Returns true if the given WargearDrop entity is an exclusive item. 

  Source: [LuaWargear.cpp (382)]  

Boolean  Wargear_IsInventoryItem( EntityID entity )
 

Returns true if the given WargearDrop entity is an inventory item. 

  Source: [LuaWargear.cpp (407)]  

Boolean  Wargear_IsUnique( EntityID entity )
 

Returns true if the given WargearDrop entity is a unique item. 

  Source: [LuaWargear.cpp (357)]  

Void  World_DisableWargearDrops( Integer wargearType )
 

Disables random wargear drops 

wargearType is one of: WT_Weapon, WT_Armour, WT_Accessory, WT_CommanderAccessory, WT_Consumable. Explicit SCAR commands to drop wargear will still work

  Source: [LuaWargear.cpp (211)]  

Void  World_DropWargearAtPosition( PlayerID playerToDropWargearFor, String wargearName, Position dropPosition )
 

Drops a predetermined piece of wargear at the specified position 

  Source: [LuaWargear.cpp (239)]  

Void  World_EnableWargearDrops( Integer wargearType )
 

Enables random wargear drops 

wargearType is one of: WT_Weapon, WT_Armour, WT_Accessory, WT_CommanderAccessory, WT_Consumable. Explicit SCAR commands to drop wargear will still work

  Source: [LuaWargear.cpp (197)]  

Void  World_GenerateAndDropWargearAtPosition( PlayerID playerToDropWargearFor, Integer unitWargearDropType, Integer dropLevel, Position dropPosition )
 

Randomly generates and drops a piece of wargear at the specified position 

unitWargearDropType can be: UWDT_PlanetBoss, UWDT_Boss, UWDT_MiniBoss, UWDT_Chaff, UWDT_Swarm

  Source: [LuaWargear.cpp (249)]  

Void  World_ResetWargearDropsEnabled( Void  )
 

Resets random wargear drops to fully enabled 

Explicit SCAR commands to drop wargear will still work

  Source: [LuaWargear.cpp (225)]  

Void  World_SetWargearDropsDisabled( Void  )
 

Sets random wargear drops to fully disabled 

Explicit SCAR commands to drop wargear will still work

  Source: [LuaWargear.cpp (233)]  

 

 

World
Functions

Void  Player_PickupAllWargear( PlayerID player )
 

Pickup every dropped piece of wargear by given player 

  Source: [Wargear.scar (23)]  

Void  World_CleanUpTheDead( PlayerID player )
 

Kill off a specific player's dead bodies (enter ALL to clean them all up) 

  Source: [ScarUtil.scar (1661)]  

Integer  World_ConcessionWinningPlayerSlot( Void  )
 

Return an ID of a player on the winning team in the case of a concession victory 

  Source: [luaworld.cpp (420)]  

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.

  Source: [luaworld.cpp (130)]  

Real  World_DistancePointToPoint( Position p1, Position p2 )
 

Get the distance between two points. 

  Source: [luaworld.cpp (113)]  

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.

  Source: [luaworld.cpp (175)]  

Real  World_DistanceSquaredPointToPoint( Position p1, Position p2 )
 

Get the distance squared between two points. 

  Source: [luaworld.cpp (120)]  

Void  World_DropWargear( PlayerID playerToDropWargearFor, String wargearName, MarkerID/ScarPosition target )
 

Drops a piece of wargear at the specified target 

  Source: [Wargear.scar (6)]  

Void  World_EnablePlayerToPlayerFOW( PlayerID p0, PlayerID p1, Boolean enable )
 

Enables or disables the fog of war between these two players 

  Source: [LuaWorld.cpp (472)]  

Void  World_EndSP( Boolean win )
 

Wins/loses a single team mission for the local teams 

  Source: [LuaWorld.cpp (172)]  

Integer  World_GetEntitiesNearMarker( PlayerID player, EGroupID egroup, MarkerID marker, Integer ownerType )
 

Find and add entities near the marker to the egroup 

Entities belonging to a squad would not be added to the egroup

  Source: [LuaWorld.cpp (781)]  

Integer  World_GetEntitiesNearPoint( PlayerID player, EGroupID egroup, Position pos, Real radius, Integer ownerType )
 

Find and add entities near the point to the egroup 

Entities belonging to a squad would not be added to the egroup

  Source: [LuaWorld.cpp (609)]  

EntityID  World_GetEntity( Integer index )
 

Returns the EntityID at given index, use with World_GetNumEntities() to iterate through all the entities in the world 

  Source: [LuaWorld.cpp (399)]  

Real  World_GetGameTime( Void  )
 

Return the total game time in seconds. 

  Source: [luaworld.cpp (52)]  

Position  World_GetHiddenPositionOnPath( PlayerID player, MarkerID/Pos origin, MarkerID/Pos destination, Integer 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.

  Source: [MoreUtils.scar (12)]  

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)

  Source: [luaworld.cpp (316)]  

Integer  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

  Source: [LuaWorld.cpp (878)]  

Integer  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

  Source: [LuaWorld.cpp (675)]  

Integer  World_GetNumEntities( Void  )
 

Returns the number of spawned entities in the entire world (use sparingly and never at runtime) 

  Source: [LuaWorld.cpp (390)]  

Integer  World_GetNumEntitiesNearPoint( Integer ebpid, Position pos, Integer radius )
 

Return the number of entities of the same ebpid in the sphere volume 

  Source: [LuaWorld.cpp (502)]  

Integer  World_GetNumStrategicPoints( Void  )
 

Returns the number of strategic points on this map (does not count strat. objectives) 

  Source: [LuaWorld.cpp (327)]  

Integer  World_GetNumVictoryPoints( Void  )
 

Returns the number of strategic objectives on this map 

  Source: [LuaWorld.cpp (366)]  

Position  World_GetOffsetPosition( Position position, Position heading, Integer 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. If the position is outside the world, it is clamped and a warning is issued to the scarlog. 

  Source: [luaworld.cpp (217)]  

PropertyBagGroup  World_GetPBG( String pbgname )
 

Return a PBG for use by many functions (should only be used at load time) 

Example name would be "abilities\ally_mad_minute_ability"

  Source: [luaworld.cpp (407)]  

PlayerID  World_GetPlayerAt( Integer index )
 

- Returns the player at a given index, numbers start at one 

  Source: [luaworld.cpp (82)]  

Integer  World_GetPlayerCount( Void  )
 

Return the total number of players in the world 

  Source: [luaworld.cpp (58)]  

Integer  World_GetPlayerIndex( PlayerID player )
 

- Returns the player index given the Player* 

  Source: [luaworld.cpp (97)]  

Integer  World_GetPossibleBuildingsCount( Integer race_index )
 

Returns the number of types of buildings a race can build 

  Source: [LuaWorld.cpp (221)]  

String  World_GetPossibleBuildingsName( Integer race_index, Integer building_index )
 

Returns the name of a chosen building for a race 

  Source: [LuaWorld.cpp (234)]  

Integer  World_GetPossibleBuildingsPBGID( Integer race_index, Integer building_index )
 

Returns the PBG ID of a chosen building for a race 

  Source: [LuaWorld.cpp (254)]  

Integer  World_GetPossibleSquadsCount( Integer race_index )
 

Returns the number of types of squads a race can build 

  Source: [LuaWorld.cpp (274)]  

String  World_GetPossibleSquadsName( Integer race_index, Integer squad_index )
 

Returns the blueprint name of a chosen squad for a race 

  Source: [LuaWorld.cpp (287)]  

Integer  World_GetPropertyBagGroupCount( Integer type )
 

Return the number of property bag groups of the same type 

Example type would be PBG_Critical

  Source: [luaworld.cpp (374)]  

Integer  World_GetPropertyBagGroupID( String groupname )
 

Returns the property bag group ID, given its name (full path name to the property bag). 

Example input would be "ability/campaign/playable/race/ability"

  Source: [luaworld.cpp (358)]  

String  World_GetPropertyBagGroupName( PropertyBagGroup pbg )
 

Return the path name of the group 

Example name would be "abilities\ally_mad_minute_ability"

  Source: [luaworld.cpp (400)]  

String  World_GetPropertyBagGroupPathName( Integer type, Integer id )
 

Return the path name of the group 

Example name would be "abilities\ally_mad_minute_ability"

  Source: [luaworld.cpp (384)]  

Integer  World_GetRaceIndex( String racename )
 

Returns the race index of a race, given its name (from the ME). 

Valid race names for COH are "Allied Rifle Company" and "Axis Infantry Company"

  Source: [LuaWorld.cpp (416)]  

Integer  World_GetRand( Integer min, Integer max )
 

Returns a random integer with range [min, max] 

It is recomended you use this instead of luas math.random function

  Source: [luaworld.cpp (280)]  

Position  World_GetSpawnablePosition( Position around, EntityID entity )
 

Given any position in the world, this function will return position safe for spawning a given entity 

  Source: [LuaWorld.cpp (73)]  

Integer  World_GetSquadsNearMarker( PlayerID player, SGroupID sgroup, MarkerID marker, Integer 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

  Source: [LuaWorld.cpp (684)]  

Integer  World_GetSquadsNearPoint( PlayerID player, SGroupID sgroup, Position pos, Real radius, Integer 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

  Source: [LuaWorld.cpp (542)]  

Void  World_GetStrategicAndVictoryPoints( EGroupID egroup )
 

Puts all strategic and victory points in the map into an egroup 

  Source: [LuaWorld.cpp (351)]  

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)

  Source: [luaworld.cpp (309)]  

Boolean  World_IsGameOver( Void  )
 

- to document 

  Source: [luaworld.cpp (76)]  

Boolean  World_IsPropertyBagGroupValid( String groupname )
 

Returns true if this propertybaggroup is valid, given its name (full path name to the property bag). 

Example input would be "ability/campaign/playable/race/ability"

  Source: [luaworld.cpp (344)]  

Boolean  World_OwnsEntity( EntityID entity )
 

Returns true if the squad is owned by the world 

  Source: [luaworld.cpp (267)]  

Boolean  World_OwnsSquad( SquadID squad )
 

Returns true if the squad is owned by the world 

  Source: [luaworld.cpp (273)]  

Boolean  World_PointPointProx( Math::Vector3f p1, Math::Vector3f p2, Real prox )
 

Returns true if two world positions are in proximity to each other 

  Source: [LuaWorld.cpp (478)]  

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
If the position is outside the world it is clamped and a warning is generated in the scarlog.

  Source: [luaworld.cpp (248)]  

Position  World_PosUnsafe( Real x, Real y, Real z )
 

Creates a new Position object similar to World_Pos, but if the position is outside the world it is ***not*** clamped. 

  Source: [luaworld.cpp (261)]  

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. 

  Source: [LuaWorld.cpp (486)]  

Void  World_SetGameOver( Void  )
 

- to document 

  Source: [luaworld.cpp (64)]  

Void  World_SetPlayerLose( PlayerID player, String identifier )
 

Sets the player and all the members allied to player to a win state, with a reason for winning. Sets the player to a lose state, with a reason for losing, and kills the player 

  Source: [LuaWorld.cpp (110)]  

Void  World_SetTeamWin( PlayerID player, String identifier )
 

Also sets all other players to a lose state, and kills them (if they're not already dead) 

  Source: [LuaWorld.cpp (120)]