### Initialize Theme and Show Page Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetUIWidgetVisible.html This snippet demonstrates initializing the UI theme based on local storage or OS preference and ensures the application page is shown after a short delay. It handles cases where the app might not be immediately available. This code is typically run at the start of the application. ```typescript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app?app.showPage():document.body.removeProperty("display"),500) ``` -------------------------------- ### Initialize Capture Points Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Initializes capture points for a game mode at its start. It retrieves capture point objects by their IDs, sets them to neutral and enabled states, and initializes their capture progress to 0. ```typescript const CP_A_ID = 20; const CP_B_ID = 21; const CP_C_ID = 22; const captureProgress = new Map(); export function OnGameModeStarted() { // Initialize capture points [CP_A_ID, CP_B_ID, CP_C_ID].forEach(cpId => { const cp = mod.GetCapturePoint(cpId); mod.SetCapturePointNeutral(cp, true); mod.SetCapturePointEnabled(cp, true); captureProgress.set(cpId, 0); }); } ``` -------------------------------- ### Initialize Game Mode Headquarters Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Sets up headquarters for teams at the start of a game mode. It retrieves HQ objects by their IDs, enables them, and assigns them to specific teams. This function is typically called once when the game mode begins. ```typescript // Define HQ ObjIds matching your Godot scene const HQ_TEAM1_ID = 10; const HQ_TEAM2_ID = 11; export function OnGameModeStarted() { const hqTeam1 = mod.GetHQ(HQ_TEAM1_ID); const hqTeam2 = mod.GetHQ(HQ_TEAM2_ID); // Enable spawning at headquarters mod.SetHQEnabled(hqTeam1, true); mod.SetHQEnabled(hqTeam2, true); // Set which team can spawn at each HQ mod.SetHQTeam(hqTeam1, mod.GetTeam(1)); mod.SetHQTeam(hqTeam2, mod.GetTeam(2)); } ``` -------------------------------- ### RandomValueInArray Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.RandomValueInArray.html Provides a utility function to get a random value from an array. ```APIDOC ## RandomValueInArray ### Description Returns a random value from the provided array. ### Method N/A (Utility Function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "array": [1, 2, 3, 4, 5] } ``` ### Response #### Success Response (200) - **value** (any) - A randomly selected element from the input array. #### Response Example ```json { "value": 3 } ``` ``` -------------------------------- ### Get Team by ID Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves a team object using its unique team ID. Useful for managing team-based game mechanics and information. ```typescript mod.GetTeam(teamId: number): mod.Team ``` -------------------------------- ### Initialize Theme and Display - Typescript Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AILOSMoveToBehavior.html Initializes the application theme based on local storage or OS default and handles the initial display of the page. It uses a timeout to ensure the application is ready before showing the page, preventing a visible flicker. ```typescript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app?.app.showPage():document.body.style.removeProperty("display"),500) ``` -------------------------------- ### SDK Function Documentation Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/modules/sdk.mod.html This section lists and describes various functions available in the BF6 SDK. Each function is documented with its purpose, parameters, and expected behavior. ```APIDOC ## SDK Functions Reference This document provides a reference for the functions available in the unofficial BF6 SDK. ### GlobalVariable * **Description**: Accesses a global variable. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### GreaterThan * **Description**: Checks if the first value is greater than the second value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### GreaterThanEqualTo * **Description**: Checks if the first value is greater than or equal to the second value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### HasEquipment * **Description**: Checks if a unit has a specific piece of equipment. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### HasUIWidgetWithName * **Description**: Checks if a UI widget with the specified name exists. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Heal * **Description**: Heals a unit by a specified amount. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IfThenElse * **Description**: Executes one of two code blocks based on a condition. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsCurrentMap * **Description**: Checks if the current map is the specified map. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsFaction * **Description**: Checks if a unit belongs to a specific faction. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsInventorySlotActive * **Description**: Checks if an inventory slot is active. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsPlayerValid * **Description**: Checks if a player is valid. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsType * **Description**: Checks if an object is of a specific type. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsVehicleOccupied * **Description**: Checks if a vehicle is occupied. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### IsVehicleSeatOccupied * **Description**: Checks if a specific seat in a vehicle is occupied. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Kill * **Description**: Kills a unit. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LastOf * **Description**: Returns the last element of an array. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LeftVector * **Description**: Gets the left vector of an object. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LessThan * **Description**: Checks if the first value is less than the second value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LessThanEqualTo * **Description**: Checks if the first value is less than or equal to the second value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LocalPositionOf * **Description**: Gets the local position of an object relative to its parent. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### LocalVectorOf * **Description**: Gets the local vector of an object relative to its parent. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Max * **Description**: Returns the maximum of two values. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Message * **Description**: Displays a message to the player. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Modulo * **Description**: Returns the remainder of a division. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### MoveObject * **Description**: Moves an object to a specified position. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### MoveObjectOverTime * **Description**: Moves an object to a specified position over a duration. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### MoveVFX * **Description**: Moves a visual effect. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Multiply * **Description**: Multiplies two values. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Normalize * **Description**: Normalizes a vector. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Not * **Description**: Negates a boolean value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### NotEqualTo * **Description**: Checks if two values are not equal. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### ObjectVariable * **Description**: Accesses an object-specific variable. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Or * **Description**: Performs a logical OR operation on two boolean values. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### OrbitObjectOverTime * **Description**: Orbits an object around a point over a duration. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### PauseGameModeTime * **Description**: Pauses the game mode time. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Pi * **Description**: Returns the value of Pi. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### PlaySound * **Description**: Plays a sound effect. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### PlayVO * **Description**: Plays voice-over audio. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RadiansToDegrees * **Description**: Converts an angle from radians to degrees. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RaiseToPower * **Description**: Raises a base number to a specified power. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RandomizedArray * **Description**: Returns a randomized version of an array. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RandomReal * **Description**: Generates a random real number within a specified range. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RandomValueInArray * **Description**: Returns a random value from an array. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RayCast * **Description**: Performs a raycast to detect objects in a specific direction. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RemoveEquipment * **Description**: Removes a piece of equipment from a unit. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RemoveUIIcon * **Description**: Removes a UI icon. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### ResetGameModeTime * **Description**: Resets the game mode time to its initial value. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### Resupply * **Description**: Resupplies a unit with ammunition or resources. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RightVector * **Description**: Gets the right vector of an object. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RotateObject * **Description**: Rotates an object by a specified angle around an axis. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### RoundToInteger * **Description**: Rounds a number to the nearest integer. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SendErrorReport * **Description**: Sends an error report to the developers. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetAIToHumanDamageModifier * **Description**: Sets the damage modifier for AI units to match human damage. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetCameraTypeForAll * **Description**: Sets the camera type for all players. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetCameraTypeForPlayer * **Description**: Sets the camera type for a specific player. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetCapturePointCapturingTime * **Description**: Sets the time required to capture a capture point. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetCapturePointNeutralizationTime * **Description**: Sets the time required to neutralize a capture point. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetCapturePointOwner * **Description**: Sets the owner of a capture point. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetEmplacementSpawnerAbandonVehicleOutOfCombatArea * **Description**: Configures the emplacement spawner to abandon vehicles outside of combat areas. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetEmplacementSpawnerApplyDamageToAbandonVehicle * **Description**: Configures the emplacement spawner to apply damage to abandoned vehicles. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ### SetEmplacementSpawnerAutoSpawn * **Description**: Enables or disables auto-spawning for the emplacement spawner. * **Endpoint**: Not applicable (function call). * **Method**: Not applicable. ``` -------------------------------- ### Get HQ by Object ID Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Fetches an HQ object from the game world using its object ID. This function is crucial for interacting with or querying HQ-related data. ```typescript mod.GetHQ(objId: number): mod.HQ ``` -------------------------------- ### Initialize Theme and Display - TypeScript Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddAttachmentToWeaponPackage.html This script initializes the theme based on local storage or OS preference and then conditionally displays the application or removes the display style after a delay. It's designed to manage the initial loading state of the application. ```typescript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app ? app.showPage() : document.body.style.removeProperty("display"), 500) ``` -------------------------------- ### Get Player by ID Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves a player object using their unique player ID. This function is essential for targeting specific players with game logic or events. ```typescript mod.GetPlayer(playerId: number): mod.Player ``` -------------------------------- ### Get Value from Array by Index (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.ValueInArray.html Retrieves an element from an array at a specified index. This function is part of the SDK's mod module and is defined in sdk.d.ts. ```typescript function ValueInArray(array: Array, index: number): any[] ``` -------------------------------- ### Advanced UI Creation with ParseUI Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/README.md Demonstrates how to construct complex UI hierarchies using the ParseUI function with a declarative, JSON-like structure. This is the recommended method for UI creation. ```typescript const myUI = ParseUI({ type: "Container", name: "my_container", size: [500, 100], anchor: mod.UIAnchor.TopCenter, children: [ { type: "Text", name: "my_text", textLabel: "Hello, World!", size: [200, 50], anchor: mod.UIAnchor.Center, }, ], }); ``` -------------------------------- ### Modulo Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.Modulo.html Provides details on how to use the Modulo function, including its parameters and return value. ```APIDOC ## Modulo Function ### Description Calculates the modulo of two numbers. ### Method N/A (This is a function, not an HTTP endpoint) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **number[]** - An array containing the result of the modulo operation. #### Response Example ```json { "example": "[result]" } ``` ### Details * **Function Signature**: Modulo(number0: number, number1: number): number[] * **Parameters**: * **number0** (number) - The dividend. * **number1** (number) - The divisor. * **Returns**: number[] - The result of the modulo operation. * **Defined in**: sdk.d.ts:13555 ``` -------------------------------- ### GetSquad (Player Overload) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetSquad.html Retrieves squad information using a Player object. This overload is useful when you have a Player instance and want to get their associated squad details. ```APIDOC ## GET /sdk/GetSquad ### Description Retrieves squad information associated with a given Player object. ### Method GET ### Endpoint /sdk/GetSquad ### Parameters #### Query Parameters - **player** (Player) - Required - The Player object to retrieve squad information for. ### Request Example ```json { "player": { /* Player object details */ } } ``` ### Response #### Success Response (200) - **squads** (Squad[]) - An array of Squad objects associated with the player. #### Response Example ```json { "squads": [ { "id": 1, "name": "Alpha", "leaderId": "player123", "memberIds": ["player123", "player456"] } ] } ``` ``` -------------------------------- ### Get Capture Point by Object ID Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves a Capture Point object using its object ID. This is necessary for implementing logic related to controlling or interacting with capture points. ```typescript mod.GetCapturePoint(objId: number): mod.CapturePoint ``` -------------------------------- ### Initial Page Load Script Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.SetUIImageAlpha.html This script initializes the theme based on local storage or OS preference and controls the initial display of the body content. It uses a timeout to ensure the application is ready before showing the page or removing the display property. ```javascript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app ? app.showPage() : document.body.style.removeProperty("display"), 500); ``` -------------------------------- ### DeployAllPlayers Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.DeployAllPlayers.html Details about the DeployAllPlayers function, which returns an array of void. ```APIDOC ## DeployAllPlayers Function ### Description This function is part of the Unofficial BF6 Portal Typescript-SDK and is responsible for deploying all players. The specific implementation details are abstracted. ### Method N/A (This is a function call, not a REST API endpoint) ### Endpoint N/A ### Parameters This function does not accept any parameters. ### Request Example ```typescript // Example of calling the function (assuming the SDK is initialized) // sdk.DeployAllPlayers(); ``` ### Response #### Success Response - **void[]**: Returns an empty array of void, indicating successful execution without returning specific data. #### Response Example ```json // The function returns void, so typically no direct JSON response is observed. // Successful execution implies no errors were thrown. ``` ### Defined in sdk.d.ts:12197 ``` -------------------------------- ### Get Area Trigger by Object ID Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Fetches an Area Trigger object using its object ID. This function allows for logic that responds to players entering or exiting specific areas. ```typescript mod.GetAreaTrigger(objId: number): mod.AreaTrigger ``` -------------------------------- ### Get X Component of Vector (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.XComponentOf.html Calculates and returns the X component of a given vector. This function is defined within the 'sdk.d.ts' file and is essential for vector-based operations. ```typescript XComponentOf(vector: Vector): number ``` -------------------------------- ### Create Scoreboard UI with ParseUI Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Demonstrates how to build a complete scoreboard UI using the ParseUI declarative structure. It defines containers, text elements, and their properties like size, anchor, and color. This approach simplifies complex UI creation. ```typescript export function OnGameModeStarted() { const scoreboard = ParseUI({ type: "Container", name: "scoreboard_container", size: [600, 400], anchor: mod.UIAnchor.Center, bgColor: [0, 0, 0, 180], bgFill: mod.UIBgFill.Solid, depth: mod.UIDepth.Background, children: [ { type: "Text", name: "scoreboard_title", textLabel: "SCOREBOARD", size: [600, 60], anchor: mod.UIAnchor.TopCenter, fontSize: 32, fontColor: [255, 255, 255, 255], }, { type: "Container", name: "team1_section", size: [280, 300], anchor: mod.UIAnchor.TopLeft, position: [10, 70], children: [ { type: "Text", name: "team1_name", textLabel: "Team 1", size: [280, 40], anchor: mod.UIAnchor.TopCenter, fontSize: 24, fontColor: [100, 150, 255, 255], }, { type: "Text", name: "team1_score", textLabel: "Score: 0", size: [280, 30], anchor: mod.UIAnchor.TopCenter, position: [0, 45], fontSize: 20, } ] }, { type: "Container", name: "team2_section", size: [280, 300], anchor: mod.UIAnchor.TopRight, position: [-10, 70], children: [ { type: "Text", name: "team2_name", textLabel: "Team 2", size: [280, 40], anchor: mod.UIAnchor.TopCenter, fontSize: 24, fontColor: [255, 100, 100, 255], }, { type: "Text", name: "team2_score", textLabel: "Score: 0", size: [280, 30], anchor: mod.UIAnchor.TopCenter, position: [0, 45], fontSize: 20, } ] } ] }); } ``` -------------------------------- ### Get UIButton Alpha Pressed - Typescript Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetUIButtonAlphaPressed.html Retrieves the alpha-pressed state for a given UIWidget. This function is defined within the sdk.d.ts file and returns an array of numbers representing the state. ```typescript GetUIButtonAlphaPressed(widget: UIWidget): number[] ``` -------------------------------- ### Initialize and Cleanup Game Mode Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Handles the game mode's lifecycle events, including initialization and teardown. Use `OnGameModeStarted` to set up game variables and initial states, and `OnGameModeEnding` for cleanup and score calculation. Dependencies include the `mod` namespace for game state manipulation. ```typescript export function OnGameModeStarted() { // Set up game variables, spawn points, UI elements const team1 = mod.GetTeam(1); const team2 = mod.GetTeam(2); mod.SetTeamTickets(team1, 100); mod.SetTeamTickets(team2, 100); // Display initial message to all players ShowEventGameModeMessage(mod.CreateMessage("Game Started!")); } // Clean up when game mode ends export function OnGameModeEnding() { // Perform cleanup, calculate final scores const team1 = mod.GetTeam(1); const winner = mod.GetTeamTickets(team1) > 0 ? "Team 1" : "Team 2"; ShowEventGameModeMessage(mod.CreateMessage(`${winner} Wins!`)); } ``` -------------------------------- ### AddUIText Overload 1 Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddUIText.html Adds a UI text element with basic configuration. ```APIDOC ## AddUIText (Basic) ### Description Adds a UI text element with basic configuration. ### Method Not Applicable (Function Signature) ### Endpoint Not Applicable (Function Signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **name** (string) - Required - The name of the UI text element. * **position** (Vector) - Required - The position of the text element. * **size** (Vector) - Required - The size of the text element. * **anchor** (UIAnchor) - Required - The anchor point for the text element. * **message** (Message) - Required - The message content to display. ### Request Example ```json { "name": "exampleName", "position": {"x": 0, "y": 0}, "size": {"x": 100, "y": 20}, "anchor": "TopLeft", "message": {"text": "Hello, World!"} } ``` ### Response #### Success Response (void) This function returns void. #### Response Example None (void return type) ``` -------------------------------- ### FirstOf Function - Get First Array Element (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.FirstOf.html The FirstOf function takes an array as input and returns the first element of that array. It is defined within the sdk.d.ts file. ```typescript FirstOf(array: sdk.mod.Array): any[] ``` -------------------------------- ### EnablePlayerDeploy Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.EnablePlayerDeploy.html Allows or denies a player's ability to deploy in the game. ```APIDOC ## EnablePlayerDeploy ### Description This function enables or disables player deployment in the BF6 Portal. ### Method N/A (This is a function call within the SDK) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **player** ([Player](../types/sdk.mod.Player.html)) - The player object for whom to modify deployment settings. * **deployAllowed** (boolean) - A boolean value indicating whether deployment should be allowed (true) or denied (false). ### Request Example ```typescript // Assuming 'playerObject' is a valid Player instance enablePlayerDeploy(playerObject, true); ``` ### Response #### Success Response (void) This function does not return any value. #### Response Example N/A ``` -------------------------------- ### Get Vehicle Condition (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getVehicleCondition.html Retrieves the condition states for a given vehicle. This function is defined in modlib.ts and takes a Vehicle object and a number as input, returning an array of ConditionState objects. ```typescript function getVehicleCondition(obj: Vehicle, n: number): ConditionState[] ``` -------------------------------- ### UI API Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/README.md The UI API provides a system for creating and manipulating UI widgets. It includes base classes for widgets and functions to add, find, and modify UI elements. Advanced UI creation can be done using the ParseUI function with a declarative structure. ```APIDOC ## UI API The API provides a powerful system for creating and manipulating UI widgets. ### Base UI Widget * **`mod.UIWidget`**: The base class for all UI widgets. ### UI Widget Creation and Manipulation * **`mod.AddUIText(...)`**: Adds a text widget to the UI. * **`mod.AddUIImage(...)`**: Adds an image widget to the UI. * **`mod.AddUIButton(...)`**: Adds a button widget to the UI. * **`mod.AddUIContainer(...)`**: Adds a container widget to the UI. * **`mod.FindUIWidgetWithName(name: string): mod.UIWidget`**: Finds a UI widget by its name. * **`mod.SetUIWidgetVisible(widget: mod.UIWidget, visible: boolean)`**: Sets the visibility of a UI widget. ### UI Event Handling * **`OnPlayerUIButtonEvent(player: mod.Player, widget: mod.UIWidget, event: mod.UIButtonEvent)`**: Event that is triggered when a player interacts with a UI button. ### Advanced UI Creation (`ParseUI`) The `ParseUI` function allows you to build complex UI hierarchies from a declarative, JSON-like structure. This is the recommended way to create UIs. **Example:** ```typescript const myUI = ParseUI({ type: "Container", name: "my_container", size: [500, 100], anchor: mod.UIAnchor.TopCenter, children: [ { type: "Text", name: "my_text", textLabel: "Hello, World!", size: [200, 50], anchor: mod.UIAnchor.Center, }, ], }); ``` ``` -------------------------------- ### Get Target Score Function (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetTargetScore.html This TypeScript code defines the GetTargetScore function, which is part of the Unofficial BF6 Portal SDK. It returns an array of numbers. The function is defined in the sdk.d.ts file. ```typescript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500) ``` ```typescript GetTargetScore(): number[] ``` -------------------------------- ### AISetTarget Function Overloads Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AISetTarget.html Documentation for the two overloads of the AISetTarget function. ```APIDOC ## AISetTarget ### Description Sets a target for an AI player. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Overload 1: - **aiPlayer** (Player) - Required - The AI player to set the target for. - **targetPlayer** (Player) - Required - The player to be targeted. #### Overload 2: - **player** (Player) - Required - The player for whom to set the target. ### Request Example ```typescript // Overload 1 AISetTarget(aiPlayer, targetPlayer); // Overload 2 AISetTarget(player); ``` ### Response #### Success Response This function returns void. #### Response Example (No return value) ``` -------------------------------- ### EnableAllPlayerDeploy Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.EnableAllPlayerDeploy.html This function allows you to control the player deployment setting in the BF6 Portal. ```APIDOC ## EnableAllPlayerDeploy ### Description Enables or disables player deployment. This function modifies the deployment settings for players. ### Method void ### Endpoint N/A (This is a client-side SDK function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **enablePlayerDeploy** (boolean) - Required - Set to `true` to enable player deployment, `false` to disable. ### Request Example ```typescript EnableAllPlayerDeploy(true); ``` ### Response #### Success Response * void - This function does not return any value. #### Response Example ```json // No return value ``` ``` -------------------------------- ### Get Global Condition State (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getGlobalCondition.html This TypeScript function, getGlobalCondition, retrieves an array of ConditionState objects. It takes a number 'n' as input and is defined within the modlib module. It is marked as protected and external. ```typescript getGlobalCondition(n: number): ConditionState[] ``` -------------------------------- ### DeployPlayer Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.DeployPlayer.html This function is used to deploy a player within the BF6 Portal using the Typescript SDK. ```APIDOC ## DeployPlayer ### Description Deploys a player using the player object. ### Method void ### Endpoint N/A (This is a function call within the SDK) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **player** ([Player](../types/sdk.mod.Player.html)) - Required - The player object to deploy. ### Request Example ```typescript // Assuming 'playerObject' is a valid Player type instance DeployPlayer(playerObject); ``` ### Response #### Success Response (void) This function does not return a value. #### Response Example N/A ``` -------------------------------- ### Get Players in Team (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getPlayersInTeam.html Retrieves an array of Player objects belonging to the specified Team. This function is part of the modlib module and is defined in modlib.ts. It takes a Team object as input and returns an array of Player objects. ```typescript getPlayersInTeam(team: Team): Player[] ``` -------------------------------- ### Create Interactive Button Menu UI with ParseUI Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Illustrates the creation of an interactive menu UI composed of buttons using the ParseUI declarative syntax. Each button is defined with its text, size, and position within a container. This method facilitates the rapid development of user interfaces. ```typescript const menuUI = ParseUI({ type: "Container", name: "main_menu", size: [400, 300], anchor: mod.UIAnchor.Center, children: [ { type: "Button", name: "start_button", textLabel: "START GAME", size: [300, 60], anchor: mod.UIAnchor.TopCenter, position: [0, 20], }, { type: "Button", name: "options_button", textLabel: "OPTIONS", size: [300, 60], anchor: mod.UIAnchor.TopCenter, position: [0, 90], }, { type: "Button", name: "quit_button", textLabel: "QUIT", size: [300, 60], anchor: mod.UIAnchor.TopCenter, position: [0, 160], } ] }); ``` -------------------------------- ### ArraySlice Function (TypeScript) Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.ArraySlice.html Defines the ArraySlice function signature in TypeScript. It takes an array, a start index, and an end index, returning a portion of the array. This function is marked as protected and inherited, indicating its internal use within the SDK. ```typescript ArraySlice(array: Array, startIndex: number, endIndex: number): Array[] ``` -------------------------------- ### AddUIImage Function Overloads Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddUIImage.html The AddUIImage function allows for the creation and addition of UI images within the BF6 Portal. It supports multiple overloads to accommodate different configuration needs, including specifying receivers, parent widgets, and visual properties. ```APIDOC ## AddUIImage ### Description Adds a UI image to the game. ### Method `AddUIImage` (Function Overloads) ### Endpoints N/A (This is a function call within the SDK) ### Parameters **Overload 1:** #### Parameters - **name** (string) - Required - The name of the image. - **position** (Vector) - Required - The position of the image. - **size** (Vector) - Required - The size of the image. - **anchor** (UIAnchor) - Required - The anchor point for the image. - **imageType** (UIImageType) - Required - The type of the image. **Overload 2:** #### Parameters - **name** (string) - Required - The name of the image. - **position** (Vector) - Required - The position of the image. - **size** (Vector) - Required - The size of the image. - **anchor** (UIAnchor) - Required - The anchor point for the image. - **imageType** (UIImageType) - Required - The type of the image. - **receiver** (Player | Team) - Optional - The player or team to which the image will be applied. **Overload 3:** #### Parameters - **name** (string) - Required - The name of the image. - **position** (Vector) - Required - The position of the image. - **size** (Vector) - Required - The size of the image. - **anchor** (UIAnchor) - Required - The anchor point for the image. - **parent** (UIWidget) - Required - The parent widget of the image. - **visible** (boolean) - Required - Whether the image is visible. - **padding** (number) - Required - The padding of the image. - **bgColor** (Vector) - Required - The background color of the image. - **bgAlpha** (number) - Required - The background alpha of the image. - **bgFill** (UIBgFill) - Required - The background fill type of the image. - **imageType** (UIImageType) - Required - The type of the image. - **imageColor** (Vector) - Required - The color of the image. - **imageAlpha** (number) - Required - The alpha of the image. **Overload 4:** #### Parameters - **name** (string) - Required - The name of the image. - **position** (Vector) - Required - The position of the image. - **size** (Vector) - Required - The size of the image. - **anchor** (UIAnchor) - Required - The anchor point for the image. - **parent** (UIWidget) - Required - The parent widget of the image. - **visible** (boolean) - Required - Whether the image is visible. - **padding** (number) - Required - The padding of the image. - **bgColor** (Vector) - Required - The background color of the image. - **bgAlpha** (number) - Required - The background alpha of the image. - **bgFill** (UIBgFill) - Required - The background fill type of the image. - **imageType** (UIImageType) - Required - The type of the image. - **imageColor** (Vector) - Required - The color of the image. - **imageAlpha** (number) - Required - The alpha of the image. - **receiver** (Player | Team) - Optional - The player or team to which the image will be applied. ### Returns `void` - This function does not return a value. ### Examples **Example Usage (Overload 1):** ```typescript // Assuming Vector, UIAnchor, UIImageType are defined elsewhere const imagePosition: Vector = [100, 100]; const imageSize: Vector = [50, 50]; AddUIImage("myImage", imagePosition, imageSize, UIAnchor.Center, UIImageType.Default); ``` **Example Usage (Overload 2):** ```typescript // Assuming Player type is defined elsewhere const player: Player = getLocalPlayer(); // Example function to get player AddUIImage("playerImage", [0, 0], [20, 20], UIAnchor.TopLeft, UIImageType.Icon, player); ``` **Example Usage (Overload 3):** ```typescript // Assuming UIWidget, Vector, UIBgFill, UIImageType are defined elsewhere const widgetPosition: Vector = [0, 0]; const widgetSize: Vector = [200, 100]; const widgetBgColor: Vector = [255, 255, 255]; const widgetImageColor: Vector = [0, 0, 0]; const parentWidget: UIWidget = getWidgetByName("mainLayout"); // Example function AddUIImage("customImage", widgetPosition, widgetSize, UIAnchor.BottomRight, parentWidget, true, 5, widgetBgColor, 0.5, UIBgFill.Solid, UIImageType.Texture, widgetImageColor, 1.0); ``` **Example Usage (Overload 4):** ```typescript // Assuming Team type is defined elsewhere const team: Team = getLocalTeam(); // Example function to get team AddUIImage("teamImage", [10, 10], [30, 30], UIAnchor.TopRight, getWidgetByName("hud"), false, 0, [0, 0, 0], 0, UIBgFill.None, UIImageType.Sprite, [255, 0, 0], 0.8, team); ``` ``` -------------------------------- ### Handle Player Enter Area Trigger Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Manages player entry into area trigger zones. It adds the player to a zone's tracking set and applies zone-specific effects, such as invulnerability in safe zones or starting combat timers in combat zones. ```typescript const SAFEZONE_ID = 30; const COMBAT_ZONE_ID = 31; const playersInZone = new Map>(); export function OnPlayerEnterAreaTrigger( player: mod.Player, trigger: mod.AreaTrigger ) { const triggerId = mod.GetObjId(trigger); const playerId = getPlayerId(player); if (!playersInZone.has(triggerId)) { playersInZone.set(triggerId, new Set()); } playersInZone.get(triggerId)!.add(playerId); if (triggerId === SAFEZONE_ID) { // Player cannot take damage in safe zone mod.SetPlayerInvulnerable(player, true); ShowNotificationMessage( mod.CreateMessage("Entered safe zone"), player ); } else if (triggerId === COMBAT_ZONE_ID) { // Start combat timer startCombatTimer(player); } } ``` -------------------------------- ### Async Timing Functions with TypeScript Source: https://context7.com/nodotproject/unofficial-bf6-portal-sdk-docs/llms.txt Implements asynchronous game logic using async/await for delays and condition checking. Includes functions for simple delays, waiting for player deployment, periodic checks with timeouts, and repeating timers. Relies on SDK functions like mod.Wait, WaitUntil, and mod.CreateMessage. ```typescript async function countdownTimer(seconds: number) { for (let i = seconds; i > 0; i--) { ShowEventGameModeMessage( mod.CreateMessage(`${i}`) ); await mod.Wait(1); } ShowEventGameModeMessage( mod.CreateMessage("GO!") ); } async function waitForPlayerToDeploy(player: mod.Player) { await WaitUntil(0.5, () => { return mod.IsPlayerDeployed(player); }); ShowNotificationMessage( mod.CreateMessage("Welcome to the battlefield!"), player ); } async function waitForObjectiveCapture( cpId: number, teamId: number, timeoutSeconds: number ) { const startTime = Date.now(); await WaitUntil(1.0, () => { const cp = mod.GetCapturePoint(cpId); const owner = mod.GetCapturePointOwner(cp); const elapsed = (Date.now() - startTime) / 1000; if (elapsed > timeoutSeconds) return true; return owner && getTeamId(owner) === teamId; }); } async function startTicketBleed(teamId: number, ticksPerSecond: number) { while (true) { await mod.Wait(1.0); const team = mod.GetTeam(teamId); const currentTickets = mod.GetTeamTickets(team); if (currentTickets <= 0) break; mod.SetTeamTickets(team, currentTickets - ticksPerSecond); } } ``` -------------------------------- ### OngoingEmplacementSpawner Function Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.EventHandlerSignatures.OngoingEmplacementSpawner.html Documentation for the OngoingEmplacementSpawner function, including its parameters and return value. ```APIDOC ## OngoingEmplacementSpawner Function ### Description This function is designed to handle ongoing emplacement spawner events. ### Method Function Call ### Endpoint N/A (This is a client-side SDK function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript // Example usage (assuming EmplacementSpawner is defined elsewhere in the SDK) // const spawnerEvent: EmplacementSpawner = { ... }; // OngoingEmplacementSpawner(spawnerEvent); ``` ### Response #### Success Response - **void** - This function does not return a meaningful value directly, indicated by `void[]`. #### Response Example ```json // No direct JSON response, function executes client-side logic. ``` ### Details - **Defined in:** sdk.d.ts:13922 - **Visibility:** Protected, Inherited, External ``` -------------------------------- ### UI API - Creating Basic UI Widgets Source: https://github.com/nodotproject/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Provides functions to add fundamental UI elements like text, images, buttons, and containers to the game's user interface. These functions serve as the building blocks for more complex UI layouts. ```typescript // Add a text widget const textWidget = mod.AddUIText(player, "MyLabel", "Hello World"); // Add an image widget const imageWidget = mod.AddUIImage(player, "MyIcon", "path/to/image.png"); // Add a button widget const buttonWidget = mod.AddUIButton(player, "MyButton", "Click Me"); // Add a container widget const containerWidget = mod.AddUIContainer(player, "MyContainer", [0, 0], [100, 100]); // Find a UI widget by name const foundWidget = mod.FindUIWidgetWithName("MyLabel"); // Set UI widget visibility mod.SetUIWidgetVisible(buttonWidget, false); ```