Module MILITARY_FORCE_SCRIPT_INTERFACE
Extensions to the game's military force object.
Functions
| DisbandUnits (...) | Disbands one or more units from this military force in a single engine transaction. |
| GetIntegrity () | Current integrity (army morale) value of the military force. |
| GetMemoryAddress () | Memory address of the military force object in hexadecimal format. |
| GetRecruitmentQueueSize () | Number of units currently in this military force's recruitment queue. |
| HasIntegrity () | Checks whether this military force tracks integrity (army morale). |
| SetIntegrity (value) | Sets the integrity (army morale) value for this military force, clamped between 0.0 and 100.0. |
Functions
- DisbandUnits (...)
-
Disbands one or more units from this military force in a single engine transaction.
Accepts UNIT userdata objects or zero-based list indices matching
unit_list:item_at.Parameters:
- ... UNIT_SCRIPT_INTERFACE or integer unit objects or 0-based integer indices to disband
Returns:
-
boolean
true if units were successfully disbanded, false otherwise
Usage:
-- Option 1: Disband using unit userdata objects: local ul = force:unit_list() force:DisbandUnits(ul:item_at(0), ul:item_at(1)) -- Option 2: Disband using 0-based list indices: force:DisbandUnits(0, 1)
- GetIntegrity ()
-
Current integrity (army morale) value of the military force.
Returns:
-
number or nil
integrity value (0.0 to 100.0), or nil if the force has no integrity tracker
Usage:
local integrity = force:GetIntegrity() if integrity and integrity < 25.0 then -- Force is suffering from severe mutiny / desertion risks end
- GetMemoryAddress ()
-
Memory address of the military force object in hexadecimal format.
Returns:
-
string
memory address (e.g. "0x12345678")
Usage:
local addr = force:GetMemoryAddress()
- GetRecruitmentQueueSize ()
-
Number of units currently in this military force's recruitment queue.
Returns:
-
integer
queued unit count
Usage:
local queue_size = force:GetRecruitmentQueueSize() if queue_size > 0 then -- Force is actively recruiting end
- HasIntegrity ()
-
Checks whether this military force tracks integrity (army morale).
Returns:
-
boolean
true if the force has integrity tracking, false otherwise
Usage:
if force:HasIntegrity() then local morale = force:GetIntegrity() end
- SetIntegrity (value)
-
Sets the integrity (army morale) value for this military force, clamped between 0.0 and 100.0.
Parameters:
- value number new integrity value (0.0 to 100.0)
Returns:
-
boolean
true on success, false otherwise
Usage:
-- Restore army morale / integrity to 100%: force:SetIntegrity(100.0)