Module UNIT_SCRIPT_INTERFACE

Extensions to the game's unit object.

Functions

GetMemoryAddress () Returns the memory address of the unit object as a hexadecimal string.
GetNumMen () Gets the current number of men in the unit.
SetNumMen (value) Sets the current number of men in the unit.
GetMaxNumMen () Gets the maximum number of men the unit can have.
SetMaxNumMen (value) Sets the maximum number of men the unit can have.
GetActionPoints () Gets the action points remaining for the unit.
SetActionPoints (value) Sets the action points for the unit.
ConvertUnit (unit_key) Replaces the unit with a new unit of the given type, in the same army, using the engine's own unit conversion path (the same one used for religion and technology upgrades).


Functions

GetMemoryAddress ()
Returns the memory address of the unit object as a hexadecimal string.

Returns:

    string memory address (e.g. "0x12345678")
GetNumMen ()
Gets the current number of men in the unit.

Returns:

    integer current number of men
SetNumMen (value)
Sets the current number of men in the unit.

Parameters:

  • value integer new number of men
GetMaxNumMen ()
Gets the maximum number of men the unit can have.

Returns:

    integer maximum number of men
SetMaxNumMen (value)
Sets the maximum number of men the unit can have.

Parameters:

  • value integer new maximum number of men
GetActionPoints ()
Gets the action points remaining for the unit.

Returns:

    integer action points
SetActionPoints (value)
Sets the action points for the unit.

Parameters:

  • value integer new action points
ConvertUnit (unit_key)
Replaces the unit with a new unit of the given type, in the same army, using the engine's own unit conversion path (the same one used for religion and technology upgrades). The new unit keeps the old unit's men count, experience and combat statistics. The old unit object is destroyed in the process, so the original unit reference is no longer valid afterwards.

Parameters:

  • unit_key string the unit record key (e.g. "attinfmeleespearatt")

Returns:

    boolean true if the unit was converted, false otherwise
generated by LDoc 1.5.0