Module FACTION_SCRIPT_INTERFACE
Extensions to the game's faction object.
Functions
| GetMemoryAddress () | Returns the memory address of the faction object as a hexadecimal string. |
| GetTreasury () | Gets the amount of gold (treasury) for the faction. |
| SetTreasury (value) | Sets the amount of gold (treasury) for the faction. |
| SetCapital (region) | Makes the given region the faction's capital. |
| InstantlyResearchTechnology (technology_key) | Instantly completes research of the given technology for the faction, using the game's own internal path for finishing a technology. |
| SetFactionLeader (new_character[, old_character[, heir_coming_of_age]]) | Sets a new leader for the faction. |
Functions
- GetMemoryAddress ()
-
Returns the memory address of the faction object as a hexadecimal string.
Returns:
-
string
memory address (e.g. "0x12345678")
- GetTreasury ()
-
Gets the amount of gold (treasury) for the faction.
Returns:
-
integer
amount of gold
- SetTreasury (value)
-
Sets the amount of gold (treasury) for the faction.
Parameters:
- value integer new amount of gold
- SetCapital (region)
-
Makes the given region the faction's capital.
Works even if the faction currently has no home region: the fields are
set exactly as the engine does in FACTION::attachtoregion, including the
original home region and home theatre when they are not yet assigned.
Parameters:
- region userdata the region to become the new capital
- InstantlyResearchTechnology (technology_key)
-
Instantly completes research of the given technology for the faction, using the
game's own internal path for finishing a technology. This is exactly what the
engine does when a tech completes, so events, achievements and unit upgrades
fire normally, and parent prerequisites are completed automatically.
Note: this differs from the game's built-in
cm:unlock_technology, which only makes a technology selectable and never actually finishes the research.Parameters:
- technology_key string the technology record key (e.g. "atttechmilitary_barracks")
Returns:
-
boolean
true if the technology was found and completed
- SetFactionLeader (new_character[, old_character[, heir_coming_of_age]])
-
Sets a new leader for the faction.
If
old_characteris provided, the game fires a succession event. Ifheir_coming_of_ageis true, firesfaction_succession_heir_comes_of_ageinstead of the default succession event.Parameters:
- new_character userdata the character to become the new leader
- old_character userdata the outgoing leader (triggers succession event if provided) (optional)
- heir_coming_of_age boolean fire the heir-comes-of-age event variant (default false) (optional)