### Object Spawning and Management: TypeScript Source: https://context7.com/oanh242832609/unofficial-bf6-portal-sdk-docs/llms.txt Provides examples for dynamically spawning and despawning various game objects like vehicles, props, and effects in TypeScript. Covers spawning at specific locations and rotations, spawning with custom scales, and despawning after a set duration. Utilizes `mod.SpawnObject` and `mod.UnspawnObject`. ```typescript // Spawn a vehicle at specific location const spawnPos = mod.CreateVector(150, 0, 200); const spawnRot = mod.CreateVector(0, 90, 0); const vehicle = mod.SpawnObject( mod.RuntimeSpawn_Limestone.Vehicle_AttackHeli, spawnPos, spawnRot ); // Spawn with custom scale const largeObject = mod.SpawnObject( mod.RuntimeSpawn_Limestone.Prop_Container, spawnPos, spawnRot, mod.CreateVector(2, 2, 2) // 2x scale ); // Despawn after duration async function temporarySpawn() { const obj = mod.SpawnObject( mod.RuntimeSpawn_Limestone.Effect_Explosion, mod.CreateVector(100, 0, 100), mod.CreateVector(0, 0, 0) ); await mod.Wait(5); mod.UnspawnObject(obj); } ``` -------------------------------- ### Conditional Logic Helpers: TypeScript Source: https://context7.com/oanh242832609/unofficial-bf6-portal-sdk-docs/llms.txt Illustrates utility functions for creating clean conditional expressions and branching in game logic using TypeScript. Includes examples for boolean operations like AND, conditional execution using IfThenElse, and string concatenation. Relies on helper functions like `And`, `IfThenElse`, and `Concat`. ```typescript // Boolean operations const canCapture = And( mod.IsPlayerAlive(player), mod.GetObjId(mod.GetPlayerTeam(player)) === 1, mod.IsPlayerInAreaTrigger(player, captureZone) ); // Conditional execution const message = IfThenElse( mod.GetTeamTickets(team1) > mod.GetTeamTickets(team2), () => mod.CreateMessage("Team 1 is winning!"), () => mod.CreateMessage("Team 2 is winning!") ); ShowNotificationMessage(message); // String concatenation (needed due to SDK limitations) const playerName = mod.GetPlayerName(player); const scoreText = Concat("Score: ", mod.GetPlayerScore(player).toString()); ``` -------------------------------- ### GetVFX Function Example (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetVFX.html This TypeScript code snippet demonstrates how to use the GetVFX function from the Unofficial BF6 Portal Typescript-SDK. It takes a VFX number as input and returns an array of VFX objects. Ensure the SDK is properly imported and initialized before calling this function. ```typescript import { GetVFX } from "bf6-portal-sdk"; // Example usage: const vfxNumber = 123; const vfxData = GetVFX(vfxNumber); console.log(vfxData); ``` -------------------------------- ### Capture Point Management: TypeScript Source: https://context7.com/oanh242832609/unofficial-bf6-portal-sdk-docs/llms.txt Details how to control and respond to capture point states and ownership changes in TypeScript. Includes setting up capture points, initializing their states on game start, and tracking capture state changes with asynchronous monitoring. Uses functions like `mod.GetCapturePoint`, `mod.SetCapturePointNeutral`, `mod.SetCapturePointOwningTeam`, `mod.EnableCapturePoint`, and `mod.GetCapturePointOwningTeam`. ```typescript // Setup capture points (ObjIds assigned in Godot) const capturePointA = mod.GetCapturePoint(100); const capturePointB = mod.GetCapturePoint(101); export function OnGameModeStarted() { // Initialize capture points mod.SetCapturePointNeutral(capturePointA); mod.SetCapturePointOwningTeam(capturePointB, mod.GetTeam(1)); mod.EnableCapturePoint(capturePointA, true); } // Track capture state changes const captureStates = new Map(); async function monitorCapturePoints() { const cpACondition = getCapturePointCondition(capturePointA, 0); while (true) { await mod.Wait(0.5); const owningTeam = mod.GetCapturePointOwningTeam(capturePointA); const isTeam1Owned = mod.GetObjId(owningTeam) === 1; if (cpACondition.update(isTeam1Owned)) { const msg = mod.CreateMessage("Objective Alpha captured by Team 1!"); ShowHighlightedGameModeMessage(msg); mod.AddTeamScore(mod.GetTeam(1), 100); } } } ``` -------------------------------- ### Initialize Theme and Show App - TypeScript Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.SetVehicleSpawnerAutoSpawn.html This snippet initializes the document theme based on local storage and hides the body until the application is ready to show the page. It uses a timeout to ensure the app is loaded. ```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 Global Condition Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getGlobalCondition.html Retrieves the global condition state for a given number. ```APIDOC ## GET /getGlobalCondition ### Description Retrieves the global condition state based on a numerical input. ### Method GET ### Endpoint /getGlobalCondition ### Parameters #### Query Parameters - **n** (number) - Required - The number used to determine the condition state. ### Response #### Success Response (200) - **ConditionState[]** - An array of ConditionState objects representing the global condition. #### Response Example ```json [ { "state": "active", "value": 100 }, { "state": "inactive", "value": 50 } ] ``` ``` -------------------------------- ### Get Team by ID (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Fetches a team object using its unique team ID. This function is useful for managing team-based game modes or accessing team-specific information. ```typescript mod.GetTeam(teamId: number): mod.Team ``` -------------------------------- ### Advanced UI (ParseUI) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/README.md The ParseUI function allows for building complex UI hierarchies from a declarative, JSON-like structure, serving as the recommended method for UI creation. ```APIDOC ## Advanced UI (`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. ### Usage ```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 Soldier State (Boolean) - Typescript SDK Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetSoldierState.html Retrieves the soldier's state as an array of booleans. Requires a Player object and a SoldierStateBool enum value. Defined in sdk.d.ts:13690. ```typescript GetSoldierState(player: Player, soldierStateBool: SoldierStateBool): boolean[] ``` -------------------------------- ### AIStartUsingGadget (by position) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AIStartUsingGadget.html Initiates gadget usage for a player targeting a specific position. ```APIDOC ## AIStartUsingGadget (by position) ### Description Initiates gadget usage for a player targeting a specific position. ### Method N/A (Function within SDK) ### Endpoint N/A (Function within SDK) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript AIStartUsingGadget(player: Player, gadget: UnguidedRocketLauncher, targetPos: Vector): void; ``` ### Response #### Success Response (void) This function does not return a value. #### Response Example None ``` -------------------------------- ### AIStartUsingGadget (by player) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AIStartUsingGadget.html Initiates gadget usage for a player targeting another player. ```APIDOC ## AIStartUsingGadget (by player) ### Description Initiates gadget usage for a player targeting another player. ### Method N/A (Function within SDK) ### Endpoint N/A (Function within SDK) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript AIStartUsingGadget(player: Player, gadget: UnguidedRocketLauncher, targetPlayer: Player): void; ``` ### Response #### Success Response (void) This function does not return a value. #### Response Example None ``` -------------------------------- ### Get Soldier State (Number) - Typescript SDK Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetSoldierState.html Retrieves the soldier's state as an array of numbers. Requires a Player object and a SoldierStateNumber enum value. Defined in sdk.d.ts:13687. ```typescript GetSoldierState(player: Player, soldierStateNumber: SoldierStateNumber): number[] ``` -------------------------------- ### Get Vehicle Condition - Typescript Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getVehicleCondition.html Retrieves the condition state for a given vehicle object and a numerical identifier. This function is part of the modlib and returns an array of ConditionState objects. It is defined in modlib.ts. ```typescript getVehicleCondition(obj: Vehicle, n: number): ConditionState[] ``` -------------------------------- ### UI API Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/README.md The UI API provides a powerful system for creating and manipulating UI widgets, including adding text, images, buttons, and containers, as well as finding and setting their visibility. ```APIDOC ## UI API The API provides a powerful system for creating and manipulating UI widgets. ### Core UI Widget Classes * **`mod.UIWidget`**: The base class for all UI widgets. ### UI Widget Creation and Manipulation Functions * **`mod.AddUIText(config: object): mod.UIWidget`**: Adds a text widget to the UI. * **`mod.AddUIImage(config: object): mod.UIWidget`**: Adds an image widget to the UI. * **`mod.AddUIButton(config: object): mod.UIWidget`**: Adds a button widget to the UI. * **`mod.AddUIContainer(config: object): mod.UIWidget`**: 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. ``` -------------------------------- ### Get Player by ID (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves a player object from the game using their unique player ID. This function is essential for accessing player-specific data or manipulating player actions within the game. ```typescript mod.GetPlayer(playerId: number): mod.Player ``` -------------------------------- ### UI Widget Creation with ParseUI in TypeScript Source: https://context7.com/oanh242832609/unofficial-bf6-portal-sdk-docs/llms.txt Illustrates how to create dynamic user interfaces using the `ParseUI` function, which accepts a JSON-like structure to define UI elements. It also shows how to update UI elements after creation. ```typescript // Create a score display UI const scoreUI = ParseUI({ type: "Container", name: "score_container", size: [600, 120], anchor: mod.UIAnchor.TopCenter, offset: [0, 20], children: [ { type: "Text", name: "team1_score", textLabel: "Team 1: 0", size: [280, 50], anchor: mod.UIAnchor.CenterLeft, fontSize: 32, textColor: [0, 150, 255, 255] }, { type: "Text", name: "team2_score", textLabel: "Team 2: 0", size: [280, 50], anchor: mod.UIAnchor.CenterRight, fontSize: 32, textColor: [255, 100, 0, 255] } ] }); // Update UI dynamically function updateScores(team1Score: number, team2Score: number) { const team1Widget = mod.FindUIWidgetWithName("team1_score"); const team2Widget = mod.FindUIWidgetWithName("team2_score"); mod.SetUITextLabel(team1Widget, `Team 1: ${team1Score}`); mod.SetUITextLabel(team2Widget, `Team 2: ${team2Score}`); } ``` -------------------------------- ### Get Soldier State (Vector) - Typescript SDK Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetSoldierState.html Retrieves the soldier's state as an array of Vector objects. Requires a Player object and a SoldierStateVector enum value. Defined in sdk.d.ts:13693. ```typescript GetSoldierState(player: Player, soldierStateVector: SoldierStateVector): Vector[] ``` -------------------------------- ### AIGadgetSettings Function Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AIGadgetSettings.html Configures AI gadget settings for a player. ```APIDOC ## AIGadgetSettings Function ### Description This function allows you to configure AI gadget settings for a specific player. You can control whether usage criteria, cooldowns after use, and inaccuracy should be applied. ### Method N/A (This is a function call within the SDK) ### Parameters #### Parameters - **player** (Player) - Required - The player object for whom to set the gadget settings. - **applyUsageCriteria** (boolean) - Required - Determines if usage criteria should be applied to the gadget. - **applyCoolDownAfterUse** (boolean) - Required - Determines if a cooldown period should be applied after the gadget is used. - **applyInaccuracy** (boolean) - Required - Determines if inaccuracy should be applied to the gadget. ### Returns void ### SDK Definition `sdk.d.ts:11988` ``` -------------------------------- ### State Management (ConditionState) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Manage state transitions effectively, ensuring actions are triggered only once when a specific condition becomes true. Includes methods for creating and updating state, and obtaining state trackers for various game objects. ```APIDOC ## State Management (`ConditionState`) ### Description Manages state transitions, ensuring an action is triggered only once when a condition becomes true. ### Constructor - **`new ConditionState()`**: Creates a new condition state tracker. ### Methods - **`update(newState: boolean): boolean`**: Updates the state and returns `true` only on the transition from `false` to `true`. ### Getting Specific State Instances - **`getPlayerCondition(player: mod.Player, n: number): ConditionState`** - **`getTeamCondition(team: mod.Team, n: number): ConditionState`** - **`getCapturePointCondition(obj: mod.CapturePoint, n: number): ConditionState`** - **`getMCOMCondition(obj: mod.MCOM, n: number): ConditionState`** - **`getVehicleCondition(obj: mod.Vehicle, n: number): ConditionState`** - **`getGlobalCondition(n: number): ConditionState`** ``` -------------------------------- ### Get MCOM Condition State - Typescript Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getMCOMCondition.html The getMCOMCondition function retrieves the condition states for a given MCOM object and a numerical identifier. It returns an array of ConditionState objects. This function is defined within modlib.ts. ```typescript getMCOMCondition(obj: MCOM, n: number): ConditionState[] ``` -------------------------------- ### Get Area Trigger by Object ID (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves an area trigger object from the game scene using its object ID. This is useful for creating zones that detect player entry or exit to trigger events. ```typescript mod.GetAreaTrigger(objId: number): mod.AreaTrigger ``` -------------------------------- ### Utility Functions from modlib/index.ts Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/README.md An overview of the helper functions available in `modlib/index.ts` to streamline common tasks in the BF6 Portal TypeScript modding API. ```APIDOC ## Utility Functions The `modlib/index.ts` file provides a set of useful helper functions to simplify common tasks. * `Concat(s1: string, s2: string): string`: Concatenates two strings. * `And(...rest: boolean[]): boolean`: Returns `true` if all the boolean arguments are `true`. * `getPlayerId(player: mod.Player): number`: A shorthand for `mod.GetObjId(player)`. * `getTeamId(team: mod.Team): number`: A shorthand for `mod.GetObjId(team)`. * `ConvertArray(array: mod.Array): any[]`: Converts a `mod.Array` to a standard TypeScript array. * `FilteredArray(array: mod.Array, cond: (currentElement: any) => boolean): mod.Array`: Filters a `mod.Array` based on a condition and returns a new `mod.Array`. * `IfThenElse(condition: boolean, ifTrue: () => T, ifFalse: () => T): T`: Executes one of two functions based on a condition. * `IsTrueForAll(array: mod.Array, condition: (element: any, arg: any) => boolean, arg: any = null): boolean`: Checks if a condition is true for all elements in a `mod.Array`. * `IsTrueForAny(array: mod.Array, condition: (element: any, arg: any) => boolean, arg: any = null): boolean`: Checks if a condition is true for any element in a `mod.Array`. * `SortedArray(array: any[], compare: (a: any, b: any) => number): any[]`: Sorts a TypeScript array. * `WaitUntil(delay: number, cond: () => boolean): Promise`: Waits for a condition to become true, checking periodically. ``` -------------------------------- ### Get HQ by Object ID (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Retrieves an HQ (Headquarters) object from the game scene using its object ID. This function is likely used in game modes involving base management or strategic objectives. ```typescript mod.GetHQ(objId: number): mod.HQ ``` -------------------------------- ### Theme Initialization Script Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/enums/sdk.mod.CustomNotificationSlots.html This script initializes the theme of the application by reading from local storage or defaulting to 'os'. It then hides the body and displays the app's page after a short delay, ensuring a smooth theme transition. ```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) ``` -------------------------------- ### Get Parent UI Widgets | Typescript Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetUIWidgetParent.html The GetUIWidgetParent function takes a UIWidget as input and returns an array of its parent UIWidgets. This function is defined within the sdk.d.ts file of the Unofficial BF6 Portal Typescript-SDK. ```typescript GetUIWidgetParent(widget: UIWidget): UIWidget[] ``` -------------------------------- ### Theme and Display Initialization (JavaScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.WaitUntil.html This JavaScript snippet sets the theme based on local storage and controls the initial display of the body element. It uses setTimeout to ensure the application is ready before showing the page, preventing a flash of unstyled content. ```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) ``` -------------------------------- ### Get Player Condition (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/modlib.getPlayerCondition.html Retrieves the condition state for a given player object and a numerical identifier. It takes a Player object and a number as input and returns an array of ConditionState objects. Defined in modlib.ts. ```typescript getPlayerCondition(obj: Player, n: number): ConditionState[] ``` -------------------------------- ### TypeScript: UI API for Widget Creation Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Provides functions to create, find, and manipulate UI widgets. Supports text, images, buttons, and containers, with the ability to set visibility and handle button interactions. ```typescript class mod.UIWidget {} function mod.AddUIText(...args: any[]): mod.UIWidget; function mod.AddUIImage(...args: any[]): mod.UIWidget; function mod.AddUIButton(...args: any[]): mod.UIWidget; function mod.AddUIContainer(...args: any[]): mod.UIWidget; function mod.FindUIWidgetWithName(name: string): mod.UIWidget; function mod.SetUIWidgetVisible(widget: mod.UIWidget, visible: boolean); function OnPlayerUIButtonEvent(player: mod.Player, widget: mod.UIWidget, event: mod.UIButtonEvent); ``` -------------------------------- ### Get Capture Point by Object ID (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Fetches a capture point object from the game scene using its object ID. This function is crucial for implementing game modes centered around capturing and controlling specific locations. ```typescript mod.GetCapturePoint(objId: number): mod.CapturePoint ``` -------------------------------- ### OngoingHQ Function Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.EventHandlerSignatures.OngoingHQ.html Initializes the OngoingHQ with an HQ event. ```APIDOC ## OngoingHQ Function ### Description Initializes the OngoingHQ with an HQ event. ### Method (Implied, as it's a function call, not a REST endpoint) ### Endpoint (Not applicable for this function) ### Parameters #### Path Parameters (Not applicable) #### Query Parameters (Not applicable) #### Request Body (Not applicable) ### Request Example ```typescript // Assuming 'hqEvent' is an instance of the HQ type OngoingHQ(hqEvent); ``` ### Response #### Success Response - **void** - This function does not return a meaningful value, but it returns an empty array `[]`. #### Response Example ```json [] ``` ### Source Defined in sdk.d.ts:13924 ``` -------------------------------- ### Get UI Widget Padding (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.GetUIWidgetPadding.html This TypeScript function, GetUIWidgetPadding, retrieves padding values (top, right, bottom, left) for a given UI widget. It is defined in sdk.d.ts and returns an array of numbers representing the padding. ```typescript function GetUIWidgetPadding(widget: UIWidget): number[] ``` -------------------------------- ### EnablePlayerDeploy Function Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.EnablePlayerDeploy.html Allows or disallows a player from deploying. ```APIDOC ## EnablePlayerDeploy ### Description This function enables or disables the deployment capability for a given player. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **player** (Player) - The player object for whom to change deployment status. * **deployAllowed** (boolean) - A boolean value indicating whether deployment is allowed (true) or not (false). ### Request Example ```json { "player": { /* Player object details */ }, "deployAllowed": true } ``` ### Response #### Success Response (void) This function does not return a value. #### Response Example None ``` -------------------------------- ### AddUIText Function Overloads Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddUIText.html The AddUIText function in the BF6 Portal SDK has multiple overloads to support different UI configurations. These overloads allow for basic text display, targeted display to players or teams, and advanced customization with background properties and text styling. ```APIDOC ## AddUIText Function ### Description Adds a UI text element to the game. ### Method This documentation describes function overloads, not a specific HTTP method. ### Endpoint N/A (Client-side SDK function) ### Parameters **Overload 1:** * **name** (string) - Required - The name of the UI 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. **Overload 2:** * **name** (string) - Required - The name of the UI 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. * **receiver** (Player | Team) - Required - The player or team to target. **Overload 3:** * **name** (string) - Required - The name of the UI 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. * **parent** (UIWidget) - Required - The parent UI widget. * **visible** (boolean) - Required - Whether the element is visible. * **padding** (number) - Required - The padding around the text. * **bgColor** (Vector) - Required - The background color. * **bgAlpha** (number) - Required - The background transparency. * **bgFill** (UIBgFill) - Required - The background fill type. * **message** (Message) - Required - The message content to display. * **textSize** (number) - Required - The size of the text. * **textColor** (Vector) - Required - The color of the text. * **textAlpha** (number) - Required - The transparency of the text. * **textAnchor** (UIAnchor) - Required - The anchor point for the text. **Overload 4:** * **name** (string) - Required - The name of the UI 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. * **parent** (UIWidget) - Required - The parent UI widget. * **visible** (boolean) - Required - Whether the element is visible. * **padding** (number) - Required - The padding around the text. * **bgColor** (Vector) - Required - The background color. * **bgAlpha** (number) - Required - The background transparency. * **bgFill** (UIBgFill) - Required - The background fill type. * **message** (Message) - Required - The message content to display. * **textSize** (number) - Required - The size of the text. * **textColor** (Vector) - Required - The color of the text. * **textAlpha** (number) - Required - The transparency of the text. * **textAnchor** (UIAnchor) - Required - The anchor point for the text. * **receiver** (Player | Team) - Required - The player or team to target. ### Returns void ### Examples **Basic Usage (Overload 1):** ```typescript // Assuming 'myMessage' is a valid Message object and 'myVector' is a valid Vector object AddUIText("myTextElement", myVector, myVector, UIAnchor.TopLeft, myMessage); ``` **Targeted Display (Overload 2):** ```typescript // Assuming 'myMessage' is a valid Message object, 'myVector' is a valid Vector object, and 'player1' is a Player object AddUIText("myTargetedText", myVector, myVector, UIAnchor.Center, myMessage, player1); ``` **Advanced Customization (Overload 3):** ```typescript // Assuming 'myMessage' is a valid Message object, 'myVector' is a valid Vector object, 'myWidget' is a UIWidget object AddUIText("myFancyText", myVector, myVector, UIAnchor.BottomRight, myWidget, true, 10, new Vector(255, 255, 255), 0.8, UIBgFill.Solid, myMessage, 14, new Vector(0, 0, 0), 1.0, UIAnchor.Center); ``` **Advanced Targeted Display (Overload 4):** ```typescript // Assuming 'myMessage' is a valid Message object, 'myVector' is a valid Vector object, 'myWidget' is a UIWidget object, and 'teamAlpha' is a Team object AddUIText("myAdvancedTargetedText", myVector, myVector, UIAnchor.TopCenter, myWidget, false, 5, new Vector(100, 100, 100), 0.5, UIBgFill.Outline, myMessage, 12, new Vector(255, 0, 0), 0.9, UIAnchor.TopLeft, teamAlpha); ``` ``` -------------------------------- ### SpawnAIFromAISpawner Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.SpawnAIFromAISpawner.html The SpawnAIFromAISpawner function allows for spawning AI from a spawner. It has multiple overloads to accommodate different parameters. ```APIDOC ## SpawnAIFromAISpawner (Overload 1) ### Description Spawns an AI from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 2) ### Description Spawns an AI of a specific class with a given name from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 3) ### Description Spawns an AI of a specific class from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 4) ### Description Spawns an AI with a given name from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 5) ### Description Spawns an AI for a specific team from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 6) ### Description Spawns an AI of a specific class for a given team with a name from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 7) ### Description Spawns an AI of a specific class for a given team from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ## SpawnAIFromAISpawner (Overload 8) ### Description Spawns an AI with a given name for a specific team from a spawner. ### Method *Not applicable (this is a function signature, not an API endpoint)* ### Endpoint *Not applicable (this is a function signature, not an API endpoint)* ### Parameters #### Path Parameters *None* #### Query Parameters *None* #### Request Body *None* ### Request Example *Not applicable (this is a function signature, not an API endpoint)* ### Response #### Success Response (200) *Returns void* #### Response Example *Not applicable (this is a function signature, not an API endpoint)* ``` -------------------------------- ### State Management (ConditionState) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/README.md The ConditionState class helps manage state transitions, ensuring actions are triggered only once when a condition becomes true. It provides methods to update state and retrieve specific condition states for game objects. ```APIDOC ## State Management (`ConditionState`) The `ConditionState` class helps manage state transitions, ensuring that an action is triggered only once when a condition becomes true. ### Methods * **`new ConditionState()`**: Creates a new condition state tracker. * **`update(newState: boolean): boolean`**: Updates the state and returns `true` only on the transition from `false` to `true`. ### Get Specific Condition States You can get a specific `ConditionState` instance for different game objects: * **`getPlayerCondition(player: mod.Player, n: number): ConditionState`**: Gets the condition state for a player. * **`getTeamCondition(team: mod.Team, n: number): ConditionState`**: Gets the condition state for a team. * **`getCapturePointCondition(obj: mod.CapturePoint, n: number): ConditionState`**: Gets the condition state for a capture point. * **`getMCOMCondition(obj: mod.MCOM, n: number): ConditionState`**: Gets the condition state for an MCOM object. * **`getVehicleCondition(obj: mod.Vehicle, n: number): ConditionState`**: Gets the condition state for a vehicle. * **`getGlobalCondition(n: number): ConditionState`**: Gets a global condition state. ``` -------------------------------- ### ForcePlayerToSeat Function Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.ForcePlayerToSeat.html Details about the ForcePlayerToSeat function, including parameters and return type. ```APIDOC ## ForcePlayerToSeat ### Description Forces a specified player into a specific seat of a vehicle. ### Method Not Applicable (This is a function, not an HTTP endpoint) ### Endpoint Not Applicable (This is a function, not an HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Function Signature `ForcePlayerToSeat(player: Player, vehicle: Vehicle, seatNumber: number): void[]` ### Parameters - **player** (Player) - The player object to be seated. - **vehicle** (Vehicle) - The vehicle object where the player will be seated. - **seatNumber** (number) - The number of the seat to place the player in. ### Returns - **void[]** - This function does not return any meaningful value, indicated by void. ### Example ```typescript // Assuming 'playerObject' and 'vehicleObject' are valid Player and Vehicle instances // and 'seatIndex' is the desired seat number ForcePlayerToSeat(playerObject, vehicleObject, seatIndex); ``` ### Source - Defined in sdk.d.ts:13291 ``` -------------------------------- ### RayCast Function Signature (TypeScript) Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.RayCast.html This TypeScript snippet shows the two overloaded signatures for the RayCast function. It accepts a Player object and two Vector objects (start and stop), or just two Vector objects. The function returns void and is used for raycasting. It is defined in the sdk.d.ts file. ```typescript RayCast(player: Player, start: Vector, stop: Vector): void RayCast(start: Vector, stop: Vector): void ``` -------------------------------- ### Core Concepts and Event-Driven API Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/README.md An overview of the fundamental principles of the BF6 Portal TypeScript modding API, emphasizing its event-driven nature and integration with Godot. ```APIDOC ## Core Concepts * **Event-Driven:** The API is heavily based on events. You can hook into the game's lifecycle by implementing specific functions that are called when certain events occur (e.g., `OnPlayerJoinGame`, `OnPlayerDied`). * **`mod` Namespace:** All API functions, classes, and enums are accessible through the `mod` namespace. * **Godot Integration:** The API is tightly integrated with the Godot scene. You can access and manipulate objects in your scene from your TypeScript code. * **Object-Oriented:** The API is designed to be used in an object-oriented way. You can create classes to represent your game logic, player data, and UI components. ``` -------------------------------- ### AddUIImage - Basic Image Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddUIImage.html Adds a basic UIImage to the UI. Requires name, position, size, anchor, and image type. Returns void. ```typescript AddUIImage( name: string, position: [Vector](../types/sdk.mod.Vector.html), size: [Vector](../types/sdk.mod.Vector.html), anchor: [UIAnchor](../enums/sdk.mod.UIAnchor.html), imageType: [UIImageType](../enums/sdk.mod.UIImageType.html) ): void ``` -------------------------------- ### Advanced UI with ParseUI Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/index.html Utilize the `ParseUI` function to construct complex UI hierarchies declaratively using a JSON-like structure. This is the recommended approach for building UIs. ```APIDOC ## Advanced UI (`ParseUI`) ### Description Builds complex UI hierarchies from a declarative, JSON-like structure. This is the recommended way to create UIs. ### Usage ```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, }, ], }); ``` ``` -------------------------------- ### Spawner and Game State Event Handlers Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/modules/sdk.mod.EventHandlerSignatures.html Handles events related to spawner actions, time limits, and vehicle states. ```APIDOC ## Spawner and Game State Event Handlers This section details event handlers for spawner activities and game state changes. ### OnSpawnerSpawned - **Description**: Triggered when a spawner successfully spawns an entity. - **Method**: Event - **Endpoint**: N/A (Event Handler) ### OnTimeLimitReached - **Description**: Triggered when the game's time limit is reached. - **Method**: Event - **Endpoint**: N/A (Event Handler) ### OnVehicleDestroyed - **Description**: Triggered when a vehicle is destroyed. - **Method**: Event - **Endpoint**: N/A (Event Handler) ### OnVehicleSpawned - **Description**: Triggered when a vehicle is spawned. - **Method**: Event - **Endpoint**: N/A (Event Handler) ``` -------------------------------- ### AddUIImage - With Parent, Styling, and Receiver Source: https://github.com/oanh242832609/unofficial-bf6-portal-sdk-docs/blob/main/docs/functions/sdk.mod.AddUIImage.html Adds a UIImage with full styling and receiver specification. Includes all parameters from the previous overload plus the receiver. Returns void. ```typescript AddUIImage( name: string, position: [Vector](../types/sdk.mod.Vector.html), size: [Vector](../types/sdk.mod.Vector.html), anchor: [UIAnchor](../enums/sdk.mod.UIAnchor.html), parent: [UIWidget](../types/sdk.mod.UIWidget.html), visible: boolean, padding: number, bgColor: [Vector](../types/sdk.mod.Vector.html), bgAlpha: number, bgFill: [UIBgFill](../enums/sdk.mod.UIBgFill.html), imageType: [UIImageType](../enums/sdk.mod.UIImageType.html), imageColor: [Vector](../types/sdk.mod.Vector.html), imageAlpha: number, receiver: [Player](../types/sdk.mod.Player.html) | [Team](../types/sdk.mod.Team.html) ): void ```