Scripting API

Every function the mission scripts can call, grouped by class. The Since column is the Easy Red 2 version a call was introduced in: anything newer than the build you are targeting will not exist there.

📖 Scripting Guide ⚡ Callbacks API 🤖 Script Generator
AiParams

Class that handles AI parameters management.

ReturnFunction NameDescriptionSinceVote
voidallowBeingTargetedIf enabled, enemies will target this soldier whenever they see him. If disabled, the soldier will be completly ignored by enemies. Toghether with allowCheckForEnemies, this function is helpful to script systems like Civilian or Non combatant medics.2.1.0▲ 440
voidallowChangePoseWhen enabled, AI will change pose depending on cover, suppression and other situations. Disable this function if you want to control soldier's pose by custom scripting2.1.0▲ 377
voidallowCheckForEnemiesWhen enabled, AI will check for enemies around and target them. When this function is disabled AI will not search and target enemies. Useful for custom AI implementations2.1.0▲ 375
voidallowDoMedicWhen this function is enabled, if a soldier has medic equipments in his inventory he will proceed to heal nearby units2.1.0▲ 309
voidallowFindCoverWhenSuppressedWhen enabled, AI will automatically find cover when suppressed. If you want to move the AI trough custom scripting, you most likely want to disable this feature2.1.0▲ 366
voidallowFollowOrdersWhen enabled, AI will automatically follow squad leader orders. If you want to move this specific unit with your custom scripts, for example by using Soldier.moveTo function, most likely you want this to be disabled2.1.0▲ 346
voidallowGiveOrdersWhen enabled, AI will automatically give orders to the squad if squad leader. If you want to give orders to a squad with your custom scripts, for example by using Squad.moveTo function, most likely you want this to be disabled2.1.0▲ 344
voidallowLeaveVehicleWhen enabled, AI will leave vehicle when necessary. If you want to control which vehicle the AI should use or force an AI never to leave a vehicle, you might want to disable this feature2.1.0▲ 356
voidallowMovementsWhen enabled, AI will perform move commands. if you don't want the AI never to move, not even with moveTo commands, disable this feature2.1.0▲ 341
voidallowOpenWindowsWhen enabled, AI will open windows that blocks it's vision, for example when in cover behind a window2.1.0▲ 342
voidallowRadioOrdersWhen enabled and if radioman, AI will communicate radio orders requested by squad leader2.1.0▲ 314
voidenableAiBehaviourThis function enables or disbales all AI functionalities toghether, including: allowChangePose, allowCheckForEnemies, allowFindCoverWhenSuppressed, allowLeaveVehicle, allowMovements, allowOpenWindows, allowOrders and allowRadioOrders2.1.0▲ 382
ObjectivefindObjectiveFind an objective from it's unique Id (network safe). Useful in case you have to reference a specific objective across different phases or players, based on it's unique Id, for example, passed trough a global variable2.1.0▲ 242
voidfollowCustomDirectCommandsDisable various AI behaviors in order to prepare the soldier to follow direct commands, such as soldier.moveTo()2.1.0▲ 370
voidfollowCustomSquadOrdersNormally squad soldiers will automatically give the orders that they cosndier the best according to the situation. This function disables various AI behaviors in order to prepare the soldier to only follow and give custom squad orders via code, such as squad.moveTo()2.1.0▲ 346
stringgetNameReturn the name of the vehicle2.1.0▲ 314
voidsetTargetPlanesOftenEnable this feature to force the AI to target planes, if closer than any other spotted enemy2.1.0▲ 382
Base Functions

These functions are not part of a specific class and can be called from anywhere.

ReturnFunction NameDescriptionSinceVote
void#includeInclude an external file into the code of a lua script. Useful to create files with collections of functions to share across different script. Included files must be placed within the folder '[mission folder]/scripts/general/' or any subfolder. The script will be pre-processed and aded to the final code before executing it2.1.0▲ 344
floatdistanceThe distance between 2 Vector3 points in meters2.1.0▲ 311
voidlogLog some text in the F3 console. This helps a lot with testing custom Lua code. press F3 to open the console and visualize the log2.1.0▲ 329
voidprintDisplay a message on the screen2.1.0▲ 503
floatroundRound a number to a specific quantity to decimal points2.1.0▲ 431
voidsayMissionClipLoads a voice clip from the mission "sounds" folder, plays it from the soldier's mouth. Currently only .waw files are supported.2.1.0▲ 106
voidsleepPause the execution of the LUA script for some time. Notice: this is very helpful to give some pause to the CPU, expecially during 'while' and 'for' loops2.1.0▲ 369
SoldierspawnHumanSpawn a new human without specific loadout or rank. Faction Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 340
ObjectivespawnMissionObjectiveSpawn a Scriptable Mission Objective on current active phase and it's relative 3D Marker on the current phase. Only the master client can spawn and handle a Mission Objective. A Scriptable Objective doesn't do anything in particular on it's own. The user must make sure to update it's progress value, text, and other parameters on it's own, otherwise it will just act as a 3D Marker. For icon Ids see setIcon.2.1.0▲ 422
SoldierspawnSoldierSpawn an AI soldier. Faction Ids and loadout Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 380
SoldierspawnSoldierOnVehicleSpawn an AI soldier on a vehicle. Faction Ids and loadout Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 335
SquadspawnSquadSpawn an AI squad. Faction Ids and Squad Ids can be acquired in the Script Settings menu -> Id tables section. Can spawn custom squads made with Squad Editor2.1.0▲ 343
SquadspawnSquadOnVehicleSpawn an AI squad inside a given vehicle. Faction Ids and Squad Ids can be acquired in the Script Settings menu -> Id tables section. Vehicle crew squads will automatically fit the seats inside the vehicle. Can spawn custom squads made with Squad Editor2.1.0▲ 340
SquadspawnSquadOnVehicle_scriptSpawn an AI squad inside a given vehicle, and assign a script to each AI. Faction Ids and Squad Ids can be acquired in the Script Settings menu -> Id tables section. Vehicle crew squads will automatically fit the seats inside the vehicle. Can spawn custom squads made with Squad Editor2.1.0▲ 553
SquadspawnSquad_scriptSpawn an AI squad and assign a script to each AI. Faction Ids and Squad Ids can be acquired in the Script Settings menu -> Id tables section. Can spawn custom squads made with Squad Editor2.1.0▲ 443
VehiclespawnVehicleSpawn a vehicle. Vehicle Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 368
VehiclespawnVehicle_camoSpawn a vehicle with a specified camo. Vehicle Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 445
VehiclespawnVehicle_camo_destSpawn a vehicle with a specified camo and give it a destination. For Auto-Transport vehicles, this is where units will be deployed. Vehicle Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 360
VehiclespawnVehicle_destSpawn a vehicle and give it a destination. For Auto-Transport vehicles, this is where units will be deployed. Vehicle Ids can be acquired in the Script Settings menu -> Id tables section2.1.0▲ 333
voidwaitForAnyPause the execution of the script until any of the given conditions are met.2.1.0▲ 353
voidwaitUntilPause the execution of the script until one or multiple conditions are met.2.1.0▲ 417
er2

General utility and helper functions.

ReturnFunction NameDescriptionSinceVote
voidaddInvadersTicketsAdds tickets to the current invaders faction.2.1.0▲ 394
voidbindKeyCalls a callback when a keyboard key is pressed. The callback is one registered with er2.setCallback, so you bind a key to an id, not to a function. Binding the same key again replaces the previous id.Keys are watched only while at least one binding exists, and only on this computer: nothing is sent to the other players (call er2.runEveryone from the callback if you need that). The key is ignored while a menu or the chat has the focus, and on consoles there is no keyboard at all.Key names are Unity KeyCode names, case insensitive: F5, K, Alpha1 (the 1 above the letters), Keypad1, Space, LeftShift, Tab. Keys the game already uses still do their normal job.2.1.1▲ 41
voidbindKeyUpSame as bindKey, but the callback runs when the key is released. A key can have both a press and a release callback.2.1.1▲ 42
vec3cameraPositionGet the world position of the camera2.1.0▲ 332
voidclearAllRunOnJoinClear all buffered requests to run a script locally for joining users2.1.0▲ 280
NumberconsumeFactionSpendingReturns everything the players of this client have spent on births since the last call, and clears the tally. Subtract it from your own synced counter so the spending makes it back to the shared total.2.1.1▲ 68
floatconvertKmhInMsConverts a speed from kilometres per hour into metres per second, which is the unit the engine uses for every velocity.2.1.0▲ 64
floatconvertMsInKmhConverts a speed from metres per second, the unit the engine uses for every velocity, into kilometres per hour.2.1.0▲ 59
integercountAliveDefendersGet the count of all the currently alive defenders2.1.0▲ 341
integercountAliveInFactionGet the count of all the currently alive units on a specific faction2.1.0▲ 357
integercountAliveInvadersGet the count of all the currently alive invaders2.1.0▲ 399
integercountDeceasedDefendersCount how many defenders are deceased during the mission2.1.0▲ 348
integercountDeceasedInvadersCount how many invaders are deceased during the mission2.1.0▲ 350
integercountLostVehiclesDefendersCount how many defenders have been captured during the mission2.1.0▲ 332
integercountLostVehiclesInvadersCount how many invaders have been captured during the mission2.1.0▲ 255
integercountPrisonersDefendersCount how many vehicles have been lost by the defenders during the mission2.1.0▲ 308
integercountPrisonersInvadersCount how many vehicles have been lost by the invaders during the mission2.1.0▲ 316
voidcreateConquestPropPlaces a map prop in the world at runtime: crates, radios, sandbags, anything that is scenery rather than a vehicle.The prop is local and is not synchronised. Call this on every client with identical values, exactly as you would for createSpawn, or players will not see the same battlefield. Scenery has no shared state, so putting it on the network would be traffic spent for nothing.Vehicles are rejected on purpose: for those use spawnConquestVehicle.2.1.1▲ 73
NumbercreateSpawnCreates a spawn point at runtime and registers it in the current phase, so the respawn panel and the AI both see it.These spawns are local and are not synchronised. Call this on every client with identical values (drawing them from a shared seed is the easy way) or players will not agree on what exists.2.1.1▲ 67
voiddamageAllDamages every soldier and vehicle inside the radius. Unlike explosion it produces no visual or sound effect, and unlike destroyAll it leaves buildings standing.2.1.0▲ 65
voiddestroyAllDestroys all DestructableBuilding props within radius, including buildings not currently in view. Optionally kills units and explode vehicles.2.1.0▲ 111
voidendPrecipitationStops the rain or the snow from falling in the map To synchronize the weather changes to other clients you can use synchWeather.2.1.0▲ 316
voidexplosionGenerates an explosion2.1.0▲ 476
SoldierfindSoldierFind a soldier from it's unique Id (network safe). Useful in case you have to reference a specific soldier across different phases or players, based on it's unique Id, for example, passed trough a global variable2.1.0▲ 333
SoldierfindVehicleFind a vehicle from it's unique Id (network safe). Useful in case you have to reference a specific vehicle across different phases or players, based on it's unique Id, for example, passed trough a global variable2.1.0▲ 369
voidgetAllObjectivesGet all Mission Objectives in the current phase.2.1.0▲ 350
voidgetAllSoldiersGet all alive soldiers. Notice: After a new soldier spawns or dies, this function might get a few instant before returning a correctly updated value.2.1.0▲ 316
voidgetAllVehiclesGet all vehicles around the map2.1.0▲ 308
stringgetBattleNameReturns the current battle's name2.1.0▲ 350
NumbergetCurrentPhaseIdGet the Id of the current phases.2.1.0▲ 310
stringgetDefendersFactionGet the Id for the defenders faction2.1.0▲ 323
floatgetDistanceFromTerrainReturns the distance between the given position and the terrain.2.1.0▲ 331
NumbergetFactionBudgetThe last budget value communicated for a faction with setFactionBudget.2.1.1▲ 54
stringgetInvadersFactionGet the Id for the invaders faction2.1.0▲ 321
integergetInvadersTicketReturns the number of tickets left by the invaders2.1.0▲ 292
voidgetMapCenterThe centre of the playable terrain, in world coordinates. Use it as the origin when you generate something procedurally instead of hard-coding positions that only work on one map.2.1.1▲ 66
NumbergetMapLocationsFills a Lua table with the named places of the map (towns, villages, landmarks), each as a table with name and position. Useful to make a generated battle fight over real places instead of empty fields.2.1.1▲ 63
stringgetMapNameReturns the name of the map of the current battle2.1.0▲ 339
voidgetMapSizeThe size of the playable terrain in metres. Only x and z are meaningful; y is unused. Together with getMapCenter it gives you the rectangle a generated layout has to stay inside.2.1.1▲ 76
stringgetMyNicknameGet nickname of the local user2.1.0▲ 417
ObjectivegetNearestObjectiveGet the nearest Mission Objective to a specific location2.1.0▲ 273
SquadgetNearestSoldierGet nearest soldier to a specific location2.1.0▲ 344
VehiclegetNearestVehicleGet nearest vehicle from a specific location2.1.0▲ 315
stringgetNicknameGet nickname of an online player2.1.0▲ 289
SoldiergetPlayerFind a reference to the Soldier controlled by the player2.1.0▲ 329
NumbergetPropPositionsFills a Lua table with the positions of every map prop of a given kind inside a circle. propType is the type recorded in the prop database: environment, terrain, streets, buildings, props, vehicles, items, weapons. Handy to place objectives on actual buildings.2.1.1▲ 65
floatgetSettingMaxAlliesGet the max allies threshold set during match creation. It is suggested to use this value to measure the amount of AI to spawn according to player preference. This can be used to impact gameplay balancing and performance.2.1.0▲ 397
floatgetSettingMaxAxisGet the max axis threshold set during match creation. It is suggested to use this value to measure the amount of AI to spawn according to player preference. This can be used to impact gameplay balancing and performance.2.1.0▲ 326
integergetSettingMaxPlayersDefendersGet the max allowed amount of Human Players on the defenders faction. Works only during multiplayer matches2.1.0▲ 346
integergetSettingMaxPlayersInvadersGet the max allowed amount of Human Players on the invaders faction. Works only during multiplayer matches2.1.0▲ 346
floatgetSettingTicketsMultiplierGet the tickets multipler set during match creation2.1.0▲ 412
floatgetSettingUnitCountMultiplierReturns the multiplier the engine applies to the invaders' tickets, based on the unit count the match was actually started with compared to the count the mission was designed for. Companion to getSettingTicketsMultiplier.2.1.0▲ 62
TablegetSoldiersInAreaGet all alive soldiers within a specific radius from a specific position, ordered by the distance from the given position. Notice: After a new soldier spawns or dies, this function might get a few instant before returning a correctly updated value.2.1.0▲ 328
voidgetSpawnPositionWhere a spawn created by the script ended up. Note that createSpawn raises a position that is below the water line, so this can differ from what you passed in.2.1.1▲ 65
floatgetTerrainHeightReturns the terrain height from sea level of the given x and z coordinates.2.1.0▲ 347
integergetTimeOfDayHourGets the current time (hour)2.1.0▲ 118
integergetTimeOfDayMinuteGets the current time (minutes)2.1.0▲ 121
voidgetVehiclesInAreaGet all vehicles within a specific area2.1.0▲ 313
NumbergetWaterLevelThe height of the sea or river surface on this map. Anything below this is under water.2.1.1▲ 69
boolisAlliedCheck if a given faction Id is part of Allies faction2.1.0▲ 301
boolisAxisCheck if a given faction Id is part of Axis faction2.1.0▲ 321
AiParamsisCivilianCheck if a given faction Id is part of Civilians faction2.1.0▲ 337
boolisInsideMainTerrainBoundsChecks if the given position is inside the terrain bounds2.1.0▲ 409
boolisMasterClientCheck if current user is master client for online match. In an offline mission, the user is always the master client2.1.0▲ 431
boolisOnlineCheck if current mission is being played on an online match2.1.0▲ 431
boolisSameFactionCheck if two faction Ids are part of the same faction (Allies or Axis)2.1.0▲ 429
voidisWaterWhether a position is water rather than dry land. The margin lets you decide how much shoreline counts as water: a squad that would land in ankle-deep surf usually still needs a boat, so the default leans that way.2.1.1▲ 64
SquadmakeSquadCreate a new empty squad. You can add soldiers to this squad in order to make them react to squad orders2.1.0▲ 312
boolnextPhaseForce mission to skip to next phase2.1.0▲ 375
voidnukeGenerate a nuke explosion at a certain position. The nuke will devastate a certain area and will spawn a huge explosion visual effect with a never-ending smoke effect. Having multiple nuke smokes leftovers in a map can cause severe performance issues, so use this carefully.2.1.0▲ 277
voidnuke_nofxDestroys every destructible building inside the radius and damages the units and vehicles caught in it, without any visual effect. Use nuke or explosion when the blast should be seen. Buildings outside the player's view are destroyed too, and the work is spread across several frames.2.1.0▲ 62
voidplayClipPlay a global Audio Clip (.wav)2.1.0▲ 379
voidplayClip3DPlay a 3D Audio Clip, coming from a specific location and with a maximum hear distance (.wav). Notice: In various occasions, such as host change, a phase script might restart, so make use of set and get to check whenever set to be played in loop forever was already initialized to avoid spawning it multiple times.2.1.0▲ 345
voidplayClipOnRadioPlay a global Audio Clip with a radio distortion effect (.wav)2.1.0▲ 341
voidplayClipOnRadio3DPlay a 3D Audio Clip, coming from a specific location and with a maximum hear distance with a radio distortion effect (.wav)2.1.0▲ 335
voidplayMusicPlays a music track globally.2.1.0▲ 347
boolpreviousPhaseForce mission to skip to previous phase2.1.0▲ 362
floatraycastCasts a ray from an origin toward a direction. Used to test collisions and objects presence. The test is done trough a Unity Raycast.2.1.0▲ 333
voidremoveConquestWorldObjectsRemoves everything the three functions above put in the world: props, vehicles and their crews. Call it before regenerating a layout and when the mode ends.It also cancels the creations still in flight, so a prop whose prefab was still loading when you cleared the field does not appear a moment later on ground that no longer belongs to it.2.1.1▲ 57
voidremoveCreatedSpawnsRemoves every spawn this script created and unregisters them from the current phase. Call it before regenerating a layout, and when the mode ends.2.1.1▲ 70
voidrequireEquivalent to default Lua require function, but handles the script paths as local misison paths, to ensure easier file referencing and compatibility with Xbox, Nintendo Switch and PlayStation systems. External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder2.1.0▲ 440
boolresetCallbackUnassign a callback by it's Id.2.1.0▲ 375
voidresetCallbacksUnassign all global callbacks2.1.0▲ 367
voidresetFactionEconomyClears both budgets and the pending spending, and switches spawn costs off. Call it before setting up a new battle.2.1.1▲ 65
boolrunExecute an external file without stopping execution of current scrip. External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder2.1.0▲ 338
voidrunEveryoneRun a script locally for every player in the match (or just for the user if it's a SinglePlayer match). External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder2.1.0▲ 419
voidrunEveryoneOnceRun a script locally for every player in the match making sure it was not executed before (or just for the user if it's a SinglePlayer match). External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder2.1.0▲ 320
boolrunOnceExecute an external file without stopping execution of current scrip, if the external file was never executed before during the mission. External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder2.1.0▲ 434
boolsetCallbackregister a global callback on a specific event Id. Only a callback can be tied to an event Id, so when this is called again on the same Id, the new callback reference will override previous one. Callback Ids are specified at this page.2.1.0▲ 445
voidsetFactionBudgetTells the engine how many reinforcement points a faction has left. The respawn panel uses it to grey out spawns the side cannot afford, without waiting for a network round trip.The real counter stays in your script (a synced global is the usual place): this only mirrors it. Calling this at all is what switches spawn costs on.2.1.1▲ 55
boolsetPhaseChanges the current phase to the one of index order2.1.0▲ 388
voidsetRainingActivates the rain on the map. To synchronize the weather changes to other clients you can use synchWeather.2.1.0▲ 427
voidsetSnowingActivates the snow on the map. To synchronize the weather changes to other clients you can use synchWeather.2.1.0▲ 363
voidsetSpawnCostChanges what a player birth at this spawn costs the faction budget. Useful to make well-armed positions more expensive as the battle turns.2.1.1▲ 64
voidsetSpawnVehicleDestinationTells the vehicle of a spawn where to carry the squad before dropping it. Applies to anything the engine treats as an automatic transport: landing craft, gliders, cargo planes. The spawn is also turned to face that destination, so the vehicle appears pointing along its route instead of due north.Without a destination an automatic transport is created and simply sits there.2.1.1▲ 72
voidsetSpawnWaypointSends the squads born at this spawn towards a point as soon as they appear.2.1.1▲ 68
voidsetTaskTextDefendersSet task text for defenders2.1.0▲ 246
voidsetTaskTextInvadersSet task text for invaders2.1.0▲ 255
voidsetTimeAndWeatherSets the current time of day of the mission and some weather conditions, like clouds, snow and fog. To synchronize the weather changes to other clients you can use synchWeather. NOTE: This function it's CPU heavy2.1.0▲ 376
voidsetTimeOfDaySets the current time of day of the mission. NOTE: This function is CPU heavy2.1.0▲ 423
voidsetVictoryDefendersConcludes the mission declaring defenders as winners2.1.0▲ 584
voidsetVictoryInvadersConcludes the mission declaring invaders as winners2.1.0▲ 326
voidshowObjectiveDisplay a new objective text2.1.0▲ 343
voidspawnConquestVehiclePuts an empty vehicle in the world and leaves it there. Made for the guns and machine guns a battle is fought around: it is not a spawn point, so nobody is born in it and any unit that walks up to it can man it normally.Unlike the props, this one is a networked object: in multiplayer only the master client does anything and everyone else receives it automatically. On a client the call returns false and nothing happens, which is correct and not an error to guard against.2.1.1▲ 72
voidspawnConquestVehicleWithCrewThe same as spawnConquestVehicle, but the vehicle comes with an AI crew already aboard. This is how you leave a manned anti-tank gun or a bunker MG on the field.The squad may be one from the squads archive or a custom squad defined in the mission; the crew is cut down to the seats the vehicle actually has. Master client only, like spawnConquestVehicle: vehicle and soldiers are ordinary networked objects and reach everyone else on their own.2.1.1▲ 68
voidspawnItemPuts an item on the ground, with physics, as if someone had dropped it there. Any soldier can walk up and pick it up.Multiplayer: only the master client spawns it; the others receive it automatically and whoever picks it up removes it for everyone. Players joining later do not see items spawned before they arrived. On the other clients the call returns false and does nothing, so it is safe to call it from a script that runs on everyone.Items of a DLC the executing player does not own are skipped with a line in the F3 console.2.1.1▲ 41
voidsynchWeatherApply the weather changes to all clients. Must be called on Master Client. After calling this, set weather is automatically applied for newly connected clients. Calling it too often can result in high network traffic and mission crash.2.1.0▲ 294
floattimeTime in seconds since the start of the execution of the game. The value is linear and doesn't take into account pausing, slowing down or speeding up game time2.1.0▲ 335
floattimeScaledScaled time in seconds since the start of the execution of the game. If the game is paused the count of the time doesn't increase. If the game is speeding up or slowing down this variable also increases with a proportional rate2.1.0▲ 355
booltriggerCallbackForce the triggering of a callback set trough setCallback2.1.0▲ 411
stringtryLocalizeResolves a localization key into the language the player is using. Text starting with # is looked up in the mission localization file; anything else is returned unchanged, so it is safe to pass any string through it.2.1.0▲ 59
voidunbindKeyRemoves the press and release callbacks of a key. When the last key is unbound the keyboard is no longer watched. er2.resetCallbacks() and the end of the battle unbind every key.2.1.1▲ 41
global

Functions to manipulate global variables that can be accessed from any script and over the network.

ReturnFunction NameDescriptionSinceVote
anygetGet the value of a stored global variable2.1.0▲ 378
anymyplayergetGet the value of a stored global variable by my player.2.1.0▲ 355
voidmyplayersetSet a global variable for my network player that can be referenced from any script and by any player in the room. If another player sets a variable with the same id, it won't compromise my variable.2.1.0▲ 321
anyplayergetGet the value of a stored global variable by a specific player.2.1.0▲ 367
voidsetSet a global variable that can be referenced from any script and by any player in the room2.1.0▲ 434
hud

Controls the in-game mission status bar, the one showing flags, tickets and capture progress at the top of the screen. A mission script can hide the vanilla bar, hide the phase squares, and add its own icon + value fields to it. Exposed as the global hud.Nothing here is networked: like setTaskTextInvaders and setTaskTextDefenders, every client runs the mission script and drives its own local bar.

ReturnFunction NameDescriptionSinceVote
voidclearFieldsRemoves every custom field the script added to the bar. Does not touch the vanilla part.2.1.0▲ 61
boolisEnabledTells whether the mission status bar is currently enabled.2.1.0▲ 57
voidremoveFieldRemoves one custom field from the bar. Does nothing if no field with that id exists.2.1.0▲ 57
voidsetEnabledShows or hides the whole mission status bar for the rest of the battle. Scripted fields added with setField are hidden too.2.1.0▲ 35
voidsetFieldCreates a custom field on the bar, or updates it if a field with the same id already exists. Fields are drawn in creation order, so the first setField call for a given id decides its position.2.1.0▲ 79
voidsetFieldColorSets the colour of a field's value text. Components go from 0 to 1 and are clamped. Creates the field if it does not exist yet.2.1.0▲ 64
voidsetFieldSideMoves a HUD field to the right-hand end of the top bar instead of the left. Handy to keep your own numbers on your side and the enemy's under their flag.2.1.1▲ 72
voidsetFieldWidthReserves a fixed width for the field's value text, so a number that changes often does not make the rest of the bar shift around. Creates the field if it does not exist yet.2.1.0▲ 53
voidsetPhasesShows or hides the phase advancement squares. They are visible by default in every game mode. Hide them in missions that do not advance through linear phases, so players are not told to expect a progression that will never happen.2.1.0▲ 53
voidsetRespawnTextWrites a line of your own into the respawn menu, under the sector list, where the player decides whether to go back in. Newlines are honoured, so several values can be listed one per line. Pass an empty string to clear it.2.1.1▲ 73
voidsetVanillaBarShows or hides only the vanilla half of the bar: faction flags, tickets, capture squares and objectives. Fields added by the script stay visible.Useful for non-linear or scripted missions where the standard capture progress means nothing, but you still want a bar of your own.2.1.0▲ 66
Objective

Functions related to mission objective areas and markers.

ReturnFunction NameDescriptionSinceVote
boolcanControlCheck if user can change the objective data, such as objective name, completition value, radius, icon and position. Usually this correspond to the Master Client2.1.0▲ 335
voidcompleteSet the conquer progress of the Scripted Mission Objective to 1 (max). Equivalent of Objective.setProgress(1). Just like any other Mission Objective property, it doesn't work with Conquer Area Objective, or any other Vanilla objective type, but only with Scripted Mission Objective spawned with spawnMissionObjective call. Notice: When all the objectives in a Mission Phase are completed (progress = 1) the Next Phase is automatically triggered2.1.0▲ 440
stringgetDisplayNameReturns the objective's name as it appears in the interface, with any # localization key already resolved into the current language.2.1.0▲ 65
stringgetNameReturns the objective's name exactly as it is stored, without resolving a # localization key. Use getDisplayName if you need the text the player actually sees.2.1.0▲ 67
vec3getPositionGet the world position of the Mission Objective2.1.0▲ 435
floatgetProgressGet the progress of a Mission Objective. A value equals to 1 means that the Objective have been completed. When all Objectives in a Mission Phase are completed, the match pass automatically to the Next Phase2.1.0▲ 339
floatgetRadiusGet the area radius of the Mission Objective 2.1.0▲ 408
integergetUniqueIdGet unique identifier for the objective. This is useful to check if an objective already exist, or to find specific objective with findObjective, especially across the network or between different phases.2.1.0▲ 314
boolisAttractorCheck if a Mission Objective will attract default AI to fight on the area for at least a faction, or optionally, for a specific one.2.1.0▲ 322
boolisCompletedCheck whenever a Mission Objective progress is complete (check if Objective.getProgress >= 1). Notice: When all the Mission Objectives in the current Mission Phase are marked as completed, the Next Phase will automatically be triggered2.1.0▲ 327
boolisInsideCheck whenever a vec3() position is inside a specific Mission Objective, specifically within it's radius from it's center position2.1.0▲ 326
boolisScriptedCheck if a Mission Objective is a scriptable one 8Scripted Mission Objective spawned with spawnMissionObjective call), where it is possible to control all the data2.1.0▲ 354
voidremoveRemove this objective from the current Mission Phase. Just like setting properties, only the master client can call do this operation2.1.0▲ 337
voidresetIconDefendersUnset the icon of a Scripted Mission Objective specifically for the defenders faction, making it using the same icon as the attackers. This function impacts network performance during online gameplay, so don't call it too often. When this icon gets unset, the defenders will share the same icon as the attackers, which is assigned with setIcon2.1.0▲ 332
voidsetAttractorEnable or disable the attractor feature of the Scripted Mission Objective for both factions. When enabled, default AI will try to reach and fight inside the area. Optionally can change the effect for one faction only2.1.0▲ 338
voidsetIconUpdate the icon of a Scripted Mission Objective from the icon Id. This function impacts network performance during online gameplay, so don't call it too often. Possible Ids are: "0": Conquer area icon. "1": Defend area icon. "2": Clear area icon. "3": Destroy AT gun icon. "4": Destroy vehicle icon. "5": Important area icon. 2.1.0▲ 367
voidsetIconDefendersUpdate the icon of a Scripted Mission Objective from the icon Id, specifically for the defenders faction. This function impacts network performance during online gameplay, so don't call it too often. When this icon gets unset, the defenders will share the same icon as the attackers, which is assigned with setIcon2.1.0▲ 322
voidsetNameSets the objective's name. Works on scripted objectives only, and is synchronised over the network.A name starting with # is treated as a localization key and resolved from the mission localization file, so the same objective reads correctly in every language.2.1.0▲ 58
voidsetPositionUpdate the world position of a Scripted Mission Objective2.1.0▲ 327
voidsetProgressSet the conquer progress of the Scripted Mission Objective. Just like any other Mission Objective property, it doesn't work with Conquer Area Objective, or any other Vanilla objective type, but only with Scripted Mission Objective spawned with spawnMissionObjective call. Notice: When all the objectives in a Mission Phase are completed (progress = 1) the Next Phase is automatically triggered2.1.0▲ 353
voidsetRadiusUpdate the area radius of a Scripted Mission Task2.1.0▲ 278
voidsetSecuredFactionDeclares which faction actually holds this objective. Without it the engine assumes every held objective belongs to the invaders, so in a symmetric mode an area taken by the defenders would still be drawn in the invaders' colour.Pass an empty string for "nobody holds it".2.1.1▲ 70
voidsetTextUpdate the text of a Scripted Mission Objective. The text is displayed when inside the Mission Objective radius. This function impacts network performance during online gameplay, so don't call it too often2.1.0▲ 364
voidsetTextDefendersUpdate the text of a Scripted Mission Objective for the Defenders. The text is displayed when inside the Mission Objective radius. If this function is never called, the defenders will see the same text as the invaders. This function impacts network performance during online gameplay, so don't call it too often.2.1.0▲ 317
Soldier

Functions related to player actions and properties.

ReturnFunction NameDescriptionSinceVote
booladdAmmoAdds an ammo box to the soldier's invetory2.1.0▲ 363
voidaddItemToInventoryPuts an item in the soldier's inventory: a weapon, a magazine, an attachment, a bandage, a helmet, anything with an id in the items database. Online the change is sent to the owner of the soldier.Items of a DLC the executing player does not own are skipped with a line in the F3 console. Nothing is added when the inventory has no room.2.1.1▲ 41
booladdMagazineAdds a magazine to the soldier's invetory.2.1.0▲ 354
booladdNewItemAdds an item to the soldier's inventory2.1.0▲ 365
voidalertForPuts the soldier in an alert state for a defined time2.1.0▲ 331
voidapplyBleedingApplies bleed status to the soldier2.1.0▲ 310
voidboardVehicleOrder the soldier to approach and borar onto the specified vehicle if available.2.1.0▲ 354
boolcanSwitchSeatCheck if the soldier is ready to switch seat. Usually this happens when a soldier is not busy with enteirng or leaving the vehicle with an animation.2.1.0▲ 301
voidcarryBodyForce the soldier to carry a another incapacitated soldier2.1.0▲ 375
boolcontainsItemTells whether the soldier is carrying at least one item with this id.2.1.0▲ 59
integercountItemsCounts how many items with this id the soldier is carrying.2.1.0▲ 80
voiddamageSoldierApply damage to a soldier2.1.0▲ 291
voiddecreaseStaminaDecreases soldier's stamina2.1.0▲ 390
voiddisableHitByVehicleForDisable receiving damage from impacts with vehicles for some time2.1.0▲ 405
voiddropHeadgearMakes the soldier lose the headgear they are wearing, dropping it on the ground. Does nothing if they are bareheaded.2.1.0▲ 60
voidexecuteOrdersRoutineExecutes the routine to process squad orders for the soldier.2.1.0▲ 348
voidfindCoverFinds a cover position near a specified position within a given radius.2.1.0▲ 336
boolforceTargetForce a Soldier to target a specific Soldier or Vehicle. 2.1.0▲ 366
AiParamsgetAiParamsAccess AI parameters management2.1.0▲ 352
SoldiergetCarriedBodyGet a reference to the incapacitated soldier carried by this unit2.1.0▲ 400
stringgetClassNameReturns the soldier's class name2.1.0▲ 359
VehiclegetCurrentVehicleReturns the current vehicle the soldier is in2.1.0▲ 344
floatgetDistanceFromGroundGet the distance between the soldier and the ground below2.1.0▲ 312
vec3getFacePositionGet the world position of soldier's face2.1.0▲ 321
stringgetFactionGets the soldier's faction ID2.1.0▲ 382
vec3getFireDirectionReturn a vector representing the direction where the gun held by the soldier is pointed to2.1.0▲ 336
stringgetHeadgearIdReturns the current wearing headgear Id2.1.0▲ 320
floatgetHealthGet the soldier's health2.1.0▲ 309
stringgetHeldWeaponIdReturns the id of the weapon the soldier is currently holding in their hands.2.1.0▲ 59
vec3getMoveDirectionReturns the moving direction of the soldier2.1.0▲ 322
stringgetNameReturns the soldier's full name2.1.0▲ 418
SoldiergetNearestInjuredGet the nearest wounded soldier around the current one2.1.0▲ 317
VehiclegetNearestVehicleToRepairReturns the nearest vehicle that requires repair from the current soldier2.1.0▲ 322
stringgetOwnerIdGet Id of the online player controlling this soldier (Including AIs being controlled by his machine).2.1.0▲ 328
vec3getPositionGet world position of the soldier2.1.0▲ 432
SquadgetSquadGet the Squad that the soldier is currently in. Notice: The squad might not be available immediatly after a soldier is spawned, so make sure to wait for it to be ready2.1.0▲ 329
floatgetSuppressionValueChecks the suppression value of the soldier from the enemy fire.2.1.0▲ 331
stringgetUnequippedWeaponIdReturns the id of the weapon the soldier carries slung on their back rather than in their hands.2.1.0▲ 68
stringgetUniformIdGet the Id of the uniform worn by the soldier2.1.0▲ 302
integergetUniqueIdGet unique identifier for the unit. This is useful to check if a unit already exist, or to find specific units with findSoldier, especially across the network or between different phases.2.1.0▲ 389
vec3getVelocityReturns the current soldier's velocity2.1.0▲ 324
stringgetVestIdGet the Id of the vest worn by the soldier2.1.0▲ 424
boolhasHeadgearCheck if the the soldier is wearing an headgear2.1.0▲ 392
boolhasRadioCheck if a soldier is wearing a radio2.1.0▲ 416
boolhasUnequippedWeaponTells whether the soldier carries a second weapon besides the one in their hands.2.1.0▲ 61
boolhasVestCheck if a soldier is wearing a vest2.1.0▲ 295
voidhealSoldierHeals soldier of a certain amount2.1.0▲ 311
voidincapacitateForce incapacitate a soldier2.1.0▲ 354
boolisAIChecks if the current soldier is controlled by the AI2.1.0▲ 418
boolisAimingChecks if the current soldier is aiming the gun2.1.0▲ 372
boolisAlertedCheck if the soldier has spotted an enemy recently and is moving carefully2.1.0▲ 387
boolisAliveChecks if the current soldier is alive2.1.0▲ 355
boolisAlliedCheck if current soldier is part of Allies faction2.1.0▲ 450
boolisAmmoBoxCarrierCheck if soldier is carrying an ammo box2.1.0▲ 374
boolisATSoldierReturns true if the current soldier is an Anti-Tank unit2.1.0▲ 362
boolisAxisCheck if current soldier is part of Axis faction2.1.0▲ 436
boolisBleedingCheck if the soldier is bleeding2.1.0▲ 345
boolisCarriedReturns true if the current soldier is getting carried2.1.0▲ 401
boolisCarryingBodyCheck if the current soldier is carrying an incapacitated soldier2.1.0▲ 363
boolisChargingReturns true if the current soldier is charging2.1.0▲ 376
AiParamsisCivilianCheck if current soldier is part of Civilians faction2.1.0▲ 404
boolisCrawlingReturns true if the current soldier is crawling2.1.0▲ 420
boolisDeadCheck if a soldier is dead2.1.0▲ 359
boolisDoingMeleeCheck if the soldier is doing a melee attack2.1.0▲ 308
boolisEnteringVehicleReturns true if the current soldier has started the entering vehicle animation2.1.0▲ 319
boolisExitingVehicleReturns true if the current soldier has started the exiting vehicle animation2.1.0▲ 386
boolisFallingWithParachuteChecks if the current soldier is falling with a parachute2.1.0▲ 332
boolisFlameThrowerCarrierCheck if a soldier is a flamethrower carrier2.1.0▲ 385
boolisFromChargingFactionCheck if the soldier can execute a charge order2.1.0▲ 315
boolisGroundedReturns true if the soldier is on the ground2.1.0▲ 517
boolisIncapacitatedCheck if a soldier is incapacitated2.1.0▲ 322
boolisInsideVehicleCheck if the soldier is inside a vehicle2.1.0▲ 319
boolisJumpingReturns true if the current soldier is jumping2.1.0▲ 315
boolisMarksmanReturns true if the current soldier is a Marksman2.1.0▲ 262
boolisMechanicReturns true if the current soldier is a mechanic2.1.0▲ 381
boolisMedicReturns true if the current soldier is a medic2.1.0▲ 341
boolisMineCheck whenever I have network authority over a soldier2.1.0▲ 408
boolisMovingReturns true if the current soldier is moving2.1.0▲ 358
boolisOnCoverCheck if a soldier is taking cover2.1.0▲ 362
boolisOnFireReturns true if the current soldier is on fire2.1.0▲ 327
boolisOnWaterCheck if a soldier is walking inside water2.1.0▲ 344
boolisOutOfStaminaReturns true if the current soldier is out of stamina2.1.0▲ 295
boolisPlayerCheck if the soldier is a player2.1.0▲ 330
boolisPlayerFPSReturns true if the current soldier is a player and in first person2.1.0▲ 320
boolisRadiomanCheck if the current soldier is a Radioman2.1.0▲ 366
boolisReachingVehicleToMountCheck if a soldier is on his way to mount inside a vehicle2.1.0▲ 351
boolisReloadingReturns true if the current soldier is reloading a weapon2.1.0▲ 385
boolisRunningReturns true if the current soldier is running2.1.0▲ 408
boolisSameFactionCheck if another soldier is in the same faction of this soldier2.1.0▲ 343
boolisSquadLeaderReturns true if the current soldier is the Squad Leader2.1.0▲ 307
boolisSquadReadyCheck if soldier is in a squad, and the squad is marked as ready to receive orders. Notice: A squad might not be ready immediately after a soldier has spawned, so this can be used to check whenever the soldier is in a squad before getting the squad reference2.1.0▲ 318
boolisStealthReturns true if the soldier is moving stealthly2.1.0▲ 309
boolisSuppressedChecks if the soldier is being suppressed2.1.0▲ 261
boolisSurrenderingCheck if the soldier is surrendering2.1.0▲ 356
boolisTalkingReturns true if the current soldier is talking2.1.0▲ 335
boolisThrowingReturns true if the current soldier is throwing something2.1.0▲ 359
boolisTowardWallReturns true if the current soldier is facing a wall2.1.0▲ 325
boolisUsingVehicleTurretCheck if soldier is operating a turret2.1.0▲ 307
voidjumpMakes the soldier jump. Notice: the jump movement is based on the current soldier velocity and direction.2.1.0▲ 328
voidkillSoldierKills the soldier2.1.0▲ 351
voidleaveVehicleCommands the soldier to eject from the current vehicle.2.1.0▲ 322
voidmoveToMoves the soldier to a specified position using CoverPosition with a new DestinationWithoutCover based on the given position and current pose.2.1.0▲ 345
SoldiermyselfCan be called within a SoldierBrain script to acquire the soldier controlled by the script2.1.0▲ 466
voidremoveBleedingRemoves bleeding effect from soldier2.1.0▲ 345
boolremoveItemRemove one or multiple items from a soldier invenotory2.1.0▲ 323
voidremoveVestRemoves the vest the soldier is wearing, together with everything it holds.2.1.0▲ 58
boolresetCallbackUnassign a callback by it's Id on a specific Soldier2.1.0▲ 432
voidresetCallbacksUnassign all callbacks on a specific Soldier2.1.0▲ 432
voidresetPoseAllow the soldier to automatically choose it's pose, canceling setPose command2.1.0▲ 408
voidsayMakes the soldier say a line based on the VoiceClip Enum2.1.0▲ 422
voidsayClipPlay a 3D Audio Clip, coming from soldier mouth and with soldier speaking animation (.wav)2.1.0▲ 487
voidsetAnimatorBoolSets a bool parameter on the soldier's animator2.1.0▲ 104
voidsetAnimatorControllerLoads a RuntimeAnimatorController by name from the "er2animations" bundle and applies it.2.1.0▲ 89
boolsetBrainSet script that controls AI. Usually AI will work with "Default" behaviour, which will controls the way AI gives and follows squad orders, however it's possible to define a completly new behaviour by coding a dedicated "brain" LUA file and assign it to the AI with this function2.1.0▲ 349
boolsetCallbackRegister a callback for a specific event Id on a specific Soldier. Only a callback can be tied to an event Id, so when this is called again on the same Id, the new callback reference will override previous one. Callback Ids are specified at this page.2.1.0▲ 472
voidsetInVehicleTeleport the soldier inside the specified vehicle.2.1.0▲ 353
voidsetNotAlertedForce concludes the alert state of the soldier2.1.0▲ 324
voidsetOnFireSets the current soldier on fire. Notice: The fire does not damage the soldier. 2.1.0▲ 448
voidsetPlayerForce a soldier to be controlled by the player. Notice: This only works for soldiers and AIs that have been spawned (or are controlled) by current player's machine2.1.0▲ 424
voidsetPoseSets the soldier's pose based on the given integer. The soldier will strictly follow the assigned pose until resetPose is called2.1.0▲ 357
voidstopStops the soldier by resetting the cover position to the current position.2.1.0▲ 318
voidstopAlertPauses the soldier's alert state. Notice: the difference between this and setnotalerted is that this one just pauses the alert state, while the other one stops2.1.0▲ 389
voidstopIncapacitateStops a soldier from being incapacitated2.1.0▲ 564
voidstopSurrenderingCancel soldier surrendering action2.1.0▲ 339
voidsurrenderForce surrender the current soldier2.1.0▲ 460
booltriggerCallbackForce the triggering of a callback set trough setCallback on a specific Soldier2.1.0▲ 443
voidwearHeadgearPuts a headgear on the soldier, replacing the one they are wearing.2.1.0▲ 62
voidwearUniformChanges the uniform the soldier is wearing.2.1.0▲ 79
voidwearVestPuts a vest on the soldier, replacing the one they are wearing.2.1.0▲ 75
Squad

Class to handle a Squad controlling multiple Soldiers.

ReturnFunction NameDescriptionSinceVote
booladdSoldierAdd a Soldier to a squad2.1.0▲ 420
voidalertEnemiesAlert all enemies of the presence of the squad for some time2.1.0▲ 378
voidattackFromPointOrders the squad to attack from the specified waypoint within the given radius.2.1.0▲ 343
voidboardVehicleOrders the squad to board the specified vehicle.2.1.0▲ 339
voidcancelRadioRequestCancels any active radio request by the squad.2.1.0▲ 310
voidchargeOrders the squad to charge towards the specified position within the given radius.2.1.0▲ 422
voidcoverAreaOrders the squad to cover an area defined by a center position and radius.2.1.0▲ 285
voidfireAtWillOrders the squad to fire at will, canceling the stealth "hold fire" order, optionally playing an order animation.2.1.0▲ 358
voidfollowLeaderOrders the squad to follow their leader, optionally playing an order animation.2.1.0▲ 400
voidgetAllMembersGet all soldiers inside the squad2.1.0▲ 330
SoldiergetLeaderGet reference to the Squad Leader2.1.0▲ 359
SoldiergetMechanicGet reference to the Squad Mechanic2.1.0▲ 470
SoldiergetMedicGet reference to the Squad Medic2.1.0▲ 427
vec3getObjectivePositionReturns the position of the squad's current objective, or the leader's position if none is set.2.1.0▲ 297
floatgetObjectiveRadiusReturns the radius of the squad's current objective area, or a default value if none exists.2.1.0▲ 301
SoldiergetRadiomanGet reference to the Squad Radioman2.1.0▲ 475
integergetSquadSizeReturns how many soldiers the squad is made of, including the ones no longer alive. Use hasAliveMembers or getAllMembers when you need the current strength.2.1.0▲ 55
boolhasAliveMembersReturns whether the squad has any alive members.2.1.0▲ 336
boolhasFullySpawnedWhen using in-game Spawn Manager, spawning a squad can take a few instants. This function can be used to check whenever a squad has fully spawned2.1.0▲ 343
boolhasObjectiveReturns whether the squad has an assigned objective.2.1.0▲ 384
voidholdFireOrders the squad to hold fire and move stealthy, optionally playing an order animation.2.1.0▲ 334
boolisPlayerInSquadCheck if Player is inside a squad2.1.0▲ 401
voidleaveVehicleOrders the squad to leave the specified vehicle. The force flag determines whether the leave order is forced.2.1.0▲ 312
voidmoveToOrders the squad to hold an area at the specified position with the given radius. Make sure that the squad can follow order, and eventually that the squad leader AI has give order feature disabled to avoid squad leader to override your orders2.1.0▲ 360
boolremoveSoldierRemove a Soldier from a Squad (Soldier will be put on a new Squad)2.1.0▲ 480
voidrepairVehicleOrders the squad to repair the specified vehicle.2.1.0▲ 382
voidsetClosestObjectiveOrders the squad to set their objective to the closest available one.2.1.0▲ 386
voidsetRandomObjectiveOrders the squad to set a random objective.2.1.0▲ 415
Vehicle

Functions to handle vehicle spawning and behavior.

ReturnFunction NameDescriptionSinceVote
voidaddNewItemToCargoPuts an item in the vehicle's cargo: ammo boxes, magazines, bandages, weapons, anything with an id in the items database. Online the change is sent to the owner of the vehicle and to whoever sits inside.Items of a DLC the executing player does not own are skipped with a line in the F3 console. Nothing is added when the cargo has no room.2.1.0▲ 418
voidbrakeApplies the brakes, bringing the vehicle to a stop.2.1.0▲ 58
boolcanBeRepairedChecks if the vehicle can be repaired2.1.0▲ 303
boolcanPlayEnterAnimationTells whether a soldier boarding the vehicle can play the climbing-in animation, which requires a free animated entry point.2.1.0▲ 65
anycanRecieveDamageChecks if the vehicle can recieve any form of damage.2.1.0▲ 377
boolcanRefillAmmoChecks if is possible to refill ammo for the vehicle2.1.0▲ 397
boolcanShootInDirectionChecks if someone on the vehicle can shoot in that direction2.1.0▲ 310
boolcargoContainsItemCheck if vehicle inventory contains a specific item2.1.0▲ 325
integercountEmptySeatsCounts the empty seats in the vehicle2.1.0▲ 292
integercountItemsCount how many items with a specific Id are found inside the inventory of the vehicle2.1.0▲ 282
anycountPeopleInsideCounts all the people inside the vehicle2.1.0▲ 317
voiddamageApply damage to the hull of a vehicle2.1.0▲ 402
voiddamageEngineDamage vehicle engine (if any)2.1.0▲ 340
voiddamageFuelTankDamage vehicle fuel tank (if any)2.1.0▲ 373
voiddamageHullDamages the vehicle's hull by the given amount, without touching engine, tracks or fuel tank.2.1.0▲ 60
voiddamageTracksDamage vehicle tracks and/or wheels (if any)2.1.0▲ 287
voiddestroyDisable the vehicle forever2.1.0▲ 409
floatgetDamageCheck life amount of a vehicle (hull integrity)2.1.0▲ 375
SoldiergetDriverGet reference to the Soldier driving the vehicle2.1.0▲ 338
floatgetEngineDamageCheck life amount of a vehicle engine (engine integrity)2.1.0▲ 339
stringgetFactionGet faction Id of the vehicle2.1.0▲ 418
floatgetFueltankDamageCheck life amount of vehicle fuel tank2.1.0▲ 256
SoldiergetGunnerGet reference to a soldier controlling a turret of the vehicle2.1.0▲ 338
SoldiergetLeaderGet reference of the soldier in the commanding seat of the vehicle2.1.0▲ 326
stringgetNameReturns the vehicle's display name.2.1.0▲ 60
SoldiergetPassengersGet all passengers of the vehicle2.1.0▲ 332
vec3getPositionGet the world position of the vehicle2.1.0▲ 503
floatgetTracksDamageCheck life amount of vehicle tracks/wheels2.1.0▲ 316
integergetUniqueIdGet unique identifier for the vehicle. This is useful to check if a vehicle already exist, or to find specific vehicle with findVehicle, especially across the network or between different phases.2.1.0▲ 411
boolhasDriverChecks if the vehicle has a driver2.1.0▲ 345
voidholdPositionThe vehicle stays where it is, as a sentinel, within radius metres of its current position. Same as moveTo with the vehicle's own position.2.1.1▲ 41
boolisArtilleryVehicleChecks if the vehicle has any seat to be considered artillery2.1.0▲ 306
boolisBrakingChecks if the vehicle is braking2.1.0▲ 288
boolisDestroyedCheck if vehicle is fully destroyed2.1.0▲ 328
boolisDriverAliveChecks if there's a driver and is alive2.1.0▲ 343
boolisEmptyCheck if vehicle is empty (No units are left inside)2.1.0▲ 374
boolisFullCheck if vehicle seats are all occupied2.1.0▲ 333
boolisLockedCheck whenever a vehicle can be entered or leaved2.1.0▲ 308
boolisMineCheck whenever I have network authority over a vehicle2.1.0▲ 469
voidkickEveryoneOutForce everyone to leave the vehicle2.1.0▲ 324
voidkickUnitsForce specific units to leave the vehicle2.1.0▲ 335
voidmoveToOrders the AI crew to drive the vehicle to a position and keep it within radius metres of it. The gunners keep engaging whatever they see, so a tank parked this way still fights: it just does not leave the spot.Under the hood this is the same hold area order the crew squad gets from squad.moveTo, applied to the squad sitting in the vehicle. squad.followLeader() on that squad releases it. The crew keeps driving around inside the radius, so use a small radius (3-5 m) for a sentinel and a bigger one for a patrol area.2.1.1▲ 43
boolplayerIsInsideCheck if the LOCAL player is currently inside this vehicle2.1.0▲ 92
voidremoveItemFromCargoRemove an item from the cargo of the vehicle2.1.0▲ 320
voidrepairSet vehicle to fully repaired. Notice: This works only on vehicles that are not fully destroyed2.1.0▲ 407
boolresetCallbackUnassign a callback by it's Id on a specific Vehicle2.1.0▲ 467
voidresetCallbacksUnassign all callbacks on a specific Vehicle2.1.0▲ 422
boolsetCallbackRegister a callback for a specific event Id on a specific Vehicle. Only a callback can be tied to an event Id, so when this is called again on the same Id, the new callback reference will override previous one. Callback Ids are specified at this page.2.1.0▲ 341
booltriggerCallbackForce the triggering of a callback set trough setCallback on a specific Vehicle2.1.0▲ 506