Skip to content

API Player actions

Alexandre 'kidev' Poumaroux edited this page Oct 21, 2026 · 4 revisions

Player actions

Import from proleak import actions

Act as the player. Needs the actions capability (local servers).

Functions

Returns Function
bool build(builder_unit: int, unit_type: str, x: float, z: float) Place unit_type at map point (x, z) with your builder unit.
bool train(unit: int, unit_type: str) Upgrade or train unit into unit_type.
bool hire(unit: int, unit_type: str) Hire mercenary unit_type from unit (your king or barracks).
bool upgrade(upgrade_id: str, level: int) Buy a king upgrade or Upgrade Supply, to level (the game's data calls these researches).

Detailed description

Each action returns True when the game's client accepts the order and sends it to the server, and False when one of the client's own checks refuses it (not enough gold, a blocked square).

Function documentation

build

build(builder_unit: int, unit_type: str, x: float, z: float) -> bool

Place unit_type at map point (x, z) with your builder unit.

train

train(unit: int, unit_type: str) -> bool

Upgrade or train unit into unit_type.

hire

hire(unit: int, unit_type: str) -> bool

Hire mercenary unit_type from unit (your king or barracks).

upgrade

upgrade(upgrade_id: str, level: int) -> bool

Buy a king upgrade or Upgrade Supply, to level (the game's data calls these researches).


Previous: Mouse and keyboard | Next: Plugin lifecycle

Clone this wiki locally