Module twdll.world

Campaign world singleton and world-level modifiers for Total War: Attila.

Functions

ExitGame () Requests the engine to cleanly exit the game process to Windows.
ExitToMainMenu () Requests the engine to cleanly exit the active campaign and return to the main menu.
GetFactionCount () Gets the total number of factions existing in the current campaign world.
GetMaxTraits () Gets the maximum number of traits a character can hold simultaneously (vanilla default is 10).
GetMaxUnitsInArmy () Gets the maximum number of units allowed per land army (vanilla default: 20).
GetMaxUnitsInNavy () Gets the maximum number of units allowed per naval fleet (vanilla default: 20).
GetMemoryAddress () Returns the memory address of the WORLD singleton as a hexadecimal string.
GetReinforcementCap () Returns the currently applied reinforcement cap override, or nil if the game default is in effect.
LoadGame (filename) Requests the engine to load a saved game from disk at the end of the current tick.
SaveGame (filename) Saves the active campaign game to disk.
SetMaxTraits ([val]) Sets the maximum number of traits a character can hold simultaneously.
SetMaxUnitsInArmy ([val]) Sets the maximum number of units allowed per land army.
SetMaxUnitsInNavy ([val]) Sets the maximum number of units allowed per naval fleet.
SetReinforcementCap ([max_units]) Sets the reinforcement cap (maximum concurrent units per army in tactical battles) for battles started after this call.


Functions

ExitGame ()
Requests the engine to cleanly exit the game process to Windows.

Returns:

    boolean true if the exit request was dispatched

Usage:

    twdll.world.ExitGame()
ExitToMainMenu ()
Requests the engine to cleanly exit the active campaign and return to the main menu.

Returns:

    boolean true if the exit request was dispatched

Usage:

    twdll.world.ExitToMainMenu()
GetFactionCount ()
Gets the total number of factions existing in the current campaign world.

Returns:

    integer or nil number of factions, or nil if not yet initialised

Usage:

    local total_factions = twdll.world.GetFactionCount()
GetMaxTraits ()
Gets the maximum number of traits a character can hold simultaneously (vanilla default is 10).

Returns:

    integer maximum trait count

Usage:

    local max_traits = twdll.world.GetMaxTraits()
GetMaxUnitsInArmy ()
Gets the maximum number of units allowed per land army (vanilla default: 20).

Returns:

    integer maximum unit count

Usage:

    local max_army_units = twdll.world.GetMaxUnitsInArmy()
GetMaxUnitsInNavy ()
Gets the maximum number of units allowed per naval fleet (vanilla default: 20).

Returns:

    integer maximum unit count

Usage:

    local max_navy_units = twdll.world.GetMaxUnitsInNavy()
GetMemoryAddress ()
Returns the memory address of the WORLD singleton as a hexadecimal string.

Returns:

    string or nil memory address (e.g. "0x12345678"), or nil if not yet initialised

Usage:

    local addr = twdll.world.GetMemoryAddress()
GetReinforcementCap ()
Returns the currently applied reinforcement cap override, or nil if the game default is in effect.

Returns:

    integer or nil current cap value, or nil if default

Usage:

    local cap = twdll.world.GetReinforcementCap()
    if cap then
        -- An override is currently active
    end
LoadGame (filename)
Requests the engine to load a saved game from disk at the end of the current tick.

Parameters:

  • filename string save game filename (e.g. "my_checkpoint" or "tests.save")

Returns:

    boolean true if the load request was successfully dispatched

Usage:

    twdll.world.LoadGame("tests.save")
SaveGame (filename)
Saves the active campaign game to disk.

Parameters:

  • filename string save game filename (with or without .save extension)

Returns:

    boolean true if the save succeeded, false otherwise

Usage:

    local success = twdll.world.SaveGame("my_checkpoint")
SetMaxTraits ([val])
Sets the maximum number of traits a character can hold simultaneously. Prevents new traits from being discarded when a character exceeds 10 traits. Pass no arguments or nil to restore the vanilla engine default (10).

Parameters:

  • val integer new maximum trait count (e.g. 20, 30, 50), or omit/nil to restore the default (optional)

Usage:

    -- Expand character trait limit to 30:
    twdll.world.SetMaxTraits(30)
    
    -- Restore vanilla default (10):
    twdll.world.SetMaxTraits()
SetMaxUnitsInArmy ([val])
Sets the maximum number of units allowed per land army. Affects recruitment limits, army stacking, and UI capacity. Pass no arguments or nil to restore the vanilla engine default (20).

Parameters:

  • val integer new maximum unit count (e.g. 40), or omit/nil to restore the default (optional)

Usage:

    -- Allow up to 40 units per land army:
    twdll.world.SetMaxUnitsInArmy(40)
    
    -- Restore vanilla default (20):
    twdll.world.SetMaxUnitsInArmy()
SetMaxUnitsInNavy ([val])
Sets the maximum number of units allowed per naval fleet. Affects naval recruitment limits and fleet stacking. Pass no arguments or nil to restore the vanilla engine default (20).

Parameters:

  • val integer new maximum unit count (e.g. 30), or omit/nil to restore the default (optional)

Usage:

    -- Allow up to 30 ships per naval fleet:
    twdll.world.SetMaxUnitsInNavy(30)
    
    -- Restore vanilla default (20):
    twdll.world.SetMaxUnitsInNavy()
SetReinforcementCap ([max_units])
Sets the reinforcement cap (maximum concurrent units per army in tactical battles) for battles started after this call. Pass no arguments or nil to restore the vanilla engine default. Any value >= 0 is applied as an absolute cap.

Parameters:

  • max_units integer new cap value (e.g. 40, 80), or omit/nil to restore the default (optional)

Usage:

    -- Allow up to 40 reinforcement units simultaneously in tactical battle:
    twdll.world.SetReinforcementCap(40)
    
    -- Restore vanilla behavior:
    twdll.world.SetReinforcementCap()
generated by LDoc 1.5.0