Skip to content
nyfrk edited this page Feb 3, 2022 · 3 revisions

ISettlers4Api::RecruitWarriors method

Let a building start or stop recruiting settlers. See ISettlers4Api::RecruitVehicle if you want to recruit vehicles.

Syntax

BOOL ISettlers4Api::RecruitWarriors(
	DWORD building, 
	S4_SETTLER_ENUM unit, 
	INT amount,
	DWORD player,
);

Parameters

building

The index of the building in the settler pool that will recruit the warriors. The building must be owned by the specified player and it must be a building that can recruit the desired units. See the remarks section on what buildings and units are supported by this function.

unit

Depending on the building specified in the building parameter, this can be one of the following values. See S4_SETTLER_ENUM for a complete list of settlers that this method may start to recruit.

Value Building Type
S4_SETTLER_DARK_WARRIOR
0x1D
Dark Temple
S4_SETTLER_SWORDMAN_LV1
0x1D
Barracks
S4_SETTLER_SWORDMAN_LV2
0x1E
Barracks
S4_SETTLER_SWORDMAN_LV3
0x1F
Barracks
S4_SETTLER_DARK_THROWER
0x20
Dark Temple
S4_SETTLER_BOWMAN_LV1
0x20
Barracks
S4_SETTLER_BOWMAN_LV2
0x21
Barracks
S4_SETTLER_BOWMAN_LV3
0x22
Barracks
S4_SETTLER_MEDIC_LV1
0x23
Barracks (Roman)
S4_SETTLER_MEDIC_LV2
0x24
Barracks (Roman)
S4_SETTLER_MEDIC_LV3
0x25
Barracks (Roman)
S4_SETTLER_AXEMAN_LV1
0x26
Barracks (Viking)
S4_SETTLER_AXEMAN_LV2
0x27
Barracks (Viking)
S4_SETTLER_AXEMAN_LV3
0x28
Barracks (Viking)
S4_SETTLER_BLOWMAN_LV1
0x29
Barracks (Maya)
S4_SETTLER_BLOWMAN_LV2
0x2A
Barracks (Maya)
S4_SETTLER_BLOWMAN_LV3
0x2B
Barracks (Maya)
S4_SETTLER_SQUAD_LEADER
0x2C
Barracks
S4_SETTLER_SABOTEUR
0x2E
building parameter is eco sector
S4_SETTLER_PIONEER
0x2F
building parameter is eco sector
S4_SETTLER_THIEF
0x30
building parameter is eco sector
S4_SETTLER_GEOLOGIST
0x31
building parameter is eco sector
S4_SETTLER_GARDENER
0x32
building parameter is eco sector
S4_SETTLER_BACKPACK_LV1
0x3D
Barracks (Troyan)
S4_SETTLER_BACKPACK_LV2
0x3E
Barracks (Troyan)
S4_SETTLER_BACKPACK_LV3
0x3F
Barracks (Troyan)

amount

The amount of units that you want to queue for recruitment. This value is besides some exceptions additive. You can pass negative values to reduce the amount of units in the queue. The game does only use the following values.

Value Description
-5 Subtract five unit from the queue.
-1 Subtract one unit from the queue.
0 Clears the queue. This will stop the building from producing further units.
1 Add one unit to the queue.
5 Add five units to the queue.
100 The game will interpret this as infinity and will never decrease the queue.

player

The player who issues the command. Use 0 (zero) to issue this event as the local player.

Return value

If this method could append the event successfully it will return TRUE. If an error occurred it will return FALSE.

Remarks

The corresponding network event id for the barracks and dark temple recruitment is ID 5047.

The following building types and units will be supported in the future.

Recruitable Units Building / Unit
Settler Saboteur
Pioneer
Thief
Geologist
Gardener
Dark Gardener (Dark Tribe)
Dark Shaman (Dark Tribe)
Manacopter (Dark Tribe)

Requirements

Minimum API Level 2
Target Edition Any
Header S4ModApi.h
Library S4ModApi.lib
DLL S4ModApi.dll

See also

ISettlers4Api

ISettlers4Api::RecruitVehicle

Clone this wiki locally